[llvm] [GlobalISel][ARM] legalize G_FPENV_RESET for soft-float mode (PR #81456)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 12 01:17:49 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-globalisel
Author: Serge Pavlov (spavloff)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/81456.diff
2 Files Affected:
- (modified) llvm/lib/Target/ARM/ARMLegalizerInfo.cpp (+2-1)
- (modified) llvm/test/CodeGen/ARM/GlobalISel/fpenv.ll (+14)
``````````diff
diff --git a/llvm/lib/Target/ARM/ARMLegalizerInfo.cpp b/llvm/lib/Target/ARM/ARMLegalizerInfo.cpp
index 67187c4b1b3ae7..c5199aab752726 100644
--- a/llvm/lib/Target/ARM/ARMLegalizerInfo.cpp
+++ b/llvm/lib/Target/ARM/ARMLegalizerInfo.cpp
@@ -223,7 +223,8 @@ ARMLegalizerInfo::ARMLegalizerInfo(const ARMSubtarget &ST) {
getActionDefinitionsBuilder({G_SITOFP, G_UITOFP})
.libcallForCartesianProduct({s32, s64}, {s32});
- getActionDefinitionsBuilder({G_GET_FPENV, G_SET_FPENV}).libcall();
+ getActionDefinitionsBuilder({G_GET_FPENV, G_SET_FPENV, G_RESET_FPENV})
+ .libcall();
}
// Just expand whatever loads and stores are left.
diff --git a/llvm/test/CodeGen/ARM/GlobalISel/fpenv.ll b/llvm/test/CodeGen/ARM/GlobalISel/fpenv.ll
index 3d18a65bd43452..f5aea62d4be79a 100644
--- a/llvm/test/CodeGen/ARM/GlobalISel/fpenv.ll
+++ b/llvm/test/CodeGen/ARM/GlobalISel/fpenv.ll
@@ -74,5 +74,19 @@ entry:
ret void
}
+define void @func_reset_soft() #0 {
+; CHECK-LABEL: func_reset_soft:
+; CHECK: @ %bb.0: @ %entry
+; CHECK-NEXT: .save {r11, lr}
+; CHECK-NEXT: push {r11, lr}
+; CHECK-NEXT: mvn r0, #0
+; CHECK-NEXT: bl fesetenv
+; CHECK-NEXT: pop {r11, lr}
+; CHECK-NEXT: mov pc, lr
+entry:
+ call void @llvm.reset.fpenv()
+ ret void
+}
+
attributes #0 = { nounwind "use-soft-float"="true" }
``````````
</details>
https://github.com/llvm/llvm-project/pull/81456
More information about the llvm-commits
mailing list