[clang] ee63acc - Put back the test pragma-fp-exc.cpp

Serge Pavlov via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 2 22:20:00 PST 2020


Author: Serge Pavlov
Date: 2020-11-03T13:18:40+07:00
New Revision: ee63acc37e319cdab6accd677fdf772ea3683867

URL: https://github.com/llvm/llvm-project/commit/ee63acc37e319cdab6accd677fdf772ea3683867
DIFF: https://github.com/llvm/llvm-project/commit/ee63acc37e319cdab6accd677fdf772ea3683867.diff

LOG: Put back the test pragma-fp-exc.cpp

This test was removed in 5963e028e714 because it failed on cores where
support of constrained intrinsics was limited. Now this test is enabled
only on x86.

Added: 
    clang/test/CodeGen/pragma-fp-exc.cpp

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/clang/test/CodeGen/pragma-fp-exc.cpp b/clang/test/CodeGen/pragma-fp-exc.cpp
new file mode 100644
index 000000000000..ff47173739db
--- /dev/null
+++ b/clang/test/CodeGen/pragma-fp-exc.cpp
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm -o - %s | FileCheck --check-prefix=CHECK-DEF %s
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -ffp-exception-behavior=strict -emit-llvm -o - %s | FileCheck --check-prefix=CHECK-STRICT %s
+
+// REQUIRES: x86-registered-target
+
+float func_01(float x, float y, float z) {
+  float res = x + y;
+  {
+#pragma clang fp exceptions(maytrap)
+    res += z;
+  }
+  return res;
+}
+// CHECK-DEF-LABEL: @_Z7func_01fff
+// CHECK-DEF:       call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, metadata !"round.tonearest", metadata !"fpexcept.ignore")
+// CHECK-DEF:       call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, metadata !"round.tonearest", metadata !"fpexcept.maytrap")
+
+// CHECK-STRICT-LABEL: @_Z7func_01fff
+// CHECK-STRICT:       call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
+// CHECK-STRICT:       call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, metadata !"round.tonearest", metadata !"fpexcept.maytrap")


        


More information about the cfe-commits mailing list