def warn_fe_override_module : Warning<
"overriding the module target triple with %0">,
InGroup<DiagGroup<"override-module">>;
+def warn_fe_backend_unsupported_fp_rounding : Warning<
+ "overriding currently unsupported rounding mode on this target">,
+ InGroup<UnsupportedFPOpt>;
+def warn_fe_backend_unsupported_fp_exceptions : Warning<
+ "overriding currently unsupported use of floating point exceptions "
+ "on this target">, InGroup<UnsupportedFPOpt>;
def remark_fe_backend_optimization_remark : Remark<"%0">, BackendInfo,
InGroup<BackendOptimizationRemark>;
def EnumTooLarge : DiagGroup<"enum-too-large">;
def UnsupportedNan : DiagGroup<"unsupported-nan">;
def UnsupportedAbs : DiagGroup<"unsupported-abs">;
+def UnsupportedFPOpt : DiagGroup<"unsupported-floating-point-opt">;
def UnsupportedCB : DiagGroup<"unsupported-cb">;
def UnsupportedGPOpt : DiagGroup<"unsupported-gpopt">;
def UnsupportedTargetOpt : DiagGroup<"unsupported-target-opt">;
bool HasFloat128;
bool HasFloat16;
bool HasBFloat16;
+ bool HasStrictFP;
unsigned char MaxAtomicPromoteWidth, MaxAtomicInlineWidth;
unsigned short SimdDefaultAlign;
/// Determine whether the _BFloat16 type is supported on this target.
virtual bool hasBFloat16Type() const { return HasBFloat16; }
+ /// Determine whether constrained floating point is supported on this target.
+ virtual bool hasStrictFP() const { return HasStrictFP; }
+
/// Return the alignment that is suitable for storing any
/// object with a fundamental alignment requirement.
unsigned getSuitableAlign() const { return SuitableAlign; }
HasFloat128 = false;
HasFloat16 = false;
HasBFloat16 = false;
+ HasStrictFP = false;
PointerWidth = PointerAlign = 32;
BoolWidth = BoolAlign = 8;
IntWidth = IntAlign = 32;
MinGlobalAlign = 16;
resetDataLayout("E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-a:8:16-n32:64");
MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 64;
+ HasStrictFP = true;
}
void getTargetDefines(const LangOptions &Opts,
: TargetInfo(Triple) {
LongDoubleFormat = &llvm::APFloat::x87DoubleExtended();
AddrSpaceMap = &X86AddrSpaceMap;
+ HasStrictFP = true;
}
const char *getLongDoubleMangling() const override {
setAuxTarget(TargetInfo::CreateTargetInfo(getDiagnostics(), TO));
}
+ if (!getTarget().hasStrictFP()) {
+ if (getLangOpts().getFPRoundingMode() !=
+ llvm::RoundingMode::NearestTiesToEven) {
+ getDiagnostics().Report(diag::warn_fe_backend_unsupported_fp_rounding);
+ getLangOpts().setFPRoundingMode(llvm::RoundingMode::NearestTiesToEven);
+ }
+ if (getLangOpts().getFPExceptionMode() != LangOptions::FPE_Ignore) {
+ getDiagnostics().Report(diag::warn_fe_backend_unsupported_fp_exceptions);
+ getLangOpts().setFPExceptionMode(LangOptions::FPE_Ignore);
+ }
+ // FIXME: can we disable FEnvAccess?
+ }
+
// Inform the target of the language options.
//
// FIXME: We shouldn't need to do this, the target should be immutable once
// REQUIRES: aarch64-registered-target
+// Disabled until constrained floating point is implemented for arm64.
+// XFAIL: *
+
// Test new aarch64 intrinsics and types but constrained
#include <arm_neon.h>
// REQUIRES: aarch64-registered-target
+// Disabled until constrained floating point is implemented for arm64.
+// XFAIL: *
+
// Test new aarch64 intrinsics and types but constrained
#include <arm_neon.h>
// REQUIRES: aarch64-registered-target
+// Disabled until constrained floating point is implemented for arm64.
+// XFAIL: *
+
#include <arm_neon.h>
// COMMON-LABEL: test_vsqrt_f16
// REQUIRES: arm-registered-target,aarch64-registered-target
+// Disabled until constrained floating point is implemented for arm64.
+// XFAIL: *
+
#include <arm_neon.h>
// COMMON-LABEL: test_vrndi_f32
// REQUIRES: aarch64-registered-target
+// Disabled until constrained floating point is implemented for arm64.
+// XFAIL: *
+
#include <arm_neon.h>
float64x2_t rnd5(float64x2_t a) { return vrndq_f64(a); }
// RUN: -o - %s | FileCheck --check-prefix=CHECK-ASM \
// RUN: --check-prefix=FIXME-CHECK %s
+// Disabled until constrained floating point is completed for PowerPC.
+// XFAIL: *
+
typedef __attribute__((vector_size(4 * sizeof(float)))) float vec_float;
typedef __attribute__((vector_size(2 * sizeof(double)))) double vec_double;
--- /dev/null
+// RUN: %clang_cc1 -triple mips64-linux-gnu -frounding-math -ffp-exception-behavior=strict -O2 -verify=rounding,exception -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple mips64-linux-gnu -ffp-exception-behavior=strict -O2 -verify=exception -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple mips64-linux-gnu -frounding-math -O2 -verify=rounding -emit-llvm -o - %s | FileCheck %s
+//
+// Verify that constrained intrinsics are not used.
+// As more targets gain support for constrained intrinsics the triple
+// in this test will need to change.
+
+// rounding-warning@* {{overriding currently unsupported rounding mode on this target}}
+// exception-warning@* {{overriding currently unsupported use of floating point exceptions on this target}}
+float fp_precise_1(float a, float b, float c) {
+// CHECK: _Z12fp_precise_1fff
+// CHECK: %[[M:.+]] = fmul float{{.*}}
+// CHECK: fadd float %[[M]], %c
+ return a * b + c;
+}
+
+