[PR81647][AARCH64] Fix handling of Unordered Comparisons in aarch64-simd.md
[official-gcc.git] / gcc / testsuite / gcc.target / aarch64 / vmlsq_laneq.c
blobdd3fb81198545826f98cdce51ef2124cd24a958c
2 /* { dg-do run } */
3 /* { dg-options "-O3" } */
5 #include "arm_neon.h"
7 extern void abort (void);
9 void
10 test1 ()
12 int16x8_t val1, val2, val3;
13 int16x8_t result;
14 uint64_t act, exp;
16 val1 = vcombine_s16 (vcreate_s16 (UINT64_C (0xffff9ab680000000)),
17 vcreate_s16 (UINT64_C (0x00000000ffff0000)));
18 val2 = vcombine_s16 (vcreate_s16 (UINT64_C (0x32b77fffffff7fff)),
19 vcreate_s16 (UINT64_C (0x0000ffff00007fff)));
20 val3 = vcombine_s16 (vcreate_s16 (UINT64_C (0x7fff00007fff0000)),
21 vcreate_s16 (UINT64_C (0x80007fff00000000)));
22 result = vmlsq_laneq_s16 (val1, val2, val3, 6);
24 act = vgetq_lane_u64 (vreinterpretq_u64_s16 (result), 0);
25 exp = UINT64_C (0xb2b69ab5ffffffff);
26 if (act != exp)
27 abort ();
29 act = vgetq_lane_u64 (vreinterpretq_u64_s16 (result), 1);
30 exp = UINT64_C (0x00007fffffffffff);
31 if (act != exp)
32 abort ();
35 void
36 test2 ()
38 int32x4_t val1, val2, val3;
39 int32x4_t result;
40 uint64_t exp, act;
42 val1 = vcombine_s32 (vcreate_s32 (UINT64_C (0x00008000f46f7fff)),
43 vcreate_s32 (UINT64_C (0x7fffffffffff8000)));
44 val2 = vcombine_s32 (vcreate_s32 (UINT64_C (0x7fff7fff0e700000)),
45 vcreate_s32 (UINT64_C (0xffff000080000000)));
46 val3 = vcombine_s32 (vcreate_s32 (UINT64_C (0x00000000ffff0000)),
47 vcreate_s32 (UINT64_C (0xd9edea1a8000fb28)));
48 result = vmlsq_laneq_s32 (val1, val2, val3, 3);
50 act = vgetq_lane_u64 (vreinterpretq_u64_s32 (result), 0);
51 exp = UINT64_C (0xcefb6a1a1d0f7fff);
52 if (act != exp)
53 abort ();
55 act = vgetq_lane_u64 (vreinterpretq_u64_s32 (result), 1);
56 exp = UINT64_C (0x6a19ffffffff8000);
57 if (act != exp)
58 abort ();
61 void
62 test3 ()
64 uint16x8_t val1, val2, val3;
65 uint16x8_t result;
66 uint64_t act, exp;
68 val1 = vcombine_u16 (vcreate_u16 (UINT64_C (0x000080008000802a)),
69 vcreate_u16 (UINT64_C (0x7fffffff00007fff)));
70 val2 = vcombine_u16 (vcreate_u16 (UINT64_C (0x7fffcdf1ffff0000)),
71 vcreate_u16 (UINT64_C (0xe2550000ffffffff)));
72 val3 = vcombine_u16 (vcreate_u16 (UINT64_C (0x80007fff80000000)),
73 vcreate_u16 (UINT64_C (0xbe2100007fffffff)));
75 result = vmlsq_laneq_u16 (val1, val2, val3, 7);
77 act = vgetq_lane_u64 (vreinterpretq_u64_u16 (result), 0);
78 exp = UINT64_C (0x3e2115ef3e21802a);
79 if (act != exp)
80 abort ();
82 act = vgetq_lane_u64 (vreinterpretq_u64_u16 (result), 1);
83 exp = UINT64_C (0x3d0affffbe213e20);
84 if (act != exp)
85 abort ();
88 void
89 test4 ()
91 uint32x4_t val1, val2, val3;
92 uint32x4_t result;
93 uint64_t act, exp;
95 val1 = vcombine_u32 (vcreate_u32 (UINT64_C (0x3295fe3d7fff7fff)),
96 vcreate_u32 (UINT64_C (0x7fff00007fff7fff)));
97 val2 = vcombine_u32 (vcreate_u32 (UINT64_C (0xffff7fff7fff8000)),
98 vcreate_u32 (UINT64_C (0x7fff80008000ffff)));
99 val3 = vcombine_u32 (vcreate_u32 (UINT64_C (0x7fff7fff80008000)),
100 vcreate_u32 (UINT64_C (0x0000800053ab7fff)));
102 result = vmlsq_laneq_u32 (val1, val2, val3, 2);
104 act = vgetq_lane_u64 (vreinterpretq_u64_u32 (result), 0);
105 exp = UINT64_C (0x4640fe3cbffeffff);
106 if (act != exp)
107 abort ();
109 act = vgetq_lane_u64 (vreinterpretq_u64_u32 (result), 1);
110 exp = UINT64_C (0xbffe8000d3abfffe);
111 if (act != exp)
112 abort ();
115 void
116 test5 ()
118 float32x4_t val1, val2, val3;
119 float32x4_t result;
120 float32_t act;
122 val1 = vcombine_f32 (vcreate_f32 (UINT64_C (0x3f49daf03ef3dc73)),
123 vcreate_f32 (UINT64_C (0x3f5d467a3ef3dc73)));
124 val2 = vcombine_f32 (vcreate_f32 (UINT64_C (0x3d2064c83d10cd28)),
125 vcreate_f32 (UINT64_C (0x3ea7d1a23d10cd28)));
126 val3 = vcombine_f32 (vcreate_f32 (UINT64_C (0x3f6131993edb1e04)),
127 vcreate_f32 (UINT64_C (0x3f37f4bf3edb1e04)));
129 result = vmlsq_laneq_f32 (val1, val2, val3, 0);
131 act = vgetq_lane_f32 (result, 0);
132 if (act != 0.46116194128990173f)
133 abort ();
135 act = vgetq_lane_f32 (result, 1);
136 if (act != 0.7717385292053223f)
137 abort ();
139 act = vgetq_lane_f32 (result, 2);
140 if (act != 0.46116194128990173f)
141 abort ();
143 act = vgetq_lane_f32 (result, 3);
144 if (act != 0.7240825295448303f)
145 abort ();
149 main (void)
151 test1 ();
152 test2 ();
153 test3 ();
154 test4 ();
155 test5 ();
157 return 0;