Created
November 12, 2013 14:32
-
-
Save kraiskil/7431748 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
clang -emit-llvm -S -march=$1 select.cl -o select.ll | |
clang -march=$1 select.c select.ll -o select | |
./select |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
typedef short short16 __attribute__((__ext_vector_type__(16))); | |
short16 __attribute__ ((overloadable)) | |
myselect(short16 a, short16 b, short16 c); | |
/*{ | |
return (c < (short16)0 ? b : a); | |
}*/ | |
volatile short a=0xa; | |
volatile short b=0xb; | |
volatile short c=0xc; | |
volatile short zero=0x0; | |
int main(void) | |
{ | |
short16 av; av.x=a; | |
short16 bv; bv.x=b; | |
short16 cv; cv.x=c; | |
short16 zv; zv.x=zero; | |
short16 res1 = myselect( av, bv, cv ); | |
short16 res2 = myselect( av, bv, zv ); | |
printf("res1.x=%x, res2.x=%x\n", res1.x, res2.x); | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef short short16 __attribute__((__ext_vector_type__(16))); | |
short16 __attribute__ ((overloadable)) | |
myselect(short16 a, short16 b, short16 c) | |
{ | |
return (c < (short16)0 ? b : a); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment