Skip to content

Commit 8f20bef

Browse files
committed
[clang][x86] bmi-builtins.c - add i386 test coverage
1 parent f628a54 commit 8f20bef

File tree

1 file changed

+47
-45
lines changed

1 file changed

+47
-45
lines changed

clang/test/CodeGen/X86/bmi-builtins.c

Lines changed: 47 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
// RUN: %clang_cc1 -x c -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +bmi -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefixes=CHECK,TZCNT
2-
// RUN: %clang_cc1 -x c -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 -ffreestanding %s -triple=x86_64-windows-msvc -emit-llvm -o - -Wall -Werror -DTEST_TZCNT | FileCheck %s --check-prefix=TZCNT
3-
// RUN: %clang_cc1 -x c++ -std=c++11 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +bmi -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefixes=CHECK,TZCNT
4-
// RUN: %clang_cc1 -x c++ -std=c++11 -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 -ffreestanding %s -triple=x86_64-windows-msvc -emit-llvm -o - -Wall -Werror -DTEST_TZCNT | FileCheck %s --check-prefix=TZCNT
1+
// RUN: %clang_cc1 -x c -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +bmi -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefixes=CHECK,X64,TZCNT,TZCNT64
2+
// RUN: %clang_cc1 -x c -ffreestanding %s -triple=i386-apple-darwin -target-feature +bmi -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefixes=CHECK,TZCNT
3+
// RUN: %clang_cc1 -x c -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 -ffreestanding %s -triple=x86_64-windows-msvc -emit-llvm -o - -Wall -Werror -DTEST_TZCNT | FileCheck %s --check-prefixes=TZCNT,TZCNT64
4+
// RUN: %clang_cc1 -x c++ -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +bmi -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefixes=CHECK,X64,TZCNT,TZCNT64
5+
// RUN: %clang_cc1 -x c++ -ffreestanding %s -triple=i386-apple-darwin -target-feature +bmi -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefixes=CHECK,TZCNT
6+
// RUN: %clang_cc1 -x c++ -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 -ffreestanding %s -triple=x86_64-windows-msvc -emit-llvm -o - -Wall -Werror -DTEST_TZCNT | FileCheck %s --check-prefixes=TZCNT,TZCNT64
57

68

79
#include <immintrin.h>
@@ -48,20 +50,20 @@ unsigned int test_tzcnt_u32(unsigned int __X) {
4850

4951
#ifdef __x86_64__
5052
unsigned long long test__tzcnt_u64(unsigned long long __X) {
51-
// TZCNT-LABEL: test__tzcnt_u64
52-
// TZCNT: i64 @llvm.cttz.i64(i64 %{{.*}}, i1 false)
53+
// TZCNT64-LABEL: test__tzcnt_u64
54+
// TZCNT64: i64 @llvm.cttz.i64(i64 %{{.*}}, i1 false)
5355
return __tzcnt_u64(__X);
5456
}
5557

5658
long long test_mm_tzcnt_64(unsigned long long __X) {
57-
// TZCNT-LABEL: test_mm_tzcnt_64
58-
// TZCNT: i64 @llvm.cttz.i64(i64 %{{.*}}, i1 false)
59+
// TZCNT64-LABEL: test_mm_tzcnt_64
60+
// TZCNT64: i64 @llvm.cttz.i64(i64 %{{.*}}, i1 false)
5961
return _mm_tzcnt_64(__X);
6062
}
6163

6264
unsigned long long test_tzcnt_u64(unsigned long long __X) {
63-
// TZCNT-LABEL: test_tzcnt_u64
64-
// TZCNT: i64 @llvm.cttz.i64(i64 %{{.*}}, i1 false)
65+
// TZCNT64-LABEL: test_tzcnt_u64
66+
// TZCNT64: i64 @llvm.cttz.i64(i64 %{{.*}}, i1 false)
6567
return _tzcnt_u64(__X);
6668
}
6769
#endif
@@ -103,36 +105,36 @@ unsigned int test__blsr_u32(unsigned int __X) {
103105

104106
#ifdef __x86_64__
105107
unsigned long long test__andn_u64(unsigned long __X, unsigned long __Y) {
106-
// CHECK-LABEL: test__andn_u64
107-
// CHECK: xor i64 %{{.*}}, -1
108-
// CHECK: and i64 %{{.*}}, %{{.*}}
108+
// X64-LABEL: test__andn_u64
109+
// X64: xor i64 %{{.*}}, -1
110+
// X64: and i64 %{{.*}}, %{{.*}}
109111
return __andn_u64(__X, __Y);
110112
}
111113

112114
unsigned long long test__bextr_u64(unsigned long __X, unsigned long __Y) {
113-
// CHECK-LABEL: test__bextr_u64
114-
// CHECK: i64 @llvm.x86.bmi.bextr.64(i64 %{{.*}}, i64 %{{.*}})
115+
// X64-LABEL: test__bextr_u64
116+
// X64: i64 @llvm.x86.bmi.bextr.64(i64 %{{.*}}, i64 %{{.*}})
115117
return __bextr_u64(__X, __Y);
116118
}
117119

118120
unsigned long long test__blsi_u64(unsigned long long __X) {
119-
// CHECK-LABEL: test__blsi_u64
120-
// CHECK: sub i64 0, %{{.*}}
121-
// CHECK: and i64 %{{.*}}, %{{.*}}
121+
// X64-LABEL: test__blsi_u64
122+
// X64: sub i64 0, %{{.*}}
123+
// X64: and i64 %{{.*}}, %{{.*}}
122124
return __blsi_u64(__X);
123125
}
124126

125127
unsigned long long test__blsmsk_u64(unsigned long long __X) {
126-
// CHECK-LABEL: test__blsmsk_u64
127-
// CHECK: sub i64 %{{.*}}, 1
128-
// CHECK: xor i64 %{{.*}}, %{{.*}}
128+
// X64-LABEL: test__blsmsk_u64
129+
// X64: sub i64 %{{.*}}, 1
130+
// X64: xor i64 %{{.*}}, %{{.*}}
129131
return __blsmsk_u64(__X);
130132
}
131133

132134
unsigned long long test__blsr_u64(unsigned long long __X) {
133-
// CHECK-LABEL: test__blsr_u64
134-
// CHECK: sub i64 %{{.*}}, 1
135-
// CHECK: and i64 %{{.*}}, %{{.*}}
135+
// X64-LABEL: test__blsr_u64
136+
// X64: sub i64 %{{.*}}, 1
137+
// X64: and i64 %{{.*}}, %{{.*}}
136138
return __blsr_u64(__X);
137139
}
138140
#endif
@@ -186,49 +188,49 @@ unsigned int test_blsr_u32(unsigned int __X) {
186188

187189
#ifdef __x86_64__
188190
unsigned long long test_andn_u64(unsigned long __X, unsigned long __Y) {
189-
// CHECK-LABEL: test_andn_u64
190-
// CHECK: xor i64 %{{.*}}, -1
191-
// CHECK: and i64 %{{.*}}, %{{.*}}
191+
// X64-LABEL: test_andn_u64
192+
// X64: xor i64 %{{.*}}, -1
193+
// X64: and i64 %{{.*}}, %{{.*}}
192194
return _andn_u64(__X, __Y);
193195
}
194196

195197
unsigned long long test_bextr_u64(unsigned long __X, unsigned int __Y,
196198
unsigned int __Z) {
197-
// CHECK-LABEL: test_bextr_u64
198-
// CHECK: and i32 %{{.*}}, 255
199-
// CHECK: and i32 %{{.*}}, 255
200-
// CHECK: shl i32 %{{.*}}, 8
201-
// CHECK: or i32 %{{.*}}, %{{.*}}
202-
// CHECK: zext i32 %{{.*}} to i64
203-
// CHECK: i64 @llvm.x86.bmi.bextr.64(i64 %{{.*}}, i64 %{{.*}})
199+
// X64-LABEL: test_bextr_u64
200+
// X64: and i32 %{{.*}}, 255
201+
// X64: and i32 %{{.*}}, 255
202+
// X64: shl i32 %{{.*}}, 8
203+
// X64: or i32 %{{.*}}, %{{.*}}
204+
// X64: zext i32 %{{.*}} to i64
205+
// X64: i64 @llvm.x86.bmi.bextr.64(i64 %{{.*}}, i64 %{{.*}})
204206
return _bextr_u64(__X, __Y, __Z);
205207
}
206208

207209
unsigned long long test_bextr2_u64(unsigned long long __X,
208210
unsigned long long __Y) {
209-
// CHECK-LABEL: test_bextr2_u64
210-
// CHECK: i64 @llvm.x86.bmi.bextr.64(i64 %{{.*}}, i64 %{{.*}})
211+
// X64-LABEL: test_bextr2_u64
212+
// X64: i64 @llvm.x86.bmi.bextr.64(i64 %{{.*}}, i64 %{{.*}})
211213
return _bextr2_u64(__X, __Y);
212214
}
213215

214216
unsigned long long test_blsi_u64(unsigned long long __X) {
215-
// CHECK-LABEL: test_blsi_u64
216-
// CHECK: sub i64 0, %{{.*}}
217-
// CHECK: and i64 %{{.*}}, %{{.*}}
217+
// X64-LABEL: test_blsi_u64
218+
// X64: sub i64 0, %{{.*}}
219+
// X64: and i64 %{{.*}}, %{{.*}}
218220
return _blsi_u64(__X);
219221
}
220222

221223
unsigned long long test_blsmsk_u64(unsigned long long __X) {
222-
// CHECK-LABEL: test_blsmsk_u64
223-
// CHECK: sub i64 %{{.*}}, 1
224-
// CHECK: xor i64 %{{.*}}, %{{.*}}
224+
// X64-LABEL: test_blsmsk_u64
225+
// X64: sub i64 %{{.*}}, 1
226+
// X64: xor i64 %{{.*}}, %{{.*}}
225227
return _blsmsk_u64(__X);
226228
}
227229

228230
unsigned long long test_blsr_u64(unsigned long long __X) {
229-
// CHECK-LABEL: test_blsr_u64
230-
// CHECK: sub i64 %{{.*}}, 1
231-
// CHECK: and i64 %{{.*}}, %{{.*}}
231+
// X64-LABEL: test_blsr_u64
232+
// X64: sub i64 %{{.*}}, 1
233+
// X64: and i64 %{{.*}}, %{{.*}}
232234
return _blsr_u64(__X);
233235
}
234236
#endif

0 commit comments

Comments
 (0)