From 62b6628e04a1e20e25bb12e381e470864056d52b Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Tue, 20 Aug 2024 11:11:33 +0100 Subject: [PATCH] [X86] Add clang codegen test coverage for #104848 --- clang/test/CodeGen/X86/strictfp_patterns.c | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 clang/test/CodeGen/X86/strictfp_patterns.c diff --git a/clang/test/CodeGen/X86/strictfp_patterns.c b/clang/test/CodeGen/X86/strictfp_patterns.c new file mode 100644 index 000000000000000..fd1ecdb262d812b --- /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 + +// 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); +}