blob: 59ef57f915f2c076ce20eed0f6dfa66bb26c5a9e [file] [log] [blame]
Stephen Hinesd015ef32011-01-14 19:08:19 -08001#pragma version(1)
2#pragma rs java_package_name(foo)
3
4uchar uc;
5uchar2 uc2;
6uchar3 uc3;
7uchar4 uc4;
8
9ushort us;
10ushort2 us2;
11ushort3 us3;
12ushort4 us4;
13
14uint ui;
15uint2 ui2;
16uint3 ui3;
17uint4 ui4;
18
19char c;
20char2 c2;
21char3 c3;
22char4 c4;
23
24short s;
25short2 s2;
26short3 s3;
27short4 s4;
28
29int i;
30int2 i2;
31int3 i3;
32int4 i4;
33
34float f;
35float2 f2;
36float3 f3;
37float4 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 Hines5baf6322011-04-25 17:21:15 -070079void compile_all_math_int_ops() {
Stephen Hinesd015ef32011-01-14 19:08:19 -080080 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 Hines5baf6322011-04-25 17:21:15 -070087 return;
Stephen Hinesd015ef32011-01-14 19:08:19 -080088}
89