Skip to content

Commit

Permalink
[X86] Add clang codegen test coverage for llvm#104848
Browse files Browse the repository at this point in the history
  • Loading branch information
RKSimon authored and dmpolukhin committed Sep 2, 2024
1 parent 4f620a5 commit 62b6628
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions clang/test/CodeGen/X86/strictfp_patterns.c
Original file line number Diff line number Diff line change
@@ -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);
}

0 comments on commit 62b6628

Please sign in to comment.