Skip to content

Commit 02b559f

Browse files
committed
Add some tests for __builtin_sel
1 parent 154895f commit 02b559f

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

regression/Results/builtins-common

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,3 +391,9 @@ fabsf(7.250000) = 7.250000
391391
fabsf(-7.250000) = 7.250000
392392
fsqrt(3.141590) = 1.772453
393393
sqrt(3.141590) = 1.772453
394+
sel(0, 12345678, deadbeef) = deadbeef
395+
sel(!0, 12345678, deadbeef) = 12345678
396+
sel(0, 123456789abcdef0, deadbeef) = deadbeef
397+
sel(!0, 123456789abcdef0, deadbeef) = 123456789abcdef0
398+
sel(0, 3.141590, 2.718000) = 2.718000
399+
sel(!0, 3.141590, 2.718000) = 3.141590

regression/builtins-common.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@ int main(int argc, char ** argv)
4747
printf("fsqrt(%f) = %f\n", a, __builtin_fsqrt(a));
4848
printf("sqrt(%f) = %f\n", a, __builtin_sqrt(a));
4949

50+
printf("sel(0, %x, %x) = %x\n", x, y, __builtin_sel(x - x, x, y));
51+
printf("sel(!0, %x, %x) = %x\n", x, y, __builtin_sel(x - y, x, y));
52+
printf("sel(0, %llx, %x) = %llx\n", xx, y, __builtin_sel(x - x, xx, y));
53+
printf("sel(!0, %llx, %x) = %llx\n", xx, y, __builtin_sel(x - y, xx, y));
54+
printf("sel(0, %f, %f) = %f\n", a, b, __builtin_sel(x - x, a, b));
55+
printf("sel(!0, %f, %f) = %f\n", a, b, __builtin_sel(x - y, a, b));
56+
5057
/* Make sure that ignoring the result of a builtin
5158
doesn't cause an internal error */
5259
(void) __builtin_bswap(x);

0 commit comments

Comments
 (0)