[clang] [clang][X86] Fix round builtins tests (PR #226708)

Borys Perski via cfe-commits cfe-commits at lists.llvm.org
Sat Sep 26 08:30:14 PDT 2026


https://github.com/borysperski created https://github.com/llvm/llvm-project/pull/226708

Fixed minor issues in round builtins tests. Noticed them while working on #215787.

>From f235f2172f91336f275cfe0e7fbb8b5f1c2e2fb9 Mon Sep 17 00:00:00 2001
From: Borys Perski <borys.perski at intel.com>
Date: Sat, 26 Sep 2026 17:06:37 +0200
Subject: [PATCH] [clang][X86] Fix round builtins tests

1. Fix an invalid CHECK directive.
2. Replace hard-coded register values with wildcards.
3. Use captured variables instead of re-capturing them.
---
 .../CodeGen/X86/sse41-builtins-constrained.c   | 12 ++++++------
 clang/test/CodeGen/X86/sse41-builtins.c        | 18 +++++++++---------
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/clang/test/CodeGen/X86/sse41-builtins-constrained.c b/clang/test/CodeGen/X86/sse41-builtins-constrained.c
index 6b25bd27af7e0..2a0fcd052a7d4 100644
--- a/clang/test/CodeGen/X86/sse41-builtins-constrained.c
+++ b/clang/test/CodeGen/X86/sse41-builtins-constrained.c
@@ -58,8 +58,8 @@ __m128 test_mm_round_ps_fround_no_exc(__m128 x) {
 __m128d test_mm_round_sd_ceil(__m128d x, __m128d y) {
   // CHECK-LABEL: test_mm_round_sd_ceil
   // CHECK: %[[A:.*]] = extractelement <2 x double> %{{.*}}, i32 0
-  // CHECK: %[[B:.*]] = call double @llvm.experimental.constrained.ceil.f64(double %[[A:.*]], metadata !"fpexcept.ignore")
-  // CHECK: %{{.*}} = insertelement <2 x double> %0, double %[[B:.*]], i32 0
+  // CHECK: %[[B:.*]] = call double @llvm.experimental.constrained.ceil.f64(double %[[A]], metadata !"fpexcept.ignore")
+  // CHECK: %{{.*}} = insertelement <2 x double> %{{.*}}, double %[[B]], i32 0
   return _mm_round_sd(x, y, 0b1010);
 }
 
@@ -78,19 +78,19 @@ __m128d test_mm_round_sd_fround_no_exc(__m128d x, __m128d y) {
 __m128 test_mm_round_ss_trunc(__m128 x, __m128 y) {
   // CHECK-LABEL: test_mm_round_ss_trunc
   // CHECK: %[[A:.*]] = extractelement <4 x float> %{{.*}}, i32 0
-  // CHECK: %[[B:.*]] = call float @llvm.experimental.constrained.trunc.f32(float %[[A:.*]], metadata !"fpexcept.ignore") 
-  // CHECK: %{{.*}} = insertelement <4 x float> %0, float %[[B:.*]], i32 0
+  // CHECK: %[[B:.*]] = call float @llvm.experimental.constrained.trunc.f32(float %[[A]], metadata !"fpexcept.ignore")
+  // CHECK: %{{.*}} = insertelement <4 x float> %{{.*}}, float %[[B]], i32 0
   return _mm_round_ss(x, y, 0b1011);
 }
 
 __m128 test_mm_round_ss_mxcsr(__m128 x, __m128 y) {
   // CHECK-LABEL: test_mm_round_ss_mxcsr
-  // CHECK: %{{.*}} = call <4 x float> @llvm.x86.sse41.round.ss(<4 x float> %{{.*}}, <4 x float> %1, i32 12)
+  // CHECK: %{{.*}} = call <4 x float> @llvm.x86.sse41.round.ss(<4 x float> %{{.*}}, <4 x float> %{{.*}}, i32 12)
   return _mm_round_ss(x, y, 0b1100);
 }
 
 __m128 test_mm_round_ss_fround_no_exc(__m128 x, __m128 y) {
   // CHECK-LABEL: test_mm_round_ss_fround_no_exc
-  // CHECK: %{{.*}} = call <4 x float> @llvm.x86.sse41.round.ss(<4 x float> %{{.*}}, <4 x float> %1, i32 0)
+  // CHECK: %{{.*}} = call <4 x float> @llvm.x86.sse41.round.ss(<4 x float> %{{.*}}, <4 x float> %{{.*}}, i32 0)
   return _mm_round_ss(x, y, 0b0000);
 }
diff --git a/clang/test/CodeGen/X86/sse41-builtins.c b/clang/test/CodeGen/X86/sse41-builtins.c
index a12fc724f1398..ec743284afe43 100644
--- a/clang/test/CodeGen/X86/sse41-builtins.c
+++ b/clang/test/CodeGen/X86/sse41-builtins.c
@@ -75,7 +75,7 @@ TEST_CONSTEXPR(match_m128(_mm_blendv_ps((__m128)(__v4sf){0.0f, 1.0f, 2.0f, 3.0f}
 
 __m128d test_mm_ceil_pd(__m128d x) {
   // CHECK-LABEL: test_mm_ceil_pd
-  // CHECK  %{{.*}} = call <2 x double> @llvm.ceil.v2f64(<2 x double> %{{.*}})
+  // CHECK: %{{.*}} = call <2 x double> @llvm.x86.sse41.round.pd(<2 x double> %{{.*}}, i32 2)
   return _mm_ceil_pd(x);
 }
 
@@ -478,40 +478,40 @@ __m128 test_mm_round_ps_fround_no_exc(__m128 x) {
 __m128d test_mm_round_sd(__m128d x, __m128d y) {
   // CHECK-LABEL: test_mm_round_sd
   // CHECK: %[[A:.*]] = extractelement <2 x double> %{{.*}}, i32 0
-  // CHECK: %[[B:.*]] = call double @llvm.roundeven.f64(double %[[A:.*]])
-  // CHECK: %{{.*}} = insertelement <2 x double> %0, double %[[B:.*]], i32 0
+  // CHECK: %[[B:.*]] = call double @llvm.roundeven.f64(double %[[A]])
+  // CHECK: %{{.*}} = insertelement <2 x double> %{{.*}}, double %[[B]], i32 0
   return _mm_round_sd(x, y, 0b1000);
 }
 
 __m128d test_mm_round_sd_mxcsr(__m128d x, __m128d y) {
   // CHECK-LABEL: test_mm_round_sd_mxcsr
-  // CHECK: %{{.*}} = call <2 x double> @llvm.x86.sse41.round.sd(<2 x double> %0, <2 x double> %{{.*}}, i32 12)
+  // CHECK: %{{.*}} = call <2 x double> @llvm.x86.sse41.round.sd(<2 x double> %{{.*}}, <2 x double> %{{.*}}, i32 12)
   return _mm_round_sd(x, y, 0b1100);
 }
 
 __m128d test_mm_round_sd_fround_no_exc(__m128d x, __m128d y) {
   // CHECK-LABEL: test_mm_round_sd_fround_no_exc
-  // CHECK: %{{.*}} = call <2 x double> @llvm.x86.sse41.round.sd(<2 x double> %0, <2 x double> %{{.*}}, i32 0)
+  // CHECK: %{{.*}} = call <2 x double> @llvm.x86.sse41.round.sd(<2 x double> %{{.*}}, <2 x double> %{{.*}}, i32 0)
   return _mm_round_sd(x, y, 0b0000);
 }
 
 __m128 test_mm_round_ss(__m128 x, __m128 y) {
   // CHECK-LABEL: test_mm_round_ss
   // CHECK: %[[A:.*]] = extractelement <4 x float> %{{.*}}, i32 0
-  // CHECK: %[[B:.*]] = call float @llvm.trunc.f32(float %[[A:.*]]) 
-  // CHECK: %{{.*}} = insertelement <4 x float> %0, float %[[B:.*]], i32 0
+  // CHECK: %[[B:.*]] = call float @llvm.trunc.f32(float %[[A]])
+  // CHECK: %{{.*}} = insertelement <4 x float> %{{.*}}, float %[[B]], i32 0
   return _mm_round_ss(x, y, 0b1011);
 }
 
 __m128 test_mm_round_ss_mxcsr(__m128 x, __m128 y) {
   // CHECK-LABEL: test_mm_round_ss_mxcsr
-  // CHECK: %{{.*}} = call <4 x float> @llvm.x86.sse41.round.ss(<4 x float> %0, <4 x float> %{{.*}}, i32 12)
+  // CHECK: %{{.*}} = call <4 x float> @llvm.x86.sse41.round.ss(<4 x float> %{{.*}}, <4 x float> %{{.*}}, i32 12)
   return _mm_round_ss(x, y, 0b1100);
 }
 
 __m128 test_mm_round_ss_fround_no_exc(__m128 x, __m128 y) {
   // CHECK-LABEL: test_mm_round_ss_fround_no_exc
-  // CHECK: %{{.*}} = call <4 x float> @llvm.x86.sse41.round.ss(<4 x float> %0, <4 x float> %{{.*}}, i32 0)
+  // CHECK: %{{.*}} = call <4 x float> @llvm.x86.sse41.round.ss(<4 x float> %{{.*}}, <4 x float> %{{.*}}, i32 0)
   return _mm_round_ss(x, y, 0b0000);
 }
 



More information about the cfe-commits mailing list