diff options
author | Zahira Ammarguellat <zahira.ammarguellat@intel.com> | 2023-03-09 09:24:01 -0500 |
---|---|---|
committer | Tom Stellard <tstellar@redhat.com> | 2023-03-10 22:55:02 -0800 |
commit | fce3e75e01babe38576b1519dab5f752955525f9 (patch) | |
tree | ca0bc3c7480a707694919ec5d677aa0eda7d1bdb /clang/test/CodeGen/eval-method-fast-math.cpp | |
parent | a9e129ed8806cc313fcda5017f25206cf73c42ea (diff) | |
download | llvmorg-16.0.0-rc4.tar.gz |
Revert "Currently the control of the eval-method is mixed with fast-math."llvmorg-16.0.0-rc4
Setting __FLT_EVAL_METHOD__ to -1 with fast-math will set
__GLIBC_FLT_EVAL_METHOD to 2 and long double ends up being used for
float_t and double_t. This creates some ABI breakage with various C libraries.
See details here: https://github.com/llvm/llvm-project/issues/60781
This reverts commit bbf0d1932a3c1be970ed8a580e51edf571b80fd5.
(cherry picked from commit 2f1264260b37e9bd79737181e459ae20e10c5fea)
Diffstat (limited to 'clang/test/CodeGen/eval-method-fast-math.cpp')
-rw-r--r-- | clang/test/CodeGen/eval-method-fast-math.cpp | 117 |
1 files changed, 0 insertions, 117 deletions
diff --git a/clang/test/CodeGen/eval-method-fast-math.cpp b/clang/test/CodeGen/eval-method-fast-math.cpp deleted file mode 100644 index 0b5b3780efa3..000000000000 --- a/clang/test/CodeGen/eval-method-fast-math.cpp +++ /dev/null @@ -1,117 +0,0 @@ -// RUN: %clang_cc1 -fexperimental-strict-floating-point \ -// RUN: -triple x86_64-linux-gnu -emit-llvm -o - %s \ -// RUN: | FileCheck %s -check-prefixes=CHECK - -// RUN: %clang_cc1 -triple i386--linux -emit-llvm -o - %s \ -// RUN: | FileCheck %s -check-prefixes=CHECK-EXT - -// RUN: %clang_cc1 -fexperimental-strict-floating-point \ -// RUN: -mreassociate -freciprocal-math -ffp-contract=fast \ -// RUN: -ffast-math -triple x86_64-linux-gnu \ -// RUN: -emit-llvm -o - %s \ -// RUN: | FileCheck %s -check-prefixes=CHECK-FAST - -// RUN: %clang_cc1 -triple i386--linux -mreassociate -freciprocal-math \ -// RUN: -ffp-contract=fast -ffast-math -emit-llvm -o - %s \ -// RUN: | FileCheck %s -check-prefixes=CHECK-FAST - -float a = 1.0f, b = 2.0f, c = 3.0f; -#pragma float_control(precise, off) -float res2 = a + b + c; -int val3 = __FLT_EVAL_METHOD__; -#pragma float_control(precise, on) -float res3 = a + b + c; -int val4 = __FLT_EVAL_METHOD__; - -// CHECK: @val3 = global i32 -1 -// CHECK: @val4 = global i32 0 - -// CHECK-EXT: @val3 = global i32 -1 -// CHECK-EXT: @val4 = global i32 2 - -// CHECK-FAST: @val3 = global i32 -1 -// CHECK-FAST: @val4 = global i32 -1 - -float res; -int add(float a, float b, float c) { - // CHECK: fadd float - // CHECK: load float, ptr - // CHECK: fadd float - // CHECK: store float - // CHECK: ret i32 0 - res = a + b + c; - return __FLT_EVAL_METHOD__; -} - -int add_precise(float a, float b, float c) { -#pragma float_control(precise, on) - // CHECK: fadd float - // CHECK: load float, ptr - // CHECK: fadd float - // CHECK: store float - // CHECK: ret i32 0 - res = a + b + c; - return __FLT_EVAL_METHOD__; -} - -#pragma float_control(push) -#pragma float_control(precise, on) -int add_precise_1(float a, float b, float c) { - // CHECK: fadd float - // CHECK: load float, ptr - // CHECK: fadd float - // CHECK: store float - // CHECK: ret i32 0 - res = a + b + c; - return __FLT_EVAL_METHOD__; -} -#pragma float_control(pop) - -int add_not_precise(float a, float b, float c) { - // Fast-math is enabled with this pragma. -#pragma float_control(precise, off) - // CHECK: fadd fast float - // CHECK: load float, ptr - // CHECK: fadd fast float - // CHECK: float {{.*}}, ptr - // CHECK: ret i32 -1 - res = a + b + c; - return __FLT_EVAL_METHOD__; -} - -#pragma float_control(push) -// Fast-math is enabled with this pragma. -#pragma float_control(precise, off) -int add_not_precise_1(float a, float b, float c) { - // CHECK: fadd fast float - // CHECK: load float, ptr - // CHECK: fadd fast float - // CHECK: float {{.*}}, ptr - // CHECK: ret i32 -1 - res = a + b + c; - return __FLT_EVAL_METHOD__; -} -#pragma float_control(pop) - -int getFPEvalMethod() { - // CHECK: ret i32 0 - return __FLT_EVAL_METHOD__; -} - -float res1; -int whatever(float a, float b, float c) { -#pragma float_control(precise, off) - // CHECK: load float, ptr - // CHECK: fadd fast float - // CHECK: store float {{.*}}, ptr - // CHECK: store i32 -1 - // CHECK: store i32 0 - // CHECK: ret i32 -1 - res1 = a + b + c; - int val1 = __FLT_EVAL_METHOD__; - { -#pragma float_control(precise, on) - int val2 = __FLT_EVAL_METHOD__; - } - return __FLT_EVAL_METHOD__; -} |