================
@@ -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
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value 
-fclangir -emit-llvm -ffast-math -O1 %s -o %t.cir
+// RUN: FileCheck --input-file=%t.cir %s -check-prefix=LLVM-NO-ERRNO-O1
+
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value 
-emit-llvm -fmath-errno %s -o %t.cir
+// RUN: FileCheck --input-file=%t.cir %s -check-prefix=OGCG-ERRNO
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value 
-emit-llvm -ffast-math %s -o %t.cir
+// RUN: FileCheck --input-file=%t.cir %s -check-prefix=OGCG-NO-ERRNO
+
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value 
-emit-llvm -fmath-errno -O1 %s -o %t.cir
+// RUN: FileCheck --input-file=%t.cir %s -check-prefix=OGCG-ERRNO-O1
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value 
-emit-llvm -ffast-math -O1 %s -o %t.cir
+// RUN: FileCheck --input-file=%t.cir %s -check-prefix=OGCG-NO-ERRNO-O1
+
+float test_normal(float f) {
+  return __builtin_cosf(f);
+  // CIR-ERRNO: cir.call @cosf
+  // CIR-NO-ERRNO: cir.cos
+  // LLVM-ERRNO: call float @cosf
+  // LLVM-NO-ERRNO: call float @llvm.cos.f32
+  // OGCG-ERRNO: call {{.*}} float @cosf
+  // OGCG-NO-ERRNO: call {{.*}} float @llvm.cos.f32
+}
+
+float test_precise(float f) {
+#pragma float_control(precise, on)
+  // Should never produce an intrinsic
+  return __builtin_cosf(f);
+  // CIR-ERRNO: cir.call @cosf
+  // CIR-NO-ERRNO: cir.call @cosf
+  // LLVM-ERRNO: call float @cosf
+  // LLVM-NO-ERRNO: call float @llvm.cos.f32
----------------
andykaylor wrote:

This isn't right. I suspect you're matching the call generated by the 
`test_fast` case below. You should check all the function names to avoid that 
kind of false match.

https://github.com/llvm/llvm-project/pull/169424
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to