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

>From a78a63bdc7d8bba2b8ad4381b4ff5ec2bd72babe Mon Sep 17 00:00:00 2001
From: Ying Huang <[email protected]>
Date: Fri, 30 Oct 2026 11:19:14 +0800
Subject: [PATCH 1/2] [Mips] Enable strict fp for Mips in clang

---
 clang/lib/Basic/Targets/Mips.h     | 1 +
 clang/test/CodeGen/Mips/strictfp.c | 7 +++++++
 2 files changed, 8 insertions(+)
 create mode 100644 clang/test/CodeGen/Mips/strictfp.c

diff --git a/clang/lib/Basic/Targets/Mips.h b/clang/lib/Basic/Targets/Mips.h
index 2f251c7eb86907..fd32e479b5a76b 100644
--- a/clang/lib/Basic/Targets/Mips.h
+++ b/clang/lib/Basic/Targets/Mips.h
@@ -62,6 +62,7 @@ class LLVM_LIBRARY_VISIBILITY MipsTargetInfo : public 
TargetInfo {
 
     CanUseBSDABICalls = Triple.isOSFreeBSD() ||
                         Triple.isOSOpenBSD();
+    HasStrictFP = true;
   }
 
   bool isIEEE754_2008Default() const {
diff --git a/clang/test/CodeGen/Mips/strictfp.c 
b/clang/test/CodeGen/Mips/strictfp.c
new file mode 100644
index 00000000000000..952df72cbb0207
--- /dev/null
+++ b/clang/test/CodeGen/Mips/strictfp.c
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -triple mips64-unknown-linux-gnu -frounding-math \
+// RUN:   -ffp-exception-behavior=strict -emit-llvm -o - %s \
+// RUN:   | FileCheck %s --check-prefixes=STRICT
+//
+// STRICT: 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; }
+

>From 0bcefbfa6dcc7092718ea3eb024a9327fb67a506 Mon Sep 17 00:00:00 2001
From: Ying Huang <[email protected]>
Date: Fri, 30 Oct 2026 15:45:50 +0800
Subject: [PATCH 2/2] Delete no need file and move contents to the new added
 file

---
 clang/test/CodeGen/Mips/strictfp.c |  6 ++++++
 clang/test/CodeGen/fp-strictfp.cpp | 16 ----------------
 2 files changed, 6 insertions(+), 16 deletions(-)
 delete mode 100644 clang/test/CodeGen/fp-strictfp.cpp

diff --git a/clang/test/CodeGen/Mips/strictfp.c 
b/clang/test/CodeGen/Mips/strictfp.c
index 952df72cbb0207..f7a28e334355a0 100644
--- a/clang/test/CodeGen/Mips/strictfp.c
+++ b/clang/test/CodeGen/Mips/strictfp.c
@@ -5,3 +5,9 @@
 // STRICT: 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; }
 
+float fp_precise_1(float a, float b, float c) {
+// STRICT: call float @llvm.experimental.constrained.fmul.f32(float %0, float 
%1, metadata !"round.dynamic", metadata !"fpexcept.strict")
+// STRICT: call float @llvm.experimental.constrained.fadd.f32(float %mul, 
float %2, metadata !"round.dynamic", metadata !"fpexcept.strict")
+  return a * b + c;
+}
+
diff --git a/clang/test/CodeGen/fp-strictfp.cpp 
b/clang/test/CodeGen/fp-strictfp.cpp
deleted file mode 100644
index 124c0f0be29b9c..00000000000000
--- a/clang/test/CodeGen/fp-strictfp.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-// 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: define{{.*}} float @_Z12fp_precise_1fff
-// CHECK: %[[M:.+]] = fmul float{{.*}}
-// CHECK: fadd float %[[M]], %c
-  return a * b + c;
-}

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

Reply via email to