1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
2 // RUN: %clang_cc1 -triple thumbv8.1m.main-none-none-eabi -target-feature +mve.fp -mfloat-abi hard -fallow-half-arguments-and-returns -O0 -disable-O0-optnone -S -emit-llvm -o - %s | opt -S -mem2reg | FileCheck %s
3 // RUN: %clang_cc1 -triple thumbv8.1m.main-none-none-eabi -target-feature +mve.fp -mfloat-abi hard -fallow-half-arguments-and-returns -O0 -disable-O0-optnone -DPOLYMORPHIC -S -emit-llvm -o - %s | opt -S -mem2reg | FileCheck %s
4 
5 #include <arm_mve.h>
6 
7 // CHECK-LABEL: @test_vornq_u8(
8 // CHECK-NEXT:  entry:
9 // CHECK-NEXT:    [[TMP0:%.*]] = xor <16 x i8> [[B:%.*]], <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1>
10 // CHECK-NEXT:    [[TMP1:%.*]] = or <16 x i8> [[A:%.*]], [[TMP0]]
11 // CHECK-NEXT:    ret <16 x i8> [[TMP1]]
12 //
test_vornq_u8(uint8x16_t a,uint8x16_t b)13 uint8x16_t test_vornq_u8(uint8x16_t a, uint8x16_t b)
14 {
15 #ifdef POLYMORPHIC
16     return vornq(a, b);
17 #else /* POLYMORPHIC */
18     return vornq_u8(a, b);
19 #endif /* POLYMORPHIC */
20 }
21 
22 // CHECK-LABEL: @test_vornq_s16(
23 // CHECK-NEXT:  entry:
24 // CHECK-NEXT:    [[TMP0:%.*]] = xor <8 x i16> [[B:%.*]], <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1>
25 // CHECK-NEXT:    [[TMP1:%.*]] = or <8 x i16> [[A:%.*]], [[TMP0]]
26 // CHECK-NEXT:    ret <8 x i16> [[TMP1]]
27 //
test_vornq_s16(int16x8_t a,int16x8_t b)28 int16x8_t test_vornq_s16(int16x8_t a, int16x8_t b)
29 {
30 #ifdef POLYMORPHIC
31     return vornq(a, b);
32 #else /* POLYMORPHIC */
33     return vornq_s16(a, b);
34 #endif /* POLYMORPHIC */
35 }
36 
37 // CHECK-LABEL: @test_vornq_u32(
38 // CHECK-NEXT:  entry:
39 // CHECK-NEXT:    [[TMP0:%.*]] = xor <4 x i32> [[B:%.*]], <i32 -1, i32 -1, i32 -1, i32 -1>
40 // CHECK-NEXT:    [[TMP1:%.*]] = or <4 x i32> [[A:%.*]], [[TMP0]]
41 // CHECK-NEXT:    ret <4 x i32> [[TMP1]]
42 //
test_vornq_u32(uint32x4_t a,uint32x4_t b)43 uint32x4_t test_vornq_u32(uint32x4_t a, uint32x4_t b)
44 {
45 #ifdef POLYMORPHIC
46     return vornq(a, b);
47 #else /* POLYMORPHIC */
48     return vornq_u32(a, b);
49 #endif /* POLYMORPHIC */
50 }
51 
52 // CHECK-LABEL: @test_vornq_f32(
53 // CHECK-NEXT:  entry:
54 // CHECK-NEXT:    [[TMP0:%.*]] = bitcast <4 x float> [[A:%.*]] to <4 x i32>
55 // CHECK-NEXT:    [[TMP1:%.*]] = bitcast <4 x float> [[B:%.*]] to <4 x i32>
56 // CHECK-NEXT:    [[TMP2:%.*]] = xor <4 x i32> [[TMP1]], <i32 -1, i32 -1, i32 -1, i32 -1>
57 // CHECK-NEXT:    [[TMP3:%.*]] = or <4 x i32> [[TMP0]], [[TMP2]]
58 // CHECK-NEXT:    [[TMP4:%.*]] = bitcast <4 x i32> [[TMP3]] to <4 x float>
59 // CHECK-NEXT:    ret <4 x float> [[TMP4]]
60 //
test_vornq_f32(float32x4_t a,float32x4_t b)61 float32x4_t test_vornq_f32(float32x4_t a, float32x4_t b)
62 {
63 #ifdef POLYMORPHIC
64     return vornq(a, b);
65 #else /* POLYMORPHIC */
66     return vornq_f32(a, b);
67 #endif /* POLYMORPHIC */
68 }
69 
70 // CHECK-LABEL: @test_vornq_m_s8(
71 // CHECK-NEXT:  entry:
72 // CHECK-NEXT:    [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32
73 // CHECK-NEXT:    [[TMP1:%.*]] = call <16 x i1> @llvm.arm.mve.pred.i2v.v16i1(i32 [[TMP0]])
74 // CHECK-NEXT:    [[TMP2:%.*]] = call <16 x i8> @llvm.arm.mve.orn.predicated.v16i8.v16i1(<16 x i8> [[A:%.*]], <16 x i8> [[B:%.*]], <16 x i1> [[TMP1]], <16 x i8> [[INACTIVE:%.*]])
75 // CHECK-NEXT:    ret <16 x i8> [[TMP2]]
76 //
test_vornq_m_s8(int8x16_t inactive,int8x16_t a,int8x16_t b,mve_pred16_t p)77 int8x16_t test_vornq_m_s8(int8x16_t inactive, int8x16_t a, int8x16_t b, mve_pred16_t p)
78 {
79 #ifdef POLYMORPHIC
80     return vornq_m(inactive, a, b, p);
81 #else /* POLYMORPHIC */
82     return vornq_m_s8(inactive, a, b, p);
83 #endif /* POLYMORPHIC */
84 }
85 
86 // CHECK-LABEL: @test_vornq_m_u16(
87 // CHECK-NEXT:  entry:
88 // CHECK-NEXT:    [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32
89 // CHECK-NEXT:    [[TMP1:%.*]] = call <8 x i1> @llvm.arm.mve.pred.i2v.v8i1(i32 [[TMP0]])
90 // CHECK-NEXT:    [[TMP2:%.*]] = call <8 x i16> @llvm.arm.mve.orn.predicated.v8i16.v8i1(<8 x i16> [[A:%.*]], <8 x i16> [[B:%.*]], <8 x i1> [[TMP1]], <8 x i16> [[INACTIVE:%.*]])
91 // CHECK-NEXT:    ret <8 x i16> [[TMP2]]
92 //
test_vornq_m_u16(uint16x8_t inactive,uint16x8_t a,uint16x8_t b,mve_pred16_t p)93 uint16x8_t test_vornq_m_u16(uint16x8_t inactive, uint16x8_t a, uint16x8_t b, mve_pred16_t p)
94 {
95 #ifdef POLYMORPHIC
96     return vornq_m(inactive, a, b, p);
97 #else /* POLYMORPHIC */
98     return vornq_m_u16(inactive, a, b, p);
99 #endif /* POLYMORPHIC */
100 }
101 
102 // CHECK-LABEL: @test_vornq_m_s32(
103 // CHECK-NEXT:  entry:
104 // CHECK-NEXT:    [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32
105 // CHECK-NEXT:    [[TMP1:%.*]] = call <4 x i1> @llvm.arm.mve.pred.i2v.v4i1(i32 [[TMP0]])
106 // CHECK-NEXT:    [[TMP2:%.*]] = call <4 x i32> @llvm.arm.mve.orn.predicated.v4i32.v4i1(<4 x i32> [[A:%.*]], <4 x i32> [[B:%.*]], <4 x i1> [[TMP1]], <4 x i32> [[INACTIVE:%.*]])
107 // CHECK-NEXT:    ret <4 x i32> [[TMP2]]
108 //
test_vornq_m_s32(int32x4_t inactive,int32x4_t a,int32x4_t b,mve_pred16_t p)109 int32x4_t test_vornq_m_s32(int32x4_t inactive, int32x4_t a, int32x4_t b, mve_pred16_t p)
110 {
111 #ifdef POLYMORPHIC
112     return vornq_m(inactive, a, b, p);
113 #else /* POLYMORPHIC */
114     return vornq_m_s32(inactive, a, b, p);
115 #endif /* POLYMORPHIC */
116 }
117 
118 // CHECK-LABEL: @test_vornq_m_f16(
119 // CHECK-NEXT:  entry:
120 // CHECK-NEXT:    [[TMP0:%.*]] = bitcast <8 x half> [[A:%.*]] to <8 x i16>
121 // CHECK-NEXT:    [[TMP1:%.*]] = bitcast <8 x half> [[B:%.*]] to <8 x i16>
122 // CHECK-NEXT:    [[TMP2:%.*]] = zext i16 [[P:%.*]] to i32
123 // CHECK-NEXT:    [[TMP3:%.*]] = call <8 x i1> @llvm.arm.mve.pred.i2v.v8i1(i32 [[TMP2]])
124 // CHECK-NEXT:    [[TMP4:%.*]] = bitcast <8 x half> [[INACTIVE:%.*]] to <8 x i16>
125 // CHECK-NEXT:    [[TMP5:%.*]] = call <8 x i16> @llvm.arm.mve.orn.predicated.v8i16.v8i1(<8 x i16> [[TMP0]], <8 x i16> [[TMP1]], <8 x i1> [[TMP3]], <8 x i16> [[TMP4]])
126 // CHECK-NEXT:    [[TMP6:%.*]] = bitcast <8 x i16> [[TMP5]] to <8 x half>
127 // CHECK-NEXT:    ret <8 x half> [[TMP6]]
128 //
test_vornq_m_f16(float16x8_t inactive,float16x8_t a,float16x8_t b,mve_pred16_t p)129 float16x8_t test_vornq_m_f16(float16x8_t inactive, float16x8_t a, float16x8_t b, mve_pred16_t p)
130 {
131 #ifdef POLYMORPHIC
132     return vornq_m(inactive, a, b, p);
133 #else /* POLYMORPHIC */
134     return vornq_m_f16(inactive, a, b, p);
135 #endif /* POLYMORPHIC */
136 }
137 
138 // CHECK-LABEL: @test_vornq_x_u8(
139 // CHECK-NEXT:  entry:
140 // CHECK-NEXT:    [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32
141 // CHECK-NEXT:    [[TMP1:%.*]] = call <16 x i1> @llvm.arm.mve.pred.i2v.v16i1(i32 [[TMP0]])
142 // CHECK-NEXT:    [[TMP2:%.*]] = call <16 x i8> @llvm.arm.mve.orn.predicated.v16i8.v16i1(<16 x i8> [[A:%.*]], <16 x i8> [[B:%.*]], <16 x i1> [[TMP1]], <16 x i8> undef)
143 // CHECK-NEXT:    ret <16 x i8> [[TMP2]]
144 //
test_vornq_x_u8(uint8x16_t a,uint8x16_t b,mve_pred16_t p)145 uint8x16_t test_vornq_x_u8(uint8x16_t a, uint8x16_t b, mve_pred16_t p)
146 {
147 #ifdef POLYMORPHIC
148     return vornq_x(a, b, p);
149 #else /* POLYMORPHIC */
150     return vornq_x_u8(a, b, p);
151 #endif /* POLYMORPHIC */
152 }
153 
154 // CHECK-LABEL: @test_vornq_x_s16(
155 // CHECK-NEXT:  entry:
156 // CHECK-NEXT:    [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32
157 // CHECK-NEXT:    [[TMP1:%.*]] = call <8 x i1> @llvm.arm.mve.pred.i2v.v8i1(i32 [[TMP0]])
158 // CHECK-NEXT:    [[TMP2:%.*]] = call <8 x i16> @llvm.arm.mve.orn.predicated.v8i16.v8i1(<8 x i16> [[A:%.*]], <8 x i16> [[B:%.*]], <8 x i1> [[TMP1]], <8 x i16> undef)
159 // CHECK-NEXT:    ret <8 x i16> [[TMP2]]
160 //
test_vornq_x_s16(int16x8_t a,int16x8_t b,mve_pred16_t p)161 int16x8_t test_vornq_x_s16(int16x8_t a, int16x8_t b, mve_pred16_t p)
162 {
163 #ifdef POLYMORPHIC
164     return vornq_x(a, b, p);
165 #else /* POLYMORPHIC */
166     return vornq_x_s16(a, b, p);
167 #endif /* POLYMORPHIC */
168 }
169 
170 // CHECK-LABEL: @test_vornq_x_u32(
171 // CHECK-NEXT:  entry:
172 // CHECK-NEXT:    [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32
173 // CHECK-NEXT:    [[TMP1:%.*]] = call <4 x i1> @llvm.arm.mve.pred.i2v.v4i1(i32 [[TMP0]])
174 // CHECK-NEXT:    [[TMP2:%.*]] = call <4 x i32> @llvm.arm.mve.orn.predicated.v4i32.v4i1(<4 x i32> [[A:%.*]], <4 x i32> [[B:%.*]], <4 x i1> [[TMP1]], <4 x i32> undef)
175 // CHECK-NEXT:    ret <4 x i32> [[TMP2]]
176 //
test_vornq_x_u32(uint32x4_t a,uint32x4_t b,mve_pred16_t p)177 uint32x4_t test_vornq_x_u32(uint32x4_t a, uint32x4_t b, mve_pred16_t p)
178 {
179 #ifdef POLYMORPHIC
180     return vornq_x(a, b, p);
181 #else /* POLYMORPHIC */
182     return vornq_x_u32(a, b, p);
183 #endif /* POLYMORPHIC */
184 }
185 
186 // CHECK-LABEL: @test_vornq_m_f32(
187 // CHECK-NEXT:  entry:
188 // CHECK-NEXT:    [[TMP0:%.*]] = bitcast <4 x float> [[A:%.*]] to <4 x i32>
189 // CHECK-NEXT:    [[TMP1:%.*]] = bitcast <4 x float> [[B:%.*]] to <4 x i32>
190 // CHECK-NEXT:    [[TMP2:%.*]] = zext i16 [[P:%.*]] to i32
191 // CHECK-NEXT:    [[TMP3:%.*]] = call <4 x i1> @llvm.arm.mve.pred.i2v.v4i1(i32 [[TMP2]])
192 // CHECK-NEXT:    [[TMP4:%.*]] = call <4 x i32> @llvm.arm.mve.orn.predicated.v4i32.v4i1(<4 x i32> [[TMP0]], <4 x i32> [[TMP1]], <4 x i1> [[TMP3]], <4 x i32> undef)
193 // CHECK-NEXT:    [[TMP5:%.*]] = bitcast <4 x i32> [[TMP4]] to <4 x float>
194 // CHECK-NEXT:    ret <4 x float> [[TMP5]]
195 //
test_vornq_m_f32(float32x4_t a,float32x4_t b,mve_pred16_t p)196 float32x4_t test_vornq_m_f32(float32x4_t a, float32x4_t b, mve_pred16_t p)
197 {
198 #ifdef POLYMORPHIC
199     return vornq_x(a, b, p);
200 #else /* POLYMORPHIC */
201     return vornq_x_f32(a, b, p);
202 #endif /* POLYMORPHIC */
203 }
204