[clang] [clang][x86] tbm-builtins.c - add i386 test coverage (PR #161169)

via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 29 03:51:52 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-x86

Author: Simon Pilgrim (RKSimon)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/161169.diff


1 Files Affected:

- (modified) clang/test/CodeGen/X86/tbm-builtins.c (+40-38) 


``````````diff
diff --git a/clang/test/CodeGen/X86/tbm-builtins.c b/clang/test/CodeGen/X86/tbm-builtins.c
index d916627a23f57..c52744128b4e3 100644
--- a/clang/test/CodeGen/X86/tbm-builtins.c
+++ b/clang/test/CodeGen/X86/tbm-builtins.c
@@ -1,5 +1,7 @@
-// RUN: %clang_cc1 -x c -ffreestanding %s -triple=x86_64-unknown-unknown -target-feature +tbm -emit-llvm -o - | FileCheck %s
-// RUN: %clang_cc1 -x c++ -std=c++11 -ffreestanding %s -triple=x86_64-unknown-unknown -target-feature +tbm -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -x c -ffreestanding %s -triple=x86_64-unknown-unknown -target-feature +tbm -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,X64
+// RUN: %clang_cc1 -x c -ffreestanding %s -triple=i386-unknown-unknown -target-feature +tbm -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK
+// RUN: %clang_cc1 -x c++ -ffreestanding %s -triple=x86_64-unknown-unknown -target-feature +tbm -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,X64
+// RUN: %clang_cc1 -x c++ -ffreestanding %s -triple=i386-unknown-unknown -target-feature +tbm -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK
 
 #include <x86intrin.h>
 
@@ -13,14 +15,14 @@ unsigned int test__bextri_u32(unsigned int a) {
 
 #ifdef __x86_64__
 unsigned long long test__bextri_u64(unsigned long long a) {
-  // CHECK-LABEL: test__bextri_u64
-  // CHECK: call i64 @llvm.x86.tbm.bextri.u64(i64 %{{.*}}, i64 2)
+  // X64-LABEL: test__bextri_u64
+  // X64: call i64 @llvm.x86.tbm.bextri.u64(i64 %{{.*}}, i64 2)
   return __bextri_u64(a, 2);
 }
 
 unsigned long long test__bextri_u64_bigint(unsigned long long a) {
-  // CHECK-LABEL: test__bextri_u64_bigint
-  // CHECK: call i64 @llvm.x86.tbm.bextri.u64(i64 %{{.*}}, i64 549755813887)
+  // X64-LABEL: test__bextri_u64_bigint
+  // X64: call i64 @llvm.x86.tbm.bextri.u64(i64 %{{.*}}, i64 549755813887)
   return __bextri_u64(a, 0x7fffffffffLL);
 }
 #endif
@@ -34,9 +36,9 @@ unsigned int test__blcfill_u32(unsigned int a) {
 
 #ifdef __x86_64__
 unsigned long long test__blcfill_u64(unsigned long long a) {
-  // CHECK-LABEL: test__blcfill_u64
-  // CHECK: [[TMP:%.*]] = add i64 %{{.*}}, 1
-  // CHECK: %{{.*}} = and i64 %{{.*}}, [[TMP]]
+  // X64-LABEL: test__blcfill_u64
+  // X64: [[TMP:%.*]] = add i64 %{{.*}}, 1
+  // X64: %{{.*}} = and i64 %{{.*}}, [[TMP]]
   return __blcfill_u64(a);
 }
 #endif
@@ -51,10 +53,10 @@ unsigned int test__blci_u32(unsigned int a) {
 
 #ifdef __x86_64__
 unsigned long long test__blci_u64(unsigned long long a) {
-  // CHECK-LABEL: test__blci_u64
-  // CHECK: [[TMP1:%.*]] = add i64 %{{.*}}, 1
-  // CHECK: [[TMP2:%.*]] = xor i64 [[TMP1]], -1
-  // CHECK: %{{.*}} = or i64 %{{.*}}, [[TMP2]]
+  // X64-LABEL: test__blci_u64
+  // X64: [[TMP1:%.*]] = add i64 %{{.*}}, 1
+  // X64: [[TMP2:%.*]] = xor i64 [[TMP1]], -1
+  // X64: %{{.*}} = or i64 %{{.*}}, [[TMP2]]
   return __blci_u64(a);
 }
 #endif
@@ -69,10 +71,10 @@ unsigned int test__blcic_u32(unsigned int a) {
 
 #ifdef __x86_64__
 unsigned long long test__blcic_u64(unsigned long long a) {
-  // CHECK-LABEL: test__blcic_u64
-  // CHECK: [[TMP1:%.*]] = xor i64 %{{.*}}, -1
-  // CHECK: [[TMP2:%.*]] = add i64 %{{.*}}, 1
-  // CHECK-NEXT: {{.*}} = and i64 [[TMP1]], [[TMP2]]
+  // X64-LABEL: test__blcic_u64
+  // X64: [[TMP1:%.*]] = xor i64 %{{.*}}, -1
+  // X64: [[TMP2:%.*]] = add i64 %{{.*}}, 1
+  // X64-NEXT: {{.*}} = and i64 [[TMP1]], [[TMP2]]
   return __blcic_u64(a);
 }
 #endif
@@ -86,9 +88,9 @@ unsigned int test__blcmsk_u32(unsigned int a) {
 
 #ifdef __x86_64__
 unsigned long long test__blcmsk_u64(unsigned long long a) {
-  // CHECK-LABEL: test__blcmsk_u64
-  // CHECK: [[TMP:%.*]] = add i64 %{{.*}}, 1
-  // CHECK-NEXT: {{.*}} = xor i64 %{{.*}}, [[TMP]]
+  // X64-LABEL: test__blcmsk_u64
+  // X64: [[TMP:%.*]] = add i64 %{{.*}}, 1
+  // X64-NEXT: {{.*}} = xor i64 %{{.*}}, [[TMP]]
   return __blcmsk_u64(a);
 }
 #endif
@@ -102,9 +104,9 @@ unsigned int test__blcs_u32(unsigned int a) {
 
 #ifdef __x86_64__
 unsigned long long test__blcs_u64(unsigned long long a) {
-  // CHECK-LABEL: test__blcs_u64
-  // CHECK: [[TMP:%.*]] = add i64 %{{.*}}, 1
-  // CHECK-NEXT: {{.*}} = or i64 %{{.*}}, [[TMP]]
+  // X64-LABEL: test__blcs_u64
+  // X64: [[TMP:%.*]] = add i64 %{{.*}}, 1
+  // X64-NEXT: {{.*}} = or i64 %{{.*}}, [[TMP]]
   return __blcs_u64(a);
 }
 #endif
@@ -118,9 +120,9 @@ unsigned int test__blsfill_u32(unsigned int a) {
 
 #ifdef __x86_64__
 unsigned long long test__blsfill_u64(unsigned long long a) {
-  // CHECK-LABEL: test__blsfill_u64
-  // CHECK: [[TMP:%.*]] = sub i64 %{{.*}}, 1
-  // CHECK-NEXT: {{.*}} = or i64 %{{.*}}, [[TMP]]
+  // X64-LABEL: test__blsfill_u64
+  // X64: [[TMP:%.*]] = sub i64 %{{.*}}, 1
+  // X64-NEXT: {{.*}} = or i64 %{{.*}}, [[TMP]]
   return __blsfill_u64(a);
 }
 #endif
@@ -135,10 +137,10 @@ unsigned int test__blsic_u32(unsigned int a) {
 
 #ifdef __x86_64__
 unsigned long long test__blsic_u64(unsigned long long a) {
-  // CHECK-LABEL: test__blsic_u64
-  // CHECK: [[TMP1:%.*]] = xor i64 %{{.*}}, -1
-  // CHECK: [[TMP2:%.*]] = sub i64 %{{.*}}, 1
-  // CHECK-NEXT: {{.*}} = or i64 [[TMP1]], [[TMP2]]
+  // X64-LABEL: test__blsic_u64
+  // X64: [[TMP1:%.*]] = xor i64 %{{.*}}, -1
+  // X64: [[TMP2:%.*]] = sub i64 %{{.*}}, 1
+  // X64-NEXT: {{.*}} = or i64 [[TMP1]], [[TMP2]]
   return __blsic_u64(a);
 }
 #endif
@@ -153,10 +155,10 @@ unsigned int test__t1mskc_u32(unsigned int a) {
 
 #ifdef __x86_64__
 unsigned long long test__t1mskc_u64(unsigned long long a) {
-  // CHECK-LABEL: test__t1mskc_u64
-  // CHECK: [[TMP1:%.*]] = xor i64 %{{.*}}, -1
-  // CHECK: [[TMP2:%.*]] = add i64 %{{.*}}, 1
-  // CHECK-NEXT: {{.*}} = or i64 [[TMP1]], [[TMP2]]
+  // X64-LABEL: test__t1mskc_u64
+  // X64: [[TMP1:%.*]] = xor i64 %{{.*}}, -1
+  // X64: [[TMP2:%.*]] = add i64 %{{.*}}, 1
+  // X64-NEXT: {{.*}} = or i64 [[TMP1]], [[TMP2]]
   return __t1mskc_u64(a);
 }
 #endif
@@ -171,10 +173,10 @@ unsigned int test__tzmsk_u32(unsigned int a) {
 
 #ifdef __x86_64__
 unsigned long long test__tzmsk_u64(unsigned long long a) {
-  // CHECK-LABEL: test__tzmsk_u64
-  // CHECK: [[TMP1:%.*]] = xor i64 %{{.*}}, -1
-  // CHECK: [[TMP2:%.*]] = sub i64 %{{.*}}, 1
-  // CHECK-NEXT: {{.*}} = and i64 [[TMP1]], [[TMP2]]
+  // X64-LABEL: test__tzmsk_u64
+  // X64: [[TMP1:%.*]] = xor i64 %{{.*}}, -1
+  // X64: [[TMP2:%.*]] = sub i64 %{{.*}}, 1
+  // X64-NEXT: {{.*}} = and i64 [[TMP1]], [[TMP2]]
   return __tzmsk_u64(a);
 }
 #endif

``````````

</details>


https://github.com/llvm/llvm-project/pull/161169


More information about the cfe-commits mailing list