[clang] [Mips] Enable strict fp for Mips in clang (PR #237069)

Brad Smith via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 3 03:50:34 PST 2026


brad0 wrote:

One more: `clang/test/CodeGen/fp-strictfp-exp.cpp` also uses mips64. With this change it no longer tests the experimental flag, so please move it to hexagon too:

```diff
-// RUN: %clang_cc1 -triple mips64-linux-gnu -fexperimental-strict-floating-point -frounding-math -ffp-exception-behavior=strict -O2 -emit-llvm -o - %s | FileCheck %s
-// RUN: %clang_cc1 -triple mips64-linux-gnu -fexperimental-strict-floating-point -ffp-exception-behavior=strict -O2 -emit-llvm -o - %s | FileCheck %s
-// RUN: %clang_cc1 -triple mips64-linux-gnu -fexperimental-strict-floating-point -frounding-math -O2 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple hexagon-unknown-elf -fexperimental-strict-floating-point -frounding-math -ffp-exception-behavior=strict -O2 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple hexagon-unknown-elf -fexperimental-strict-floating-point -ffp-exception-behavior=strict -O2 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple hexagon-unknown-elf -fexperimental-strict-floating-point -frounding-math -O2 -emit-llvm -o - %s | FileCheck %s
```

In the new test, please don't match `%0`, `%1` and `%mul` by name, and drop the blank line at the end. Something like:

```c
// RUN: %clang_cc1 -triple mips64-unknown-linux-gnu -frounding-math \
// RUN:   -ffp-exception-behavior=strict -emit-llvm -o - %s -verify \
// RUN:   | FileCheck %s
// RUN: %clang_cc1 -triple mips-unknown-linux-gnu -frounding-math \
// RUN:   -ffp-exception-behavior=strict -emit-llvm -o - %s -verify \
// RUN:   | FileCheck %s
// expected-no-diagnostics

// CHECK-LABEL: define{{.*}} double @div(
// CHECK: call double @llvm.experimental.constrained.fdiv.f64(double 1.000000e+00, double 3.000000e+00, metadata !"round.dynamic", metadata !"fpexcept.strict")
double div(void) { return 1.0 / 3.0; }

// CHECK-LABEL: define{{.*}} float @fp_precise_1(
// CHECK: %[[M:.+]] = call float @llvm.experimental.constrained.fmul.f32(float {{.*}}, float {{.*}}, metadata !"round.dynamic", metadata !"fpexcept.strict")
// CHECK: call float @llvm.experimental.constrained.fadd.f32(float %[[M]], float {{.*}}, metadata !"round.dynamic", metadata !"fpexcept.strict")
float fp_precise_1(float a, float b, float c) {
  return a * b + c;
}
```

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


More information about the cfe-commits mailing list