[clang] [CIR] Only emit FP math intrinsics when precision/errno settings allow it (PR #169424)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 1 16:46:07 PST 2025


================
@@ -0,0 +1,75 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value -fclangir -emit-cir -fmath-errno %s -o %t.cir
+// RUN: FileCheck --input-file=%t.cir %s -check-prefix=CIR-ERRNO
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value -fclangir -emit-cir -ffast-math %s -o %t.cir
+// RUN: FileCheck --input-file=%t.cir %s -check-prefix=CIR-NO-ERRNO
+
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value -fclangir -emit-cir -fmath-errno -O1 %s -o %t.cir
+// RUN: FileCheck --input-file=%t.cir %s -check-prefix=CIR-ERRNO-O1
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value -fclangir -emit-cir -ffast-math -O1 %s -o %t.cir
+// RUN: FileCheck --input-file=%t.cir %s -check-prefix=CIR-NO-ERRNO-O1
+
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value -fclangir -emit-llvm -fmath-errno %s -o %t.cir
+// RUN: FileCheck --input-file=%t.cir %s -check-prefix=LLVM-ERRNO
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value -fclangir -emit-llvm -ffast-math %s -o %t.cir
+// RUN: FileCheck --input-file=%t.cir %s -check-prefix=LLVM-NO-ERRNO
+
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value -fclangir -emit-llvm -fmath-errno -O1 %s -o %t.cir
+// RUN: FileCheck --input-file=%t.cir %s -check-prefix=LLVM-ERRNO-O1
----------------
andykaylor wrote:

```suggestion
// RUN: FileCheck --input-file=%t.cir %s -check-prefixes=LLVM-ERRNO,LLVM-ERRNO-O1
```
This will check all of both sets of prefixes. That will let you using `// LLVM-ERRNO: test_fast` to mark boundaries in both default and `-O1` cases. 

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


More information about the cfe-commits mailing list