Handle bitconverts
authorAnton Korobeynikov <asl@math.spbu.ru>
Thu, 16 Jul 2009 14:27:01 +0000 (14:27 +0000)
committerAnton Korobeynikov <asl@math.spbu.ru>
Thu, 16 Jul 2009 14:27:01 +0000 (14:27 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76042 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/SystemZ/SystemZISelLowering.cpp
lib/Target/SystemZ/SystemZInstrFP.td
lib/Target/SystemZ/SystemZInstrInfo.td

index 757255e3ebb04f7057f3c11ae5b469f06d6643f5..05797c81ab90359581f98d74a74713d22b4d15e6 100644 (file)
@@ -129,6 +129,10 @@ SystemZTargetLowering::SystemZTargetLowering(SystemZTargetMachine &tm) :
   setOperationAction(ISD::FCOS,             MVT::f32, Expand);
   setOperationAction(ISD::FCOS,             MVT::f64, Expand);
 
+  // We have only 64-bit bitconverts
+  setOperationAction(ISD::BIT_CONVERT,      MVT::f32, Promote);
+  setOperationAction(ISD::BIT_CONVERT,      MVT::i32, Promote);
+
   setOperationAction(ISD::UINT_TO_FP,       MVT::i32, Expand);
   setOperationAction(ISD::UINT_TO_FP,       MVT::i64, Expand);
   setOperationAction(ISD::FP_TO_UINT,       MVT::i32, Expand);
index 9e367fe43a583bb64b9ab57f82bcfca9de186ce4..5972264d1e75ff5933e69e17de6ccdf675a2b441 100644 (file)
@@ -295,6 +295,13 @@ def FCONVGR64   : Pseudo<(outs GR64:$dst), (ins FP64:$src),
                           (implicit PSW)]>;
 } // Defs = [PSW]
 
+def FBCONVG64   : Pseudo<(outs GR64:$dst), (ins FP64:$src),
+                         "lgdr\t{$dst, $src}",
+                         [(set GR64:$dst, (bitconvert FP64:$src))]>;
+def FBCONVF64   : Pseudo<(outs FP64:$dst), (ins GR64:$src),
+                         "ldgr\t{$dst, $src}",
+                         [(set FP64:$dst, (bitconvert GR64:$src))]>;
+
 //===----------------------------------------------------------------------===//
 // Test instructions (like AND but do not produce any result)
 
index 5672b048d20103ae9a06a464a97f5c4f3844d490..7bfd8eb82bd00a8853f8eb4a14a1d6feef4de449 100644 (file)
@@ -785,7 +785,11 @@ def : Pat<(SystemZcall (i64 texternalsym:$dst)), (CALLi texternalsym:$dst)>;
 
 // FIXME: use add/sub tricks with 32678/-32768
 
-// Arbitrary immediate support.  Implement in terms of LLIHF/OILF.
+// Arbitrary immediate support.
+def : Pat<(i32 imm:$src),
+          (EXTRACT_SUBREG (MOV64ri32 (i64 imm:$src)), subreg_32bit)>;
+
+// Implement in terms of LLIHF/OILF.
 def : Pat<(i64 imm:$imm),
           (OR64rilo32 (MOV64rihi32 (HI32 imm:$imm)), (LO32 imm:$imm))>;
 
@@ -821,6 +825,3 @@ def : Pat<(mulhu GR64:$src1, GR64:$src2),
                                                      GR64:$src1, subreg_odd),
                                       GR64:$src2),
                           subreg_even)>;
-
-def : Pat<(i32 imm:$src),
-          (EXTRACT_SUBREG (MOV64ri32 (i64 imm:$src)), subreg_32bit)>;