Pattern for f32 to i64 conversion.
authorAkira Hatanaka <ahatanaka@mips.com>
Tue, 24 Jan 2012 22:05:25 +0000 (22:05 +0000)
committerAkira Hatanaka <ahatanaka@mips.com>
Tue, 24 Jan 2012 22:05:25 +0000 (22:05 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148869 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/Mips/MipsInstrFPU.td
test/CodeGen/Mips/mips64ext.ll

index 7638f5486a4b5950068ab5bebbd52d31c82d21db..28cde9159ca4f5d468ae7c4c0a00d783c27f78d6 100644 (file)
@@ -337,6 +337,7 @@ let Predicates = [IsFP64bit] in {
             (CVT_D64_L (DMTC1 CPU64Regs:$src))>;
 
   def : Pat<(i32 (fp_to_sint FGR64:$src)), (MFC1 (TRUNC_W_D64 FGR64:$src))>;
+  def : Pat<(i64 (fp_to_sint FGR32:$src)), (DMFC1 (TRUNC_L_S FGR32:$src))>;    
   def : Pat<(i64 (fp_to_sint FGR64:$src)), (DMFC1 (TRUNC_L_D64 FGR64:$src))>;
 
   def : Pat<(f32 (fround FGR64:$src)), (CVT_S_D64 FGR64:$src)>;
index 7981ec7a473ee3878e04d96467aca41489d002b0..02a35f8e6ed75735e4e4ea6420fbe14f1d4af9c0 100644 (file)
@@ -17,3 +17,10 @@ entry:
   ret i64 %conv
 }
 
+define i64 @i64_float(float %f) nounwind readnone {
+entry:
+; CHECK: trunc.l.s 
+  %conv = fptosi float %f to i64
+  ret i64 %conv
+}
+