Daily bump.
[official-gcc.git] / gcc / testsuite / gcc.target / arm / armv8_2-fp16-move-1.c
blob444c4a3353555f22828cbbeb6802a3f1a39c9df7
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" } */
6 /* { dg-final { check-function-bodies "**" "" } } */
8 /*
9 **test_load_1:
10 ** ...
11 ** vld1.16 {d[0-9]+\[[0-9]+\]}, \[r[0-9]+\]
12 ** ...
14 __fp16
15 test_load_1 (__fp16* a)
17 return *a;
21 **test_load_2:
22 ** ...
23 ** vld1.16 {d[0-9]+\[[0-9]+\]}, \[r[0-9]+\]
24 ** ...
26 __fp16
27 test_load_2 (__fp16* a, int i)
29 return a[i];
33 **test_store_1:
34 ** ...
35 ** vst1.16 {d[0-9]+\[[0-9]+\]}, \[r[0-9]+\]
36 ** ...
38 void
39 test_store_1 (__fp16* a, __fp16 b)
41 *a = b;
45 **test_store_2:
46 ** ...
47 ** vst1.16 {d[0-9]+\[[0-9]+\]}, \[r[0-9]+\]
48 ** ...
50 void
51 test_store_2 (__fp16* a, int i, __fp16 b)
53 a[i] = b;
57 **test_load_store_1:
58 ** ...
59 ** vld1.16 {d[0-9]+\[[0-9]+\]}, \[r[0-9]+\]
60 ** ...
61 ** vst1.16 {d[0-9]+\[[0-9]+\]}, \[r[0-9]+\]
62 ** ...
64 __fp16
65 test_load_store_1 (__fp16* a, int i, __fp16* b)
67 a[i] = b[i];
71 **test_load_store_2:
72 ** ...
73 ** vld1.16 {d[0-9]+\[[0-9]+\]}, \[r[0-9]+\]
74 ** ...
75 ** vst1.16 {d[0-9]+\[[0-9]+\]}, \[r[0-9]+\]
76 ** ...
78 __fp16
79 test_load_store_2 (__fp16* a, int i, __fp16* b)
81 a[i] = b[i + 2];
82 return a[i];
85 __fp16
86 test_select_1 (int sel, __fp16 a, __fp16 b)
88 if (sel)
89 return a;
90 else
91 return b;
94 __fp16
95 test_select_2 (int sel, __fp16 a, __fp16 b)
97 return sel ? a : b;
100 __fp16
101 test_select_3 (__fp16 a, __fp16 b, __fp16 c)
103 return (a == b) ? b : c;
106 __fp16
107 test_select_4 (__fp16 a, __fp16 b, __fp16 c)
109 return (a != b) ? b : c;
112 __fp16
113 test_select_5 (__fp16 a, __fp16 b, __fp16 c)
115 return (a < b) ? b : c;
118 __fp16
119 test_select_6 (__fp16 a, __fp16 b, __fp16 c)
121 return (a <= b) ? b : c;
124 __fp16
125 test_select_7 (__fp16 a, __fp16 b, __fp16 c)
127 return (a > b) ? b : c;
130 __fp16
131 test_select_8 (__fp16 a, __fp16 b, __fp16 c)
133 return (a >= b) ? b : c;
136 /* { dg-final { scan-assembler-times {vseleq\.f16\ts[0-9]+, s[0-9]+, s[0-9]+} 4 } } */
137 /* { dg-final { scan-assembler-times {vselgt\.f16\ts[0-9]+, s[0-9]+, s[0-9]+} 1 } } */
138 /* { dg-final { scan-assembler-times {vselge\.f16\ts[0-9]+, s[0-9]+, s[0-9]+} 1 } } */
140 /* { dg-final { scan-assembler-not {vmov\.f16} } } */
143 test_compare_1 (__fp16 a, __fp16 b)
145 if (a == b)
146 return -1;
147 else
148 return 0;
152 test_compare_ (__fp16 a, __fp16 b)
154 if (a != b)
155 return -1;
156 else
157 return 0;
161 test_compare_2 (__fp16 a, __fp16 b)
163 if (a > b)
164 return -1;
165 else
166 return 0;
170 test_compare_3 (__fp16 a, __fp16 b)
172 if (a >= b)
173 return -1;
174 else
175 return 0;
179 test_compare_4 (__fp16 a, __fp16 b)
181 if (a < b)
182 return -1;
183 else
184 return 0;
188 test_compare_5 (__fp16 a, __fp16 b)
190 if (a <= b)
191 return -1;
192 else
193 return 0;
196 /* { dg-final { scan-assembler-not {vcmp\.f16} } } */
197 /* { dg-final { scan-assembler-not {vcmpe\.f16} } } */
199 /* { dg-final { scan-assembler-times {vcmpe?\.f32} 12 } } */