[llvm] 213b0ae - [GlobalISel][ARM] legalize G_FPENV_RESET for soft-float mode (#81456)

via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 12 02:47:03 PST 2024


Author: Serge Pavlov
Date: 2024-02-12T17:46:59+07:00
New Revision: 213b0ae4978581d382ba99107040122c5e69662b

URL: https://github.com/llvm/llvm-project/commit/213b0ae4978581d382ba99107040122c5e69662b
DIFF: https://github.com/llvm/llvm-project/commit/213b0ae4978581d382ba99107040122c5e69662b.diff

LOG: [GlobalISel][ARM] legalize G_FPENV_RESET for soft-float mode (#81456)

Added: 
    

Modified: 
    llvm/lib/Target/ARM/ARMLegalizerInfo.cpp
    llvm/test/CodeGen/ARM/GlobalISel/fpenv.ll

Removed: 
    


################################################################################
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" }
 


        


More information about the llvm-commits mailing list