Fix warning with -Wsign-compare -Wsystem-headers
[official-gcc.git] / gcc / testsuite / gcc.target / arm / armv8_2-fp16-move-1.c
blob56d87eb6f716718595dc6acdf0744b1d9ecf4a42
1 /* { dg-do compile } */
2 /* { dg-require-effective-target arm_v8_2a_fp16_scalar_ok } */
3 /* { dg-options "-O2" } */
4 /* { dg-add-options arm_v8_2a_fp16_scalar } */
5 /* { dg-additional-options "-mfloat-abi=hard" } */
7 __fp16
8 test_load_1 (__fp16* a)
10 return *a;
13 __fp16
14 test_load_2 (__fp16* a, int i)
16 return a[i];
19 /* { dg-final { scan-assembler-times {vld1\.16\t\{d[0-9]+\[[0-9]+\]\}, \[r[0-9]+\]} 2 } } */
21 void
22 test_store_1 (__fp16* a, __fp16 b)
24 *a = b;
27 void
28 test_store_2 (__fp16* a, int i, __fp16 b)
30 a[i] = b;
33 /* { dg-final { scan-assembler-times {vst1\.16\t\{d[0-9]+\[[0-9]+\]\}, \[r[0-9]+\]} 2 } } */
35 __fp16
36 test_load_store_1 (__fp16* a, int i, __fp16* b)
38 a[i] = b[i];
41 __fp16
42 test_load_store_2 (__fp16* a, int i, __fp16* b)
44 a[i] = b[i + 2];
45 return a[i];
47 /* { dg-final { scan-assembler-times {ldrh\tr[0-9]+} 2 } } */
48 /* { dg-final { scan-assembler-times {strh\tr[0-9]+} 2 } } */
50 __fp16
51 test_select_1 (int sel, __fp16 a, __fp16 b)
53 if (sel)
54 return a;
55 else
56 return b;
59 __fp16
60 test_select_2 (int sel, __fp16 a, __fp16 b)
62 return sel ? a : b;
65 __fp16
66 test_select_3 (__fp16 a, __fp16 b, __fp16 c)
68 return (a == b) ? b : c;
71 __fp16
72 test_select_4 (__fp16 a, __fp16 b, __fp16 c)
74 return (a != b) ? b : c;
77 __fp16
78 test_select_5 (__fp16 a, __fp16 b, __fp16 c)
80 return (a < b) ? b : c;
83 __fp16
84 test_select_6 (__fp16 a, __fp16 b, __fp16 c)
86 return (a <= b) ? b : c;
89 __fp16
90 test_select_7 (__fp16 a, __fp16 b, __fp16 c)
92 return (a > b) ? b : c;
95 __fp16
96 test_select_8 (__fp16 a, __fp16 b, __fp16 c)
98 return (a >= b) ? b : c;
101 /* { dg-final { scan-assembler-times {vseleq\.f16\ts[0-9]+, s[0-9]+, s[0-9]+} 4 } } */
102 /* { dg-final { scan-assembler-times {vselgt\.f16\ts[0-9]+, s[0-9]+, s[0-9]+} 1 } } */
103 /* { dg-final { scan-assembler-times {vselge\.f16\ts[0-9]+, s[0-9]+, s[0-9]+} 1 } } */
105 /* { dg-final { scan-assembler-times {vmov\.f16\ts[0-9]+, r[0-9]+} 2 } } */
108 test_compare_1 (__fp16 a, __fp16 b)
110 if (a == b)
111 return -1;
112 else
113 return 0;
117 test_compare_ (__fp16 a, __fp16 b)
119 if (a != b)
120 return -1;
121 else
122 return 0;
126 test_compare_2 (__fp16 a, __fp16 b)
128 if (a > b)
129 return -1;
130 else
131 return 0;
135 test_compare_3 (__fp16 a, __fp16 b)
137 if (a >= b)
138 return -1;
139 else
140 return 0;
144 test_compare_4 (__fp16 a, __fp16 b)
146 if (a < b)
147 return -1;
148 else
149 return 0;
153 test_compare_5 (__fp16 a, __fp16 b)
155 if (a <= b)
156 return -1;
157 else
158 return 0;
161 /* { dg-final { scan-assembler-not {vcmp\.f16} } } */
162 /* { dg-final { scan-assembler-not {vcmpe\.f16} } } */
164 /* { dg-final { scan-assembler-times {vcmp\.f32} 4 } } */
165 /* { dg-final { scan-assembler-times {vcmpe\.f32} 8 } } */