xref: /llvm-project/clang/test/CodeGen/arm-mve-intrinsics/veorq.c (revision c5de4dd1eab00df76c1a68c5f397304ceacb71f2)
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 -O0 -disable-O0-optnone -emit-llvm -o - %s | opt -S -passes=mem2reg | FileCheck %s
3 // RUN: %clang_cc1 -triple thumbv8.1m.main-none-none-eabi -target-feature +mve.fp -mfloat-abi hard -O0 -disable-O0-optnone -DPOLYMORPHIC -emit-llvm -o - %s | opt -S -passes=mem2reg | FileCheck %s
4 
5 // REQUIRES: aarch64-registered-target || arm-registered-target
6 
7 #include <arm_mve.h>
8 
9 // CHECK-LABEL: @test_veorq_u8(
10 // CHECK-NEXT:  entry:
11 // CHECK-NEXT:    [[TMP0:%.*]] = xor <16 x i8> [[A:%.*]], [[B:%.*]]
12 // CHECK-NEXT:    ret <16 x i8> [[TMP0]]
13 //
test_veorq_u8(uint8x16_t a,uint8x16_t b)14 uint8x16_t test_veorq_u8(uint8x16_t a, uint8x16_t b)
15 {
16 #ifdef POLYMORPHIC
17     return veorq(a, b);
18 #else /* POLYMORPHIC */
19     return veorq_u8(a, b);
20 #endif /* POLYMORPHIC */
21 }
22 
23 // CHECK-LABEL: @test_veorq_s16(
24 // CHECK-NEXT:  entry:
25 // CHECK-NEXT:    [[TMP0:%.*]] = xor <8 x i16> [[A:%.*]], [[B:%.*]]
26 // CHECK-NEXT:    ret <8 x i16> [[TMP0]]
27 //
test_veorq_s16(int16x8_t a,int16x8_t b)28 int16x8_t test_veorq_s16(int16x8_t a, int16x8_t b)
29 {
30 #ifdef POLYMORPHIC
31     return veorq(a, b);
32 #else /* POLYMORPHIC */
33     return veorq_s16(a, b);
34 #endif /* POLYMORPHIC */
35 }
36 
37 // CHECK-LABEL: @test_veorq_u32(
38 // CHECK-NEXT:  entry:
39 // CHECK-NEXT:    [[TMP0:%.*]] = xor <4 x i32> [[A:%.*]], [[B:%.*]]
40 // CHECK-NEXT:    ret <4 x i32> [[TMP0]]
41 //
test_veorq_u32(uint32x4_t a,uint32x4_t b)42 uint32x4_t test_veorq_u32(uint32x4_t a, uint32x4_t b)
43 {
44 #ifdef POLYMORPHIC
45     return veorq(a, b);
46 #else /* POLYMORPHIC */
47     return veorq_u32(a, b);
48 #endif /* POLYMORPHIC */
49 }
50 
51 // CHECK-LABEL: @test_veorq_f32(
52 // CHECK-NEXT:  entry:
53 // CHECK-NEXT:    [[TMP0:%.*]] = bitcast <4 x float> [[A:%.*]] to <4 x i32>
54 // CHECK-NEXT:    [[TMP1:%.*]] = bitcast <4 x float> [[B:%.*]] to <4 x i32>
55 // CHECK-NEXT:    [[TMP2:%.*]] = xor <4 x i32> [[TMP0]], [[TMP1]]
56 // CHECK-NEXT:    [[TMP3:%.*]] = bitcast <4 x i32> [[TMP2]] to <4 x float>
57 // CHECK-NEXT:    ret <4 x float> [[TMP3]]
58 //
test_veorq_f32(float32x4_t a,float32x4_t b)59 float32x4_t test_veorq_f32(float32x4_t a, float32x4_t b)
60 {
61 #ifdef POLYMORPHIC
62     return veorq(a, b);
63 #else /* POLYMORPHIC */
64     return veorq_f32(a, b);
65 #endif /* POLYMORPHIC */
66 }
67 
68 // CHECK-LABEL: @test_veorq_m_s8(
69 // CHECK-NEXT:  entry:
70 // CHECK-NEXT:    [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32
71 // CHECK-NEXT:    [[TMP1:%.*]] = call <16 x i1> @llvm.arm.mve.pred.i2v.v16i1(i32 [[TMP0]])
72 // CHECK-NEXT:    [[TMP2:%.*]] = call <16 x i8> @llvm.arm.mve.eor.predicated.v16i8.v16i1(<16 x i8> [[A:%.*]], <16 x i8> [[B:%.*]], <16 x i1> [[TMP1]], <16 x i8> [[INACTIVE:%.*]])
73 // CHECK-NEXT:    ret <16 x i8> [[TMP2]]
74 //
test_veorq_m_s8(int8x16_t inactive,int8x16_t a,int8x16_t b,mve_pred16_t p)75 int8x16_t test_veorq_m_s8(int8x16_t inactive, int8x16_t a, int8x16_t b, mve_pred16_t p)
76 {
77 #ifdef POLYMORPHIC
78     return veorq_m(inactive, a, b, p);
79 #else /* POLYMORPHIC */
80     return veorq_m_s8(inactive, a, b, p);
81 #endif /* POLYMORPHIC */
82 }
83 
84 // CHECK-LABEL: @test_veorq_m_u16(
85 // CHECK-NEXT:  entry:
86 // CHECK-NEXT:    [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32
87 // CHECK-NEXT:    [[TMP1:%.*]] = call <8 x i1> @llvm.arm.mve.pred.i2v.v8i1(i32 [[TMP0]])
88 // CHECK-NEXT:    [[TMP2:%.*]] = call <8 x i16> @llvm.arm.mve.eor.predicated.v8i16.v8i1(<8 x i16> [[A:%.*]], <8 x i16> [[B:%.*]], <8 x i1> [[TMP1]], <8 x i16> [[INACTIVE:%.*]])
89 // CHECK-NEXT:    ret <8 x i16> [[TMP2]]
90 //
test_veorq_m_u16(uint16x8_t inactive,uint16x8_t a,uint16x8_t b,mve_pred16_t p)91 uint16x8_t test_veorq_m_u16(uint16x8_t inactive, uint16x8_t a, uint16x8_t b, mve_pred16_t p)
92 {
93 #ifdef POLYMORPHIC
94     return veorq_m(inactive, a, b, p);
95 #else /* POLYMORPHIC */
96     return veorq_m_u16(inactive, a, b, p);
97 #endif /* POLYMORPHIC */
98 }
99 
100 // CHECK-LABEL: @test_veorq_m_s32(
101 // CHECK-NEXT:  entry:
102 // CHECK-NEXT:    [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32
103 // CHECK-NEXT:    [[TMP1:%.*]] = call <4 x i1> @llvm.arm.mve.pred.i2v.v4i1(i32 [[TMP0]])
104 // CHECK-NEXT:    [[TMP2:%.*]] = call <4 x i32> @llvm.arm.mve.eor.predicated.v4i32.v4i1(<4 x i32> [[A:%.*]], <4 x i32> [[B:%.*]], <4 x i1> [[TMP1]], <4 x i32> [[INACTIVE:%.*]])
105 // CHECK-NEXT:    ret <4 x i32> [[TMP2]]
106 //
test_veorq_m_s32(int32x4_t inactive,int32x4_t a,int32x4_t b,mve_pred16_t p)107 int32x4_t test_veorq_m_s32(int32x4_t inactive, int32x4_t a, int32x4_t b, mve_pred16_t p)
108 {
109 #ifdef POLYMORPHIC
110     return veorq_m(inactive, a, b, p);
111 #else /* POLYMORPHIC */
112     return veorq_m_s32(inactive, a, b, p);
113 #endif /* POLYMORPHIC */
114 }
115 
116 // CHECK-LABEL: @test_veorq_m_f16(
117 // CHECK-NEXT:  entry:
118 // CHECK-NEXT:    [[TMP0:%.*]] = bitcast <8 x half> [[A:%.*]] to <8 x i16>
119 // CHECK-NEXT:    [[TMP1:%.*]] = bitcast <8 x half> [[B:%.*]] to <8 x i16>
120 // CHECK-NEXT:    [[TMP2:%.*]] = zext i16 [[P:%.*]] to i32
121 // CHECK-NEXT:    [[TMP3:%.*]] = call <8 x i1> @llvm.arm.mve.pred.i2v.v8i1(i32 [[TMP2]])
122 // CHECK-NEXT:    [[TMP4:%.*]] = bitcast <8 x half> [[INACTIVE:%.*]] to <8 x i16>
123 // CHECK-NEXT:    [[TMP5:%.*]] = call <8 x i16> @llvm.arm.mve.eor.predicated.v8i16.v8i1(<8 x i16> [[TMP0]], <8 x i16> [[TMP1]], <8 x i1> [[TMP3]], <8 x i16> [[TMP4]])
124 // CHECK-NEXT:    [[TMP6:%.*]] = bitcast <8 x i16> [[TMP5]] to <8 x half>
125 // CHECK-NEXT:    ret <8 x half> [[TMP6]]
126 //
test_veorq_m_f16(float16x8_t inactive,float16x8_t a,float16x8_t b,mve_pred16_t p)127 float16x8_t test_veorq_m_f16(float16x8_t inactive, float16x8_t a, float16x8_t b, mve_pred16_t p)
128 {
129 #ifdef POLYMORPHIC
130     return veorq_m(inactive, a, b, p);
131 #else /* POLYMORPHIC */
132     return veorq_m_f16(inactive, a, b, p);
133 #endif /* POLYMORPHIC */
134 }
135 
136 // CHECK-LABEL: @test_veorq_x_u8(
137 // CHECK-NEXT:  entry:
138 // CHECK-NEXT:    [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32
139 // CHECK-NEXT:    [[TMP1:%.*]] = call <16 x i1> @llvm.arm.mve.pred.i2v.v16i1(i32 [[TMP0]])
140 // CHECK-NEXT:    [[TMP2:%.*]] = call <16 x i8> @llvm.arm.mve.eor.predicated.v16i8.v16i1(<16 x i8> [[A:%.*]], <16 x i8> [[B:%.*]], <16 x i1> [[TMP1]], <16 x i8> undef)
141 // CHECK-NEXT:    ret <16 x i8> [[TMP2]]
142 //
test_veorq_x_u8(uint8x16_t a,uint8x16_t b,mve_pred16_t p)143 uint8x16_t test_veorq_x_u8(uint8x16_t a, uint8x16_t b, mve_pred16_t p)
144 {
145 #ifdef POLYMORPHIC
146     return veorq_x(a, b, p);
147 #else /* POLYMORPHIC */
148     return veorq_x_u8(a, b, p);
149 #endif /* POLYMORPHIC */
150 }
151 
152 // CHECK-LABEL: @test_veorq_x_s16(
153 // CHECK-NEXT:  entry:
154 // CHECK-NEXT:    [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32
155 // CHECK-NEXT:    [[TMP1:%.*]] = call <8 x i1> @llvm.arm.mve.pred.i2v.v8i1(i32 [[TMP0]])
156 // CHECK-NEXT:    [[TMP2:%.*]] = call <8 x i16> @llvm.arm.mve.eor.predicated.v8i16.v8i1(<8 x i16> [[A:%.*]], <8 x i16> [[B:%.*]], <8 x i1> [[TMP1]], <8 x i16> undef)
157 // CHECK-NEXT:    ret <8 x i16> [[TMP2]]
158 //
test_veorq_x_s16(int16x8_t a,int16x8_t b,mve_pred16_t p)159 int16x8_t test_veorq_x_s16(int16x8_t a, int16x8_t b, mve_pred16_t p)
160 {
161 #ifdef POLYMORPHIC
162     return veorq_x(a, b, p);
163 #else /* POLYMORPHIC */
164     return veorq_x_s16(a, b, p);
165 #endif /* POLYMORPHIC */
166 }
167 
168 // CHECK-LABEL: @test_veorq_x_u32(
169 // CHECK-NEXT:  entry:
170 // CHECK-NEXT:    [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32
171 // CHECK-NEXT:    [[TMP1:%.*]] = call <4 x i1> @llvm.arm.mve.pred.i2v.v4i1(i32 [[TMP0]])
172 // CHECK-NEXT:    [[TMP2:%.*]] = call <4 x i32> @llvm.arm.mve.eor.predicated.v4i32.v4i1(<4 x i32> [[A:%.*]], <4 x i32> [[B:%.*]], <4 x i1> [[TMP1]], <4 x i32> undef)
173 // CHECK-NEXT:    ret <4 x i32> [[TMP2]]
174 //
test_veorq_x_u32(uint32x4_t a,uint32x4_t b,mve_pred16_t p)175 uint32x4_t test_veorq_x_u32(uint32x4_t a, uint32x4_t b, mve_pred16_t p)
176 {
177 #ifdef POLYMORPHIC
178     return veorq_x(a, b, p);
179 #else /* POLYMORPHIC */
180     return veorq_x_u32(a, b, p);
181 #endif /* POLYMORPHIC */
182 }
183 
184 // CHECK-LABEL: @test_veorq_m_f32(
185 // CHECK-NEXT:  entry:
186 // CHECK-NEXT:    [[TMP0:%.*]] = bitcast <4 x float> [[A:%.*]] to <4 x i32>
187 // CHECK-NEXT:    [[TMP1:%.*]] = bitcast <4 x float> [[B:%.*]] to <4 x i32>
188 // CHECK-NEXT:    [[TMP2:%.*]] = zext i16 [[P:%.*]] to i32
189 // CHECK-NEXT:    [[TMP3:%.*]] = call <4 x i1> @llvm.arm.mve.pred.i2v.v4i1(i32 [[TMP2]])
190 // CHECK-NEXT:    [[TMP4:%.*]] = call <4 x i32> @llvm.arm.mve.eor.predicated.v4i32.v4i1(<4 x i32> [[TMP0]], <4 x i32> [[TMP1]], <4 x i1> [[TMP3]], <4 x i32> undef)
191 // CHECK-NEXT:    [[TMP5:%.*]] = bitcast <4 x i32> [[TMP4]] to <4 x float>
192 // CHECK-NEXT:    ret <4 x float> [[TMP5]]
193 //
test_veorq_m_f32(float32x4_t a,float32x4_t b,mve_pred16_t p)194 float32x4_t test_veorq_m_f32(float32x4_t a, float32x4_t b, mve_pred16_t p)
195 {
196 #ifdef POLYMORPHIC
197     return veorq_x(a, b, p);
198 #else /* POLYMORPHIC */
199     return veorq_x_f32(a, b, p);
200 #endif /* POLYMORPHIC */
201 }
202