[clang] 3b49d27 - [X86] Add clang codegen test coverage for #104848

Simon Pilgrim via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 20 03:51:49 PDT 2024


Author: Simon Pilgrim
Date: 2024-08-20T11:51:28+01:00
New Revision: 3b49d274e6f16d1c8db5f4557eb7866a4bafffa5

URL: https://github.com/llvm/llvm-project/commit/3b49d274e6f16d1c8db5f4557eb7866a4bafffa5
DIFF: https://github.com/llvm/llvm-project/commit/3b49d274e6f16d1c8db5f4557eb7866a4bafffa5.diff

LOG: [X86] Add clang codegen test coverage for #104848

Added: 
    clang/test/CodeGen/X86/strictfp_patterns.c

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/clang/test/CodeGen/X86/strictfp_patterns.c b/clang/test/CodeGen/X86/strictfp_patterns.c
new file mode 100644
index 00000000000000..fd1ecdb262d812
--- /dev/null
+++ b/clang/test/CodeGen/X86/strictfp_patterns.c
@@ -0,0 +1,32 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
+// RUN: %clang_cc1 %s -O2 -emit-llvm -o - -triple x86_64-unknown-unknown -ffreestanding -ffp-exception-behavior=maytrap -Wall -Werror | FileCheck %s
+
+#include <immintrin.h>
+
+// TODO: PR104848 - ensure the _mm_set_ss/d headers don't implicity promote any integer/fp values.
+
+// CHECK-LABEL: @test_mm_set_ss(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:    [[VECINIT_I:%.*]] = insertelement <4 x float> poison, float [[NUM:%.*]], i64 0
+// CHECK-NEXT:    [[CONV_I:%.*]] = tail call float @llvm.experimental.constrained.sitofp.f32.i32(i32 0, metadata !"round.tonearest", metadata !"fpexcept.maytrap") #[[ATTR2:[0-9]+]]
+// CHECK-NEXT:    [[VECINIT1_I:%.*]] = insertelement <4 x float> [[VECINIT_I]], float [[CONV_I]], i64 1
+// CHECK-NEXT:    [[VECINIT3_I:%.*]] = insertelement <4 x float> [[VECINIT1_I]], float [[CONV_I]], i64 2
+// CHECK-NEXT:    [[VECINIT5_I:%.*]] = insertelement <4 x float> [[VECINIT3_I]], float [[CONV_I]], i64 3
+// CHECK-NEXT:    ret <4 x float> [[VECINIT5_I]]
+//
+__m128 test_mm_set_ss(float num)
+{
+    return _mm_set_ss(num);
+}
+
+// CHECK-LABEL: @test_mm_set_sd(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:    [[VECINIT_I:%.*]] = insertelement <2 x double> poison, double [[NUM:%.*]], i64 0
+// CHECK-NEXT:    [[CONV_I:%.*]] = tail call double @llvm.experimental.constrained.sitofp.f64.i32(i32 0, metadata !"round.tonearest", metadata !"fpexcept.maytrap") #[[ATTR2]]
+// CHECK-NEXT:    [[VECINIT1_I:%.*]] = insertelement <2 x double> [[VECINIT_I]], double [[CONV_I]], i64 1
+// CHECK-NEXT:    ret <2 x double> [[VECINIT1_I]]
+//
+__m128d test_mm_set_sd(double num)
+{
+    return _mm_set_sd(num);
+}


        


More information about the cfe-commits mailing list