[clang] [clang][CodeGen] Propagate pragma set fast-math flags to floating point builtins (PR #90377)

Zahira Ammarguellat via cfe-commits cfe-commits at lists.llvm.org
Fri May 3 06:07:55 PDT 2024


================
@@ -0,0 +1,55 @@
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -O3 -emit-llvm -disable-llvm-passes -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -O3 -fmath-errno -ffp-contract=on -fno-rounding-math -emit-llvm -disable-llvm-passes -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -ffast-math -ffp-contract=fast -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang -O3 -S -emit-llvm -Xclang -disable-llvm-passes %s -o - | FileCheck %s
+// RUN: %clang -O3 -ffp-model=fast -S -emit-llvm -Xclang -disable-llvm-passes %s -o - | FileCheck %s
+// RUN: %clang -O3 -ffp-model=precise -S -emit-llvm -Xclang -disable-llvm-passes %s -o - | FileCheck %s
+
+// Reproducer for issue #87758
+// The testcase below verifies that the "fast" flag are set on the calls.
+
----------------
zahiraam wrote:

How about using these run lines?
`// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -o - %s | FileCheck %s`

`// precise mode`
`// RUN: %clang_cc1 -triple x86_64-linux-gnu -fmath-errno -ffp-contract=on \`
`// RUN: -fno-rounding-math -emit-llvm  -o - %s | FileCheck %s`

`// fast mode`
`// RUN %clang_cc1 -triple x86_64-linux-gnu -ffast-math -ffp-contract=fast \`
`// RUN: -emit-llvm -o - %s | FileCheck %s`
You might need to use different prefixes. 

https://github.com/llvm/llvm-project/pull/90377


More information about the cfe-commits mailing list