Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release/19.x: [X86] Use correct fp immediate types in _mm_set_ss/sd #105638

Merged
merged 1 commit into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion clang/lib/Headers/emmintrin.h
Original file line number Diff line number Diff line change
Expand Up @@ -1771,7 +1771,7 @@ static __inline__ __m128d __DEFAULT_FN_ATTRS _mm_undefined_pd(void) {
/// lower 64 bits contain the value of the parameter. The upper 64 bits are
/// set to zero.
static __inline__ __m128d __DEFAULT_FN_ATTRS _mm_set_sd(double __w) {
return __extension__(__m128d){__w, 0};
return __extension__(__m128d){__w, 0.0};
}

/// Constructs a 128-bit floating-point vector of [2 x double], with each
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Headers/xmmintrin.h
Original file line number Diff line number Diff line change
Expand Up @@ -1910,7 +1910,7 @@ _mm_undefined_ps(void)
static __inline__ __m128 __DEFAULT_FN_ATTRS
_mm_set_ss(float __w)
{
return __extension__ (__m128){ __w, 0, 0, 0 };
return __extension__ (__m128){ __w, 0.0f, 0.0f, 0.0f };
}

/// Constructs a 128-bit floating-point vector of [4 x float], with each
Expand Down
26 changes: 26 additions & 0 deletions clang/test/CodeGen/X86/strictfp_patterns.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// 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>

// 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: [[VECINIT3_I:%.*]] = insertelement <4 x float> <float poison, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00>, float [[NUM:%.*]], i64 0
// CHECK-NEXT: ret <4 x float> [[VECINIT3_I]]
//
__m128 test_mm_set_ss(float num)
{
return _mm_set_ss(num);
}

// CHECK-LABEL: @test_mm_set_sd(
// CHECK-NEXT: entry:
// CHECK-NEXT: [[VECINIT1_I:%.*]] = insertelement <2 x double> <double poison, double 0.000000e+00>, double [[NUM:%.*]], i64 0
// CHECK-NEXT: ret <2 x double> [[VECINIT1_I]]
//
__m128d test_mm_set_sd(double num)
{
return _mm_set_sd(num);
}
Loading