Skip to content

Instantly share code, notes, and snippets.

@kraiskil
kraiskil / gdb annotated & hexdumped
Created August 19, 2014 10:29
for cgdb issue #47
Breaking gdb:
#echo 'q' | gdb --annotate=2 | hexdump -c
0000000 G N U g d b ( U b u n t u
0000010 7 . 7 - 0 u b u n t u 3 . 1 )
0000020 7 . 7 \n C o p y r i g h t ( C
0000030 ) 2 0 1 4 F r e e S o f t
0000040 w a r e F o u n d a t i o n ,
0000050 I n c . \n L i c e n s e G P
0000060 L v 3 + : G N U G P L v e
0000070 r s i o n 3 o r l a t e r
diff --git a/geomfunc.h b/geomfunc.h
index 6f2fde3..19ef462 100644
--- a/geomfunc.h
+++ b/geomfunc.h
@@ -29,7 +29,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#ifndef SMALLPT_GPU
-static float SphereIntersect(
+float SphereIntersect(
__attribute__((aligned(128)))
__constant char data[128];
kernel void test_as_type()
{
char aligner[0x70];
union { uint16 value; char raw[sizeof(uint16)]; } src;
printf("data@ %x\n", data);
printf("src@ %x\n", &src);
printf("aligner@ %x\n", aligner);
@kraiskil
kraiskil / assembly
Last active December 31, 2015 03:29
avx bugs
.file "test-avx.c"
.text
.globl add
.align 16, 0x90
.type add,@function
add: # @add
.cfi_startproc
# BB#0: # %entry
vaddpd %ymm1, %ymm0, %ymm0
ret
#!/bin/bash
clang -emit-llvm -S -march=$1 select.cl -o select.ll
clang -march=$1 select.c select.ll -o select
./select