r253337 - Revert "Make FP_CONTRACT ON the default."
Manuel Klimek via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 17 07:40:11 PST 2015
Author: klimek
Date: Tue Nov 17 09:40:10 2015
New Revision: 253337
URL: http://llvm.org/viewvc/llvm-project?rev=253337&view=rev
Log:
Revert "Make FP_CONTRACT ON the default."
This reverts commit r253269.
This leads to assert / segfault triggering on the following reduced example:
float foo(float U, float base, float cell) { return (U = 2 * base) - cell; }
Removed:
cfe/trunk/test/CodeGen/aarch64-scalar-fma.c
Modified:
cfe/trunk/include/clang/Basic/LangOptions.def
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/test/CodeGen/aarch64-neon-fma.c
cfe/trunk/test/CodeGen/fp-contract-pragma.cpp
cfe/trunk/test/Driver/clang_f_opts.c
Modified: cfe/trunk/include/clang/Basic/LangOptions.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.def?rev=253337&r1=253336&r2=253337&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/LangOptions.def (original)
+++ cfe/trunk/include/clang/Basic/LangOptions.def Tue Nov 17 09:40:10 2015
@@ -187,7 +187,7 @@ BENIGN_LANGOPT(DebuggerObjCLiteral , 1,
BENIGN_LANGOPT(SpellChecking , 1, 1, "spell-checking")
LANGOPT(SinglePrecisionConstants , 1, 0, "treating double-precision floating point constants as single precision constants")
LANGOPT(FastRelaxedMath , 1, 0, "OpenCL fast relaxed math")
-LANGOPT(DefaultFPContract , 1, 1, "FP_CONTRACT")
+LANGOPT(DefaultFPContract , 1, 0, "FP_CONTRACT")
LANGOPT(NoBitFieldTypeAlign , 1, 0, "bit-field type alignment")
LANGOPT(HexagonQdsp6Compat , 1, 0, "hexagon-qdsp6 backward compatibility")
LANGOPT(ObjCAutoRefCount , 1, 0, "Objective-C automated reference counting")
Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=253337&r1=253336&r2=253337&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Tue Nov 17 09:40:10 2015
@@ -1336,6 +1336,7 @@ void CompilerInvocation::setLangDefaults
Opts.ZVector = 0;
Opts.CXXOperatorNames = 1;
Opts.LaxVectorConversions = 0;
+ Opts.DefaultFPContract = 1;
Opts.NativeHalfType = 1;
}
Modified: cfe/trunk/test/CodeGen/aarch64-neon-fma.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/aarch64-neon-fma.c?rev=253337&r1=253336&r2=253337&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/aarch64-neon-fma.c (original)
+++ cfe/trunk/test/CodeGen/aarch64-neon-fma.c Tue Nov 17 09:40:10 2015
@@ -1,8 +1,5 @@
// REQUIRES: aarch64-registered-target
-// RUN: %clang_cc1 -triple arm64-none-linux-gnu -target-feature +neon -S -O3 \
-// RUN: -ffp-contract=off -o - %s | FileCheck %s
-// RUN: %clang_cc1 -triple arm64-none-linux-gnu -target-feature +neon -S -O3 \
-// RUN: -o - %s | FileCheck -check-prefix=CHECK-FMA %s
+// RUN: %clang_cc1 -triple arm64-none-linux-gnu -target-feature +neon -S -O3 -o - %s | FileCheck %s
// Test new aarch64 intrinsics and types
@@ -13,7 +10,8 @@ float32x2_t test_vmla_n_f32(float32x2_t
return vmla_n_f32(a, b, c);
// CHECK: fmul {{v[0-9]+}}.2s, {{v[0-9]+}}.2s, {{v[0-9]+}}.s[0]
// CHECK: fadd {{v[0-9]+}}.2s, {{v[0-9]+}}.2s, {{v[0-9]+}}.2s
- // CHECK-FMA: fmla {{v[0-9]+}}.2s, {{v[0-9]+}}.2s, {{v[0-9]+}}.s[0]
+ // CHECK-FMA: dup {{v[0-9]+}}.2s, {{v[0-9]+}}.s[0]
+ // CHECK-FMA: fmla {{v[0-9]+}}.2s, {{v[0-9]+}}.2s, {{v[0-9]+}}.2s
}
float32x4_t test_vmlaq_n_f32(float32x4_t a, float32x4_t b, float32_t c) {
@@ -21,7 +19,8 @@ float32x4_t test_vmlaq_n_f32(float32x4_t
return vmlaq_n_f32(a, b, c);
// CHECK: fmul {{v[0-9]+}}.4s, {{v[0-9]+}}.4s, {{v[0-9]+}}.s[0]
// CHECK: fadd {{v[0-9]+}}.4s, {{v[0-9]+}}.4s, {{v[0-9]+}}.4s
- // CHECK-FMA: fmla {{v[0-9]+}}.4s, {{v[0-9]+}}.4s, {{v[0-9]+}}.s[0]
+ // CHECK-FMA: dup {{v[0-9]+}}.4s, {{v[0-9]+}}.s[0]
+ // CHECK-FMA: fmla {{v[0-9]+}}.4s, {{v[0-9]+}}.4s, {{v[0-9]+}}.4s
}
float64x2_t test_vmlaq_n_f64(float64x2_t a, float64x2_t b, float64_t c) {
@@ -29,7 +28,8 @@ float64x2_t test_vmlaq_n_f64(float64x2_t
return vmlaq_n_f64(a, b, c);
// CHECK: fmul {{v[0-9]+}}.2d, {{v[0-9]+}}.2d, {{v[0-9]+}}.d[0]
// CHECK: fadd {{v[0-9]+}}.2d, {{v[0-9]+}}.2d, {{v[0-9]+}}.2d
- // CHECK-FMA: fmla {{v[0-9]+}}.2d, {{v[0-9]+}}.2d, {{v[0-9]+}}.d[0]
+ // CHECK-FMA: dup {{v[0-9]+}}.2d, {{v[0-9]+}}.d[0]
+ // CHECK-FMA: fmla {{v[0-9]+}}.2d, {{v[0-9]+}}.2d, {{v[0-9]+}}.2d
}
float32x4_t test_vmlsq_n_f32(float32x4_t a, float32x4_t b, float32_t c) {
@@ -37,7 +37,8 @@ float32x4_t test_vmlsq_n_f32(float32x4_t
return vmlsq_n_f32(a, b, c);
// CHECK: fmul {{v[0-9]+}}.4s, {{v[0-9]+}}.4s, {{v[0-9]+}}.s[0]
// CHECK: fsub {{v[0-9]+}}.4s, {{v[0-9]+}}.4s, {{v[0-9]+}}.4s
- // CHECK-FMA: fmls {{v[0-9]+}}.4s, {{v[0-9]+}}.4s, {{v[0-9]+}}.s[0]
+ // CHECK-FMA: dup {{v[0-9]+}}.4s, {{v[0-9]+}}.s[0]
+ // CHECK-FMA: fmls {{v[0-9]+}}.4s, {{v[0-9]+}}.4s, {{v[0-9]+}}.4s
}
float32x2_t test_vmls_n_f32(float32x2_t a, float32x2_t b, float32_t c) {
@@ -45,7 +46,8 @@ float32x2_t test_vmls_n_f32(float32x2_t
return vmls_n_f32(a, b, c);
// CHECK: fmul {{v[0-9]+}}.2s, {{v[0-9]+}}.2s, {{v[0-9]+}}.s[0]
// CHECK: fsub {{v[0-9]+}}.2s, {{v[0-9]+}}.2s, {{v[0-9]+}}.2s
- // CHECK-FMA: fmls {{v[0-9]+}}.2s, {{v[0-9]+}}.2s, {{v[0-9]+}}.s[0]
+ // CHECK-FMA: dup {{v[0-9]+}}.2s, {{v[0-9]+}}.s[0]
+ // CHECK-FMA: fmls {{v[0-9]+}}.2s, {{v[0-9]+}}.2s, {{v[0-9]+}}.2s
}
float64x2_t test_vmlsq_n_f64(float64x2_t a, float64x2_t b, float64_t c) {
@@ -53,7 +55,8 @@ float64x2_t test_vmlsq_n_f64(float64x2_t
return vmlsq_n_f64(a, b, c);
// CHECK: fmul {{v[0-9]+}}.2d, {{v[0-9]+}}.2d, {{v[0-9]+}}.d[0]
// CHECK: fsub {{v[0-9]+}}.2d, {{v[0-9]+}}.2d, {{v[0-9]+}}.2d
- // CHECK-FMA: fmls {{v[0-9]+}}.2d, {{v[0-9]+}}.2d, {{v[0-9]+}}.d[0]
+ // CHECK-FMA: dup {{v[0-9]+}}.2d, {{v[0-9]+}}.d[0]
+ // CHECK-FMA: fmls {{v[0-9]+}}.2d, {{v[0-9]+}}.2d, {{v[0-9]+}}.2d
}
float32x2_t test_vmla_lane_f32_0(float32x2_t a, float32x2_t b, float32x2_t v) {
Removed: cfe/trunk/test/CodeGen/aarch64-scalar-fma.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/aarch64-scalar-fma.c?rev=253336&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/aarch64-scalar-fma.c (original)
+++ cfe/trunk/test/CodeGen/aarch64-scalar-fma.c (removed)
@@ -1,177 +0,0 @@
-// RUN: %clang_cc1 -triple=aarch64-unknown -Os -ffp-contract=fast -S -o - %s | FileCheck -check-prefix=CHECK-FAST -check-prefix=CHECK-ALL %s
-// RUN: %clang_cc1 -triple=aarch64-unknown -Os -ffp-contract=on -S -o - %s | FileCheck -check-prefix=CHECK-ON -check-prefix=CHECK-ALL %s
-// RUN: %clang_cc1 -triple=aarch64-unknown -Os -ffp-contract=off -S -o - %s | FileCheck -check-prefix=CHECK-OFF -check-prefix=CHECK-ALL %s
-// RUN: %clang_cc1 -triple=aarch64-unknown -Os -S -o - %s | FileCheck -check-prefix=CHECK-ON -check-prefix=CHECK-ALL %s
-// REQUIRES: aarch64-registered-target
-
-float test1(float x, float y, float z) {
- return x*y + z;
- // CHECK-ALL-LABEL: test1:
- // CHECK-FAST: fmadd
- // CHECK-ON: fmadd
- // CHECK-OFF: fmul
- // CHECK-OFF-NEXT: fadd
-}
-
-double test2(double x, double y, double z) {
- z -= x*y;
- return z;
- // CHECK-ALL-LABEL: test2:
- // CHECK-FAST: fmsub
- // CHECK-ON: fmsub
- // CHECK-OFF: fmul
- // CHECK-OFF-NEXT: fsub
-}
-
-float test3(float x, float y, float z) {
- float tmp = x*y;
- return tmp + z;
- // CHECK-ALL-LABEL: test3:
- // CHECK-FAST: fmadd
- // CHECK-ON: fmul
- // CHECK-ON-NEXT: fadd
- // CHECK-OFF: fmul
- // CHECK-OFF-NEXT: fadd
-}
-
-double test4(double x, double y, double z) {
- double tmp = x*y;
- return tmp - z;
- // CHECK-ALL-LABEL: test4:
- // CHECK-FAST: fnmsub
- // CHECK-ON: fmul
- // CHECK-ON-NEXT: fsub
- // CHECK-OFF: fmul
- // CHECK-OFF-NEXT: fsub
-}
-
-#pragma STDC FP_CONTRACT ON
-
-float test5(float x, float y, float z) {
- return x*y + z;
- // CHECK-ALL-LABEL: test5:
- // CHECK-FAST: fmadd
- // CHECK-ON: fmadd
- // CHECK-OFF: fmul
- // CHECK-OFF-NEXT: fadd
-}
-
-double test6(double x, double y, double z) {
- z -= x*y;
- return z;
- // CHECK-ALL-LABEL: test6:
- // CHECK-FAST: fmsub
- // CHECK-ON: fmsub
- // CHECK-OFF: fmul
- // CHECK-OFF-NEXT: fsub
-}
-
-float test7(float x, float y, float z) {
- float tmp = x*y;
- return tmp + z;
- // CHECK-ALL-LABEL: test7:
- // CHECK-FAST: fmadd
- // CHECK-ON: fmul
- // CHECK-ON-NEXT: fadd
- // CHECK-OFF: fmul
- // CHECK-OFF-NEXT: fadd
-}
-
-double test8(double x, double y, double z) {
- double tmp = x*y;
- return tmp - z;
- // CHECK-ALL-LABEL: test8:
- // CHECK-FAST: fnmsub
- // CHECK-ON: fmul
- // CHECK-ON-NEXT: fsub
- // CHECK-OFF: fmul
- // CHECK-OFF-NEXT: fsub
-}
-
-#pragma STDC FP_CONTRACT OFF
-
-float test9(float x, float y, float z) {
- return x*y + z;
- // CHECK-ALL-LABEL: test9:
- // CHECK-FAST: fmadd
- // CHECK-ON: fmul
- // CHECK-ON-NEXT: fadd
- // CHECK-OFF: fmul
- // CHECK-OFF-NEXT: fadd
-}
-
-double test10(double x, double y, double z) {
- z -= x*y;
- return z;
- // CHECK-ALL-LABEL: test10:
- // CHECK-FAST: fmsub
- // CHECK-ON: fmul
- // CHECK-ON-NEXT: fsub
- // CHECK-OFF: fmul
- // CHECK-OFF-NEXT: fsub
-}
-
-float test11(float x, float y, float z) {
- float tmp = x*y;
- return tmp + z;
- // CHECK-ALL-LABEL: test11:
- // CHECK-FAST: fmadd
- // CHECK-ON: fmul
- // CHECK-ON-NEXT: fadd
- // CHECK-OFF: fmul
- // CHECK-OFF-NEXT: fadd
-}
-
-double test12(double x, double y, double z) {
- double tmp = x*y;
- return tmp - z;
- // CHECK-ALL-LABEL: test12:
- // CHECK-FAST: fnmsub
- // CHECK-ON: fmul
- // CHECK-ON-NEXT: fsub
- // CHECK-OFF: fmul
- // CHECK-OFF-NEXT: fsub
-}
-
-#pragma STDC FP_CONTRACT DEFAULT
-
-float test17(float x, float y, float z) {
- return x*y + z;
- // CHECK-ALL-LABEL: test17:
- // CHECK-FAST: fmadd
- // CHECK-ON: fmadd
- // CHECK-OFF: fmul
- // CHECK-OFF-NEXT: fadd
-}
-
-double test18(double x, double y, double z) {
- z -= x*y;
- return z;
- // CHECK-ALL-LABEL: test18:
- // CHECK-FAST: fmsub
- // CHECK-ON: fmsub
- // CHECK-OFF: fmul
- // CHECK-OFF-NEXT: fsub
-}
-
-float test19(float x, float y, float z) {
- float tmp = x*y;
- return tmp + z;
- // CHECK-ALL-LABEL: test19:
- // CHECK-FAST: fmadd
- // CHECK-ON: fmul
- // CHECK-ON-NEXT: fadd
- // CHECK-OFF: fmul
- // CHECK-OFF-NEXT: fadd
-}
-
-double test20(double x, double y, double z) {
- double tmp = x*y;
- return tmp - z;
- // CHECK-ALL-LABEL: test20:
- // CHECK-FAST: fnmsub
- // CHECK-ON: fmul
- // CHECK-ON-NEXT: fsub
- // CHECK-OFF: fmul
- // CHECK-OFF-NEXT: fsub
-}
Modified: cfe/trunk/test/CodeGen/fp-contract-pragma.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/fp-contract-pragma.cpp?rev=253337&r1=253336&r2=253337&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/fp-contract-pragma.cpp (original)
+++ cfe/trunk/test/CodeGen/fp-contract-pragma.cpp Tue Nov 17 09:40:10 2015
@@ -1,7 +1,5 @@
// RUN: %clang_cc1 -O3 -triple %itanium_abi_triple -emit-llvm -o - %s | FileCheck %s
-#pragma STDC FP_CONTRACT OFF
-
// Is FP_CONTRACT is honored in a simple case?
float fp_contract_1(float a, float b, float c) {
// CHECK: _Z13fp_contract_1fff
Modified: cfe/trunk/test/Driver/clang_f_opts.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/clang_f_opts.c?rev=253337&r1=253336&r2=253337&view=diff
==============================================================================
--- cfe/trunk/test/Driver/clang_f_opts.c (original)
+++ cfe/trunk/test/Driver/clang_f_opts.c Tue Nov 17 09:40:10 2015
@@ -36,10 +36,8 @@
// RUN: %clang -### -S -ffp-contract=fast %s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-FAST-CHECK %s
// RUN: %clang -### -S -ffast-math %s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-FAST-CHECK %s
// RUN: %clang -### -S -ffp-contract=off %s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-OFF-CHECK %s
-// RUN: %clang -### -S -ffp-contract=on %s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-ON-CHECK %s
// FP-CONTRACT-FAST-CHECK: -ffp-contract=fast
// FP-CONTRACT-OFF-CHECK: -ffp-contract=off
-// FP-CONTRACT-ON-CHECK: -ffp-contract=on
// RUN: %clang -### -S -funroll-loops %s 2>&1 | FileCheck -check-prefix=CHECK-UNROLL-LOOPS %s
// RUN: %clang -### -S -fno-unroll-loops %s 2>&1 | FileCheck -check-prefix=CHECK-NO-UNROLL-LOOPS %s
More information about the cfe-commits
mailing list