[llvm] r187987 - R600/SI: Implement sint<->fp64 conversions

Niels Ole Salscheider niels_ole at salscheider-online.de
Thu Aug 8 09:06:08 PDT 2013


Author: olesalscheider
Date: Thu Aug  8 11:06:08 2013
New Revision: 187987

URL: http://llvm.org/viewvc/llvm-project?rev=187987&view=rev
Log:
R600/SI: Implement sint<->fp64 conversions

Added:
    llvm/trunk/test/CodeGen/R600/fp64_to_sint.ll
    llvm/trunk/test/CodeGen/R600/sint_to_fp64.ll
Modified:
    llvm/trunk/lib/Target/R600/SIInstrInfo.td
    llvm/trunk/lib/Target/R600/SIInstructions.td

Modified: llvm/trunk/lib/Target/R600/SIInstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/R600/SIInstrInfo.td?rev=187987&r1=187986&r2=187987&view=diff
==============================================================================
--- llvm/trunk/lib/Target/R600/SIInstrInfo.td (original)
+++ llvm/trunk/lib/Target/R600/SIInstrInfo.td Thu Aug  8 11:06:08 2013
@@ -184,6 +184,12 @@ multiclass VOP1_32 <bits<8> op, string o
 multiclass VOP1_64 <bits<8> op, string opName, list<dag> pattern>
   : VOP1_Helper <op, VReg_64, VSrc_64, opName, pattern>;
 
+multiclass VOP1_32_64 <bits<8> op, string opName, list<dag> pattern>
+  : VOP1_Helper <op, VReg_32, VSrc_64, opName, pattern>;
+
+multiclass VOP1_64_32 <bits<8> op, string opName, list<dag> pattern>
+  : VOP1_Helper <op, VReg_64, VSrc_32, opName, pattern>;
+
 multiclass VOP2_Helper <bits<6> op, RegisterClass vrc, RegisterClass arc,
                         string opName, list<dag> pattern, string revOp> {
   def _e32 : VOP2 <

Modified: llvm/trunk/lib/Target/R600/SIInstructions.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/R600/SIInstructions.td?rev=187987&r1=187986&r2=187987&view=diff
==============================================================================
--- llvm/trunk/lib/Target/R600/SIInstructions.td (original)
+++ llvm/trunk/lib/Target/R600/SIInstructions.td Thu Aug  8 11:06:08 2013
@@ -603,8 +603,12 @@ defm V_MOV_B32 : VOP1_32 <0x00000001, "V
 } // End neverHasSideEffects = 1, isMoveImm = 1
 
 defm V_READFIRSTLANE_B32 : VOP1_32 <0x00000002, "V_READFIRSTLANE_B32", []>;
-//defm V_CVT_I32_F64 : VOP1_32 <0x00000003, "V_CVT_I32_F64", []>;
-//defm V_CVT_F64_I32 : VOP1_64 <0x00000004, "V_CVT_F64_I32", []>;
+defm V_CVT_I32_F64 : VOP1_32_64 <0x00000003, "V_CVT_I32_F64",
+  [(set i32:$dst, (fp_to_sint f64:$src0))]
+>;
+defm V_CVT_F64_I32 : VOP1_64_32 <0x00000004, "V_CVT_F64_I32",
+  [(set f64:$dst, (sint_to_fp i32:$src0))]
+>;
 defm V_CVT_F32_I32 : VOP1_32 <0x00000005, "V_CVT_F32_I32",
   [(set f32:$dst, (sint_to_fp i32:$src0))]
 >;

Added: llvm/trunk/test/CodeGen/R600/fp64_to_sint.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/R600/fp64_to_sint.ll?rev=187987&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/R600/fp64_to_sint.ll (added)
+++ llvm/trunk/test/CodeGen/R600/fp64_to_sint.ll Thu Aug  8 11:06:08 2013
@@ -0,0 +1,9 @@
+; RUN: llc < %s -march=r600 -mcpu=SI | FileCheck %s --check-prefix=CHECK
+
+; CHECK: @fp64_to_sint
+; CHECK: V_CVT_I32_F64_e32
+define void @fp64_to_sint(i32 addrspace(1)* %out, double %in) {
+  %result = fptosi double %in to i32
+  store i32 %result, i32 addrspace(1)* %out
+  ret void
+}

Added: llvm/trunk/test/CodeGen/R600/sint_to_fp64.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/R600/sint_to_fp64.ll?rev=187987&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/R600/sint_to_fp64.ll (added)
+++ llvm/trunk/test/CodeGen/R600/sint_to_fp64.ll Thu Aug  8 11:06:08 2013
@@ -0,0 +1,9 @@
+; RUN: llc < %s -march=r600 -mcpu=SI | FileCheck %s --check-prefix=CHECK
+
+; CHECK: @sint_to_fp64
+; CHECK: V_CVT_F64_I32_e32
+define void @sint_to_fp64(double addrspace(1)* %out, i32 %in) {
+  %result = sitofp i32 %in to double
+  store double %result, double addrspace(1)* %out
+  ret void
+}





More information about the llvm-commits mailing list