Skip to content

Commit c20ef94

Browse files
authored
[clang][x86] tbm-builtins.c - add i386 test coverage (#161169)
1 parent 3c98be4 commit c20ef94

File tree

1 file changed

+40
-38
lines changed

1 file changed

+40
-38
lines changed

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

Lines changed: 40 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
// RUN: %clang_cc1 -x c -ffreestanding %s -triple=x86_64-unknown-unknown -target-feature +tbm -emit-llvm -o - | FileCheck %s
2-
// RUN: %clang_cc1 -x c++ -std=c++11 -ffreestanding %s -triple=x86_64-unknown-unknown -target-feature +tbm -emit-llvm -o - | FileCheck %s
1+
// RUN: %clang_cc1 -x c -ffreestanding %s -triple=x86_64-unknown-unknown -target-feature +tbm -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,X64
2+
// RUN: %clang_cc1 -x c -ffreestanding %s -triple=i386-unknown-unknown -target-feature +tbm -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK
3+
// RUN: %clang_cc1 -x c++ -ffreestanding %s -triple=x86_64-unknown-unknown -target-feature +tbm -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,X64
4+
// RUN: %clang_cc1 -x c++ -ffreestanding %s -triple=i386-unknown-unknown -target-feature +tbm -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK
35

46
#include <x86intrin.h>
57

@@ -13,14 +15,14 @@ unsigned int test__bextri_u32(unsigned int a) {
1315

1416
#ifdef __x86_64__
1517
unsigned long long test__bextri_u64(unsigned long long a) {
16-
// CHECK-LABEL: test__bextri_u64
17-
// CHECK: call i64 @llvm.x86.tbm.bextri.u64(i64 %{{.*}}, i64 2)
18+
// X64-LABEL: test__bextri_u64
19+
// X64: call i64 @llvm.x86.tbm.bextri.u64(i64 %{{.*}}, i64 2)
1820
return __bextri_u64(a, 2);
1921
}
2022

2123
unsigned long long test__bextri_u64_bigint(unsigned long long a) {
22-
// CHECK-LABEL: test__bextri_u64_bigint
23-
// CHECK: call i64 @llvm.x86.tbm.bextri.u64(i64 %{{.*}}, i64 549755813887)
24+
// X64-LABEL: test__bextri_u64_bigint
25+
// X64: call i64 @llvm.x86.tbm.bextri.u64(i64 %{{.*}}, i64 549755813887)
2426
return __bextri_u64(a, 0x7fffffffffLL);
2527
}
2628
#endif
@@ -34,9 +36,9 @@ unsigned int test__blcfill_u32(unsigned int a) {
3436

3537
#ifdef __x86_64__
3638
unsigned long long test__blcfill_u64(unsigned long long a) {
37-
// CHECK-LABEL: test__blcfill_u64
38-
// CHECK: [[TMP:%.*]] = add i64 %{{.*}}, 1
39-
// CHECK: %{{.*}} = and i64 %{{.*}}, [[TMP]]
39+
// X64-LABEL: test__blcfill_u64
40+
// X64: [[TMP:%.*]] = add i64 %{{.*}}, 1
41+
// X64: %{{.*}} = and i64 %{{.*}}, [[TMP]]
4042
return __blcfill_u64(a);
4143
}
4244
#endif
@@ -51,10 +53,10 @@ unsigned int test__blci_u32(unsigned int a) {
5153

5254
#ifdef __x86_64__
5355
unsigned long long test__blci_u64(unsigned long long a) {
54-
// CHECK-LABEL: test__blci_u64
55-
// CHECK: [[TMP1:%.*]] = add i64 %{{.*}}, 1
56-
// CHECK: [[TMP2:%.*]] = xor i64 [[TMP1]], -1
57-
// CHECK: %{{.*}} = or i64 %{{.*}}, [[TMP2]]
56+
// X64-LABEL: test__blci_u64
57+
// X64: [[TMP1:%.*]] = add i64 %{{.*}}, 1
58+
// X64: [[TMP2:%.*]] = xor i64 [[TMP1]], -1
59+
// X64: %{{.*}} = or i64 %{{.*}}, [[TMP2]]
5860
return __blci_u64(a);
5961
}
6062
#endif
@@ -69,10 +71,10 @@ unsigned int test__blcic_u32(unsigned int a) {
6971

7072
#ifdef __x86_64__
7173
unsigned long long test__blcic_u64(unsigned long long a) {
72-
// CHECK-LABEL: test__blcic_u64
73-
// CHECK: [[TMP1:%.*]] = xor i64 %{{.*}}, -1
74-
// CHECK: [[TMP2:%.*]] = add i64 %{{.*}}, 1
75-
// CHECK-NEXT: {{.*}} = and i64 [[TMP1]], [[TMP2]]
74+
// X64-LABEL: test__blcic_u64
75+
// X64: [[TMP1:%.*]] = xor i64 %{{.*}}, -1
76+
// X64: [[TMP2:%.*]] = add i64 %{{.*}}, 1
77+
// X64-NEXT: {{.*}} = and i64 [[TMP1]], [[TMP2]]
7678
return __blcic_u64(a);
7779
}
7880
#endif
@@ -86,9 +88,9 @@ unsigned int test__blcmsk_u32(unsigned int a) {
8688

8789
#ifdef __x86_64__
8890
unsigned long long test__blcmsk_u64(unsigned long long a) {
89-
// CHECK-LABEL: test__blcmsk_u64
90-
// CHECK: [[TMP:%.*]] = add i64 %{{.*}}, 1
91-
// CHECK-NEXT: {{.*}} = xor i64 %{{.*}}, [[TMP]]
91+
// X64-LABEL: test__blcmsk_u64
92+
// X64: [[TMP:%.*]] = add i64 %{{.*}}, 1
93+
// X64-NEXT: {{.*}} = xor i64 %{{.*}}, [[TMP]]
9294
return __blcmsk_u64(a);
9395
}
9496
#endif
@@ -102,9 +104,9 @@ unsigned int test__blcs_u32(unsigned int a) {
102104

103105
#ifdef __x86_64__
104106
unsigned long long test__blcs_u64(unsigned long long a) {
105-
// CHECK-LABEL: test__blcs_u64
106-
// CHECK: [[TMP:%.*]] = add i64 %{{.*}}, 1
107-
// CHECK-NEXT: {{.*}} = or i64 %{{.*}}, [[TMP]]
107+
// X64-LABEL: test__blcs_u64
108+
// X64: [[TMP:%.*]] = add i64 %{{.*}}, 1
109+
// X64-NEXT: {{.*}} = or i64 %{{.*}}, [[TMP]]
108110
return __blcs_u64(a);
109111
}
110112
#endif
@@ -118,9 +120,9 @@ unsigned int test__blsfill_u32(unsigned int a) {
118120

119121
#ifdef __x86_64__
120122
unsigned long long test__blsfill_u64(unsigned long long a) {
121-
// CHECK-LABEL: test__blsfill_u64
122-
// CHECK: [[TMP:%.*]] = sub i64 %{{.*}}, 1
123-
// CHECK-NEXT: {{.*}} = or i64 %{{.*}}, [[TMP]]
123+
// X64-LABEL: test__blsfill_u64
124+
// X64: [[TMP:%.*]] = sub i64 %{{.*}}, 1
125+
// X64-NEXT: {{.*}} = or i64 %{{.*}}, [[TMP]]
124126
return __blsfill_u64(a);
125127
}
126128
#endif
@@ -135,10 +137,10 @@ unsigned int test__blsic_u32(unsigned int a) {
135137

136138
#ifdef __x86_64__
137139
unsigned long long test__blsic_u64(unsigned long long a) {
138-
// CHECK-LABEL: test__blsic_u64
139-
// CHECK: [[TMP1:%.*]] = xor i64 %{{.*}}, -1
140-
// CHECK: [[TMP2:%.*]] = sub i64 %{{.*}}, 1
141-
// CHECK-NEXT: {{.*}} = or i64 [[TMP1]], [[TMP2]]
140+
// X64-LABEL: test__blsic_u64
141+
// X64: [[TMP1:%.*]] = xor i64 %{{.*}}, -1
142+
// X64: [[TMP2:%.*]] = sub i64 %{{.*}}, 1
143+
// X64-NEXT: {{.*}} = or i64 [[TMP1]], [[TMP2]]
142144
return __blsic_u64(a);
143145
}
144146
#endif
@@ -153,10 +155,10 @@ unsigned int test__t1mskc_u32(unsigned int a) {
153155

154156
#ifdef __x86_64__
155157
unsigned long long test__t1mskc_u64(unsigned long long a) {
156-
// CHECK-LABEL: test__t1mskc_u64
157-
// CHECK: [[TMP1:%.*]] = xor i64 %{{.*}}, -1
158-
// CHECK: [[TMP2:%.*]] = add i64 %{{.*}}, 1
159-
// CHECK-NEXT: {{.*}} = or i64 [[TMP1]], [[TMP2]]
158+
// X64-LABEL: test__t1mskc_u64
159+
// X64: [[TMP1:%.*]] = xor i64 %{{.*}}, -1
160+
// X64: [[TMP2:%.*]] = add i64 %{{.*}}, 1
161+
// X64-NEXT: {{.*}} = or i64 [[TMP1]], [[TMP2]]
160162
return __t1mskc_u64(a);
161163
}
162164
#endif
@@ -171,10 +173,10 @@ unsigned int test__tzmsk_u32(unsigned int a) {
171173

172174
#ifdef __x86_64__
173175
unsigned long long test__tzmsk_u64(unsigned long long a) {
174-
// CHECK-LABEL: test__tzmsk_u64
175-
// CHECK: [[TMP1:%.*]] = xor i64 %{{.*}}, -1
176-
// CHECK: [[TMP2:%.*]] = sub i64 %{{.*}}, 1
177-
// CHECK-NEXT: {{.*}} = and i64 [[TMP1]], [[TMP2]]
176+
// X64-LABEL: test__tzmsk_u64
177+
// X64: [[TMP1:%.*]] = xor i64 %{{.*}}, -1
178+
// X64: [[TMP2:%.*]] = sub i64 %{{.*}}, 1
179+
// X64-NEXT: {{.*}} = and i64 [[TMP1]], [[TMP2]]
178180
return __tzmsk_u64(a);
179181
}
180182
#endif

0 commit comments

Comments
 (0)