[ARM] Fix test armv8_2-fp16-move-1.c
[official-gcc.git] / gcc / testsuite / gcc.target / arm / armv8_2-fp16-move-1.c
blob8c0a53cfa51e349ecf0d095577170b0a0bba5bd7
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 } */
6 __fp16
7 test_load_1 (__fp16* a)
9 return *a;
12 __fp16
13 test_load_2 (__fp16* a, int i)
15 return a[i];
18 /* { dg-final { scan-assembler-times {vld1\.16\t\{d[0-9]+\[[0-9]+\]\}, \[r[0-9]+\]} 2 } } */
20 void
21 test_store_1 (__fp16* a, __fp16 b)
23 *a = b;
26 void
27 test_store_2 (__fp16* a, int i, __fp16 b)
29 a[i] = b;
32 /* { dg-final { scan-assembler-times {vst1\.16\t\{d[0-9]+\[[0-9]+\]\}, \[r[0-9]+\]} 2 } } */
34 __fp16
35 test_load_store_1 (__fp16* a, int i, __fp16* b)
37 a[i] = b[i];
40 __fp16
41 test_load_store_2 (__fp16* a, int i, __fp16* b)
43 a[i] = b[i + 2];
44 return a[i];
46 /* { dg-final { scan-assembler-times {ldrh\tr[0-9]+} 2 } } */
47 /* { dg-final { scan-assembler-times {strh\tr[0-9]+} 2 } } */
49 __fp16
50 test_select_1 (int sel, __fp16 a, __fp16 b)
52 if (sel)
53 return a;
54 else
55 return b;
58 __fp16
59 test_select_2 (int sel, __fp16 a, __fp16 b)
61 return sel ? a : b;
64 __fp16
65 test_select_3 (__fp16 a, __fp16 b, __fp16 c)
67 return (a == b) ? b : c;
70 __fp16
71 test_select_4 (__fp16 a, __fp16 b, __fp16 c)
73 return (a != b) ? b : c;
76 __fp16
77 test_select_5 (__fp16 a, __fp16 b, __fp16 c)
79 return (a < b) ? b : c;
82 __fp16
83 test_select_6 (__fp16 a, __fp16 b, __fp16 c)
85 return (a <= b) ? b : c;
88 __fp16
89 test_select_7 (__fp16 a, __fp16 b, __fp16 c)
91 return (a > b) ? b : c;
94 __fp16
95 test_select_8 (__fp16 a, __fp16 b, __fp16 c)
97 return (a >= b) ? b : c;
100 /* { dg-final { scan-assembler-times {vseleq\.f16\ts[0-9]+, s[0-9]+, s[0-9]+} 4 } } */
101 /* { dg-final { scan-assembler-times {vselgt\.f16\ts[0-9]+, s[0-9]+, s[0-9]+} 1 } } */
102 /* { dg-final { scan-assembler-times {vselge\.f16\ts[0-9]+, s[0-9]+, s[0-9]+} 1 } } */
104 /* { dg-final { scan-assembler-times {vmov\.f16\ts[0-9]+, r[0-9]+} 2 } } */
107 test_compare_1 (__fp16 a, __fp16 b)
109 if (a == b)
110 return -1;
111 else
112 return 0;
116 test_compare_ (__fp16 a, __fp16 b)
118 if (a != b)
119 return -1;
120 else
121 return 0;
125 test_compare_2 (__fp16 a, __fp16 b)
127 if (a > b)
128 return -1;
129 else
130 return 0;
134 test_compare_3 (__fp16 a, __fp16 b)
136 if (a >= b)
137 return -1;
138 else
139 return 0;
143 test_compare_4 (__fp16 a, __fp16 b)
145 if (a < b)
146 return -1;
147 else
148 return 0;
152 test_compare_5 (__fp16 a, __fp16 b)
154 if (a <= b)
155 return -1;
156 else
157 return 0;
160 /* { dg-final { scan-assembler-not {vcmp\.f16} } } */
161 /* { dg-final { scan-assembler-not {vcmpe\.f16} } } */
163 /* { dg-final { scan-assembler-times {vcmp\.f32} 4 } } */
164 /* { dg-final { scan-assembler-times {vcmpe\.f32} 8 } } */