[PATCH] D54159: [RISCV] Mark FREM as Expand

Alex Bradbury via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 15 06:48:50 PST 2018


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL346958: [RISCV] Mark FREM as Expand (authored by asb, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D54159?vs=173687&id=174205#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D54159

Files:
  llvm/trunk/lib/Target/RISCV/RISCVISelLowering.cpp
  llvm/trunk/test/CodeGen/RISCV/double-frem.ll
  llvm/trunk/test/CodeGen/RISCV/float-frem.ll


Index: llvm/trunk/lib/Target/RISCV/RISCVISelLowering.cpp
===================================================================
--- llvm/trunk/lib/Target/RISCV/RISCVISelLowering.cpp
+++ llvm/trunk/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -114,7 +114,7 @@
   // TODO: add proper support for the various FMA variants
   // (FMADD.S, FMSUB.S, FNMSUB.S, FNMADD.S).
   ISD::NodeType FPOpToExtend[] = {
-      ISD::FSIN, ISD::FCOS, ISD::FSINCOS, ISD::FPOW, ISD::FMA};
+      ISD::FSIN, ISD::FCOS, ISD::FSINCOS, ISD::FPOW, ISD::FMA, ISD::FREM};
 
   if (Subtarget.hasStdExtF()) {
     setOperationAction(ISD::FMINNUM, MVT::f32, Legal);
Index: llvm/trunk/test/CodeGen/RISCV/float-frem.ll
===================================================================
--- llvm/trunk/test/CodeGen/RISCV/float-frem.ll
+++ llvm/trunk/test/CodeGen/RISCV/float-frem.ll
@@ -0,0 +1,16 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc -mtriple=riscv32 -mattr=+f -verify-machineinstrs < %s \
+; RUN:   | FileCheck -check-prefix=RV32IF %s
+
+define float @frem_f32(float %a, float %b) nounwind {
+; RV32IF-LABEL: frem_f32:
+; RV32IF:       # %bb.0:
+; RV32IF-NEXT:    addi sp, sp, -16
+; RV32IF-NEXT:    sw ra, 12(sp)
+; RV32IF-NEXT:    call fmodf
+; RV32IF-NEXT:    lw ra, 12(sp)
+; RV32IF-NEXT:    addi sp, sp, 16
+; RV32IF-NEXT:    ret
+  %1 = frem float %a, %b
+  ret float %1
+}
Index: llvm/trunk/test/CodeGen/RISCV/double-frem.ll
===================================================================
--- llvm/trunk/test/CodeGen/RISCV/double-frem.ll
+++ llvm/trunk/test/CodeGen/RISCV/double-frem.ll
@@ -0,0 +1,16 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc -mtriple=riscv32 -mattr=+d -verify-machineinstrs < %s \
+; RUN:   | FileCheck -check-prefix=RV32ID %s
+
+define double @frem_f64(double %a, double %b) nounwind {
+; RV32ID-LABEL: frem_f64:
+; RV32ID:       # %bb.0:
+; RV32ID-NEXT:    addi sp, sp, -16
+; RV32ID-NEXT:    sw ra, 12(sp)
+; RV32ID-NEXT:    call fmod
+; RV32ID-NEXT:    lw ra, 12(sp)
+; RV32ID-NEXT:    addi sp, sp, 16
+; RV32ID-NEXT:    ret
+  %1 = frem double %a, %b
+  ret double %1
+}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54159.174205.patch
Type: text/x-patch
Size: 2174 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181115/140f6f79/attachment.bin>


More information about the llvm-commits mailing list