Stephen Hines | d015ef3 | 2011-01-14 19:08:19 -0800 | [diff] [blame] | 1 | #pragma version(1) |
| 2 | #pragma rs java_package_name(foo) |
| 3 | |
| 4 | uchar uc; |
| 5 | uchar2 uc2; |
| 6 | uchar3 uc3; |
| 7 | uchar4 uc4; |
| 8 | |
| 9 | ushort us; |
| 10 | ushort2 us2; |
| 11 | ushort3 us3; |
| 12 | ushort4 us4; |
| 13 | |
| 14 | uint ui; |
| 15 | uint2 ui2; |
| 16 | uint3 ui3; |
| 17 | uint4 ui4; |
| 18 | |
| 19 | char c; |
| 20 | char2 c2; |
| 21 | char3 c3; |
| 22 | char4 c4; |
| 23 | |
| 24 | short s; |
| 25 | short2 s2; |
| 26 | short3 s3; |
| 27 | short4 s4; |
| 28 | |
| 29 | int i; |
| 30 | int2 i2; |
| 31 | int3 i3; |
| 32 | int4 i4; |
| 33 | |
| 34 | float f; |
| 35 | float2 f2; |
| 36 | float3 f3; |
| 37 | float4 f4; |
| 38 | |
| 39 | #define TEST4_1(ret, typ, fnc) \ |
| 40 | ret = fnc(typ); \ |
| 41 | ret##2 = fnc(typ##2); \ |
| 42 | ret##3 = fnc(typ##3); \ |
| 43 | ret##4 = fnc(typ##4); |
| 44 | |
| 45 | #define TEST4_2(typ, fnc) \ |
| 46 | typ = fnc(typ, typ); \ |
| 47 | typ##2 = fnc(typ##2, typ##2); \ |
| 48 | typ##3 = fnc(typ##3, typ##3); \ |
| 49 | typ##4 = fnc(typ##4, typ##4); |
| 50 | |
| 51 | #define TEST4_2S(typ, fnc) \ |
| 52 | typ = fnc(typ, typ); \ |
| 53 | typ##2 = fnc(typ##2, typ); \ |
| 54 | typ##3 = fnc(typ##3, typ); \ |
| 55 | typ##4 = fnc(typ##4, typ); |
| 56 | |
| 57 | #define TEST_UIFUNC_1(fnc) \ |
| 58 | TEST4_1(uc, c, fnc); \ |
| 59 | TEST4_1(us, s, fnc); \ |
| 60 | TEST4_1(ui, i, fnc); |
| 61 | |
| 62 | #define TEST_IFUNC_1(fnc) \ |
| 63 | TEST4_1(uc, uc, fnc); \ |
| 64 | TEST4_1(c, c, fnc); \ |
| 65 | TEST4_1(us, us, fnc); \ |
| 66 | TEST4_1(s, s, fnc); \ |
| 67 | TEST4_1(ui, ui, fnc); \ |
| 68 | TEST4_1(i, i, fnc); |
| 69 | |
| 70 | #define TEST_IFUNC_2(fnc) \ |
| 71 | TEST4_2(uc, fnc); \ |
| 72 | TEST4_2(c, fnc); \ |
| 73 | TEST4_2(us, fnc); \ |
| 74 | TEST4_2(s, fnc); \ |
| 75 | TEST4_2(ui, fnc); \ |
| 76 | TEST4_2(f, fnc); \ |
| 77 | |
| 78 | |
Stephen Hines | 5baf632 | 2011-04-25 17:21:15 -0700 | [diff] [blame] | 79 | void compile_all_math_int_ops() { |
Stephen Hines | d015ef3 | 2011-01-14 19:08:19 -0800 | [diff] [blame] | 80 | TEST_UIFUNC_1(abs); |
| 81 | TEST_IFUNC_1(clz); |
| 82 | TEST_IFUNC_2(min); |
| 83 | TEST_IFUNC_2(max); |
| 84 | TEST4_2S(f, min); |
| 85 | TEST4_2S(f, max); |
| 86 | |
Stephen Hines | 5baf632 | 2011-04-25 17:21:15 -0700 | [diff] [blame] | 87 | return; |
Stephen Hines | d015ef3 | 2011-01-14 19:08:19 -0800 | [diff] [blame] | 88 | } |
| 89 | |