Remove incorrect comments. These are not disassmebly only patterns.
[oota-llvm.git] / lib / Target / PTX / PTXInstrInfo.td
index c5cedb0a8bb87ac5590b52a031601e9b91d8ac76..11caa7f1f9d795db93fcd51a7f01e5cb0998d07d 100644 (file)
@@ -168,6 +168,18 @@ def MEMret : Operand<i32> {
   let MIOperandInfo = (ops i32imm);
 }
 
+// def SDT_PTXCallSeqStart : SDCallSeqStart<[SDTCisVT<0, i32>]>;
+// def SDT_PTXCallSeqEnd   : SDCallSeqEnd<[SDTCisVT<0, i32>, SDTCisVT<1, i32>]>;
+
+// def PTXcallseq_start : SDNode<"ISD::CALLSEQ_START", SDT_PTXCallSeqStart,
+//                               [SDNPHasChain, SDNPOutGlue]>;
+// def PTXcallseq_end   : SDNode<"ISD::CALLSEQ_END", SDT_PTXCallSeqEnd,
+//                               [SDNPHasChain, SDNPOptInGlue, SDNPOutGlue]>;
+
+def PTXcall : SDNode<"PTXISD::CALL", SDTNone,
+                     [SDNPHasChain, SDNPVariadic, SDNPOptInGlue, SDNPOutGlue]>;
+
+
 // Branch & call targets have OtherVT type.
 def brtarget   : Operand<OtherVT>;
 def calltarget : Operand<i32>;
@@ -537,7 +549,6 @@ multiclass PTX_LD<string opstr, string typestr, RegisterClass RC, PatFrag pat_lo
 }
 
 multiclass PTX_LD_ALL<string opstr, PatFrag pat_load> {
-  defm u8  : PTX_LD<opstr, ".u8",  RegI8,  pat_load>;
   defm u16 : PTX_LD<opstr, ".u16", RegI16, pat_load>;
   defm u32 : PTX_LD<opstr, ".u32", RegI32, pat_load>;
   defm u64 : PTX_LD<opstr, ".u64", RegI64, pat_load>;
@@ -573,7 +584,6 @@ multiclass PTX_ST<string opstr, string typestr, RegisterClass RC, PatFrag pat_st
 }
 
 multiclass PTX_ST_ALL<string opstr, PatFrag pat_store> {
-  defm u8  : PTX_ST<opstr, ".u8",  RegI8,  pat_store>;
   defm u16 : PTX_ST<opstr, ".u16", RegI16, pat_store>;
   defm u32 : PTX_ST<opstr, ".u32", RegI32, pat_store>;
   defm u64 : PTX_ST<opstr, ".u64", RegI64, pat_store>;
@@ -785,27 +795,22 @@ defm XOR : PTX_LOGIC<"xor", xor>;
 let neverHasSideEffects = 1 in {
   def MOVPREDrr
     : InstPTX<(outs RegPred:$d), (ins RegPred:$a), "mov.pred\t$d, $a", []>;
-  def MOVU8rr
-    : InstPTX<(outs RegI8:$d),   (ins RegI8:$a),   "mov.u8\t$d, $a",  []>;
   def MOVU16rr
-    : InstPTX<(outs RegI16:$d),  (ins RegI16:$a),  "mov.u16\t$d, $a", []>;
+    : InstPTX<(outs RegI16:$d), (ins RegI16:$a), "mov.u16\t$d, $a", []>;
   def MOVU32rr
-    : InstPTX<(outs RegI32:$d),  (ins RegI32:$a),  "mov.u32\t$d, $a", []>;
+    : InstPTX<(outs RegI32:$d), (ins RegI32:$a), "mov.u32\t$d, $a", []>;
   def MOVU64rr
-    : InstPTX<(outs RegI64:$d),  (ins RegI64:$a),  "mov.u64\t$d, $a", []>;
+    : InstPTX<(outs RegI64:$d), (ins RegI64:$a), "mov.u64\t$d, $a", []>;
   def MOVF32rr
-    : InstPTX<(outs RegF32:$d),  (ins RegF32:$a),  "mov.f32\t$d, $a", []>;
+    : InstPTX<(outs RegF32:$d), (ins RegF32:$a), "mov.f32\t$d, $a", []>;
   def MOVF64rr
-    : InstPTX<(outs RegF64:$d),  (ins RegF64:$a),  "mov.f64\t$d, $a", []>;
+    : InstPTX<(outs RegF64:$d), (ins RegF64:$a), "mov.f64\t$d, $a", []>;
 }
 
 let isReMaterializable = 1, isAsCheapAsAMove = 1 in {
   def MOVPREDri
     : InstPTX<(outs RegPred:$d), (ins i1imm:$a), "mov.pred\t$d, $a",
               [(set RegPred:$d, imm:$a)]>;
-  def MOVU8ri
-    : InstPTX<(outs RegI8:$d),  (ins i8imm:$a),  "mov.u8\t$d, $a",
-              [(set RegI8:$d, imm:$a)]>;
   def MOVU16ri
     : InstPTX<(outs RegI16:$d), (ins i16imm:$a), "mov.u16\t$d, $a",
               [(set RegI16:$d, imm:$a)]>;
@@ -845,9 +850,6 @@ let hasSideEffects = 1 in {
   def LDpiPred : InstPTX<(outs RegPred:$d), (ins MEMpi:$a),
                          "ld.param.pred\t$d, [$a]",
                          [(set RegPred:$d, (PTXloadparam timm:$a))]>;
-  def LDpiU8   : InstPTX<(outs RegI8:$d), (ins MEMpi:$a),
-                         "ld.param.u8\t$d, [$a]",
-                         [(set RegI8:$d,  (PTXloadparam timm:$a))]>;
   def LDpiU16  : InstPTX<(outs RegI16:$d), (ins MEMpi:$a),
                          "ld.param.u16\t$d, [$a]",
                          [(set RegI16:$d, (PTXloadparam timm:$a))]>;
@@ -867,9 +869,6 @@ let hasSideEffects = 1 in {
   def STpiPred : InstPTX<(outs), (ins MEMret:$d, RegPred:$a),
                          "st.param.pred\t[$d], $a",
                          [(PTXstoreparam timm:$d, RegPred:$a)]>;
-  def STpiU8   : InstPTX<(outs), (ins MEMret:$d, RegI8:$a),
-                         "st.param.u8\t[$d], $a",
-                         [(PTXstoreparam timm:$d, RegI8:$a)]>;
   def STpiU16  : InstPTX<(outs), (ins MEMret:$d, RegI16:$a),
                          "st.param.u16\t[$d], $a",
                          [(PTXstoreparam timm:$d, RegI16:$a)]>;
@@ -900,62 +899,34 @@ defm STs : PTX_ST_ALL<"st.shared", store_shared>;
 // PTX does not directly support converting to a predicate type, so we fake it
 // by performing a greater-than test between the value and zero.  This follows
 // the C convention that any non-zero value is equivalent to 'true'.
-def CVT_pred_u8
-  : InstPTX<(outs RegPred:$d), (ins RegI8:$a), "setp.gt.b8\t$d, $a, 0",
-            [(set RegPred:$d, (trunc RegI8:$a))]>;
-
 def CVT_pred_u16
-  : InstPTX<(outs RegPred:$d), (ins RegI16:$a), "setp.gt.b16\t$d, $a, 0",
+  : InstPTX<(outs RegPred:$d), (ins RegI16:$a), "setp.gt.u16\t$d, $a, 0",
             [(set RegPred:$d, (trunc RegI16:$a))]>;
 
 def CVT_pred_u32
-  : InstPTX<(outs RegPred:$d), (ins RegI32:$a), "setp.gt.b32\t$d, $a, 0",
+  : InstPTX<(outs RegPred:$d), (ins RegI32:$a), "setp.gt.u32\t$d, $a, 0",
             [(set RegPred:$d, (trunc RegI32:$a))]>;
 
 def CVT_pred_u64
-  : InstPTX<(outs RegPred:$d), (ins RegI64:$a), "setp.gt.b64\t$d, $a, 0",
+  : InstPTX<(outs RegPred:$d), (ins RegI64:$a), "setp.gt.u64\t$d, $a, 0",
             [(set RegPred:$d, (trunc RegI64:$a))]>;
 
 def CVT_pred_f32
-  : InstPTX<(outs RegPred:$d), (ins RegF32:$a), "setp.gt.b32\t$d, $a, 0",
+  : InstPTX<(outs RegPred:$d), (ins RegF32:$a), "setp.gt.f32\t$d, $a, 0",
             [(set RegPred:$d, (fp_to_uint RegF32:$a))]>;
 
 def CVT_pred_f64
-  : InstPTX<(outs RegPred:$d), (ins RegF64:$a), "setp.gt.b64\t$d, $a, 0",
+  : InstPTX<(outs RegPred:$d), (ins RegF64:$a), "setp.gt.f64\t$d, $a, 0",
             [(set RegPred:$d, (fp_to_uint RegF64:$a))]>;
 
-// Conversion to u8
-// PTX does not directly support converting a predicate to a value, so we
-// use a select instruction to select either 0 or 1 (integer or fp) based
-// on the truth value of the predicate.
-def CVT_u8_pred
-  : InstPTX<(outs RegI8:$d), (ins RegPred:$a), "selp.u8\t$d, 1, 0, $a",
-            [(set RegI8:$d, (zext RegPred:$a))]>;
-
-def CVT_u8_preds
-  : InstPTX<(outs RegI8:$d), (ins RegPred:$a), "selp.u8\t$d, 1, 0, $a",
-            [(set RegI8:$d, (sext RegPred:$a))]>;
-
-def CVT_u8_u32
-  : InstPTX<(outs RegI8:$d), (ins RegI32:$a), "cvt.u8.u32\t$d, $a",
-            [(set RegI8:$d, (trunc RegI32:$a))]>;
-
-def CVT_u8_u64
-  : InstPTX<(outs RegI8:$d), (ins RegI64:$a), "cvt.u8.u64\t$d, $a",
-            [(set RegI8:$d, (trunc RegI64:$a))]>;
-
-def CVT_u8_f32
-  : InstPTX<(outs RegI8:$d), (ins RegF32:$a), "cvt.rzi.u8.f32\t$d, $a",
-            [(set RegI8:$d, (fp_to_uint RegF32:$a))]>;
-
-def CVT_u8_f64
-  : InstPTX<(outs RegI8:$d), (ins RegF64:$a), "cvt.rzi.u8.f64\t$d, $a",
-            [(set RegI8:$d, (fp_to_uint RegF64:$a))]>;
-
 // Conversion to u16
 // PTX does not directly support converting a predicate to a value, so we
 // use a select instruction to select either 0 or 1 (integer or fp) based
 // on the truth value of the predicate.
+def CVT_u16_preda
+  : InstPTX<(outs RegI16:$d), (ins RegPred:$a), "selp.u16\t$d, 1, 0, $a",
+            [(set RegI16:$d, (anyext RegPred:$a))]>;
+
 def CVT_u16_pred
   : InstPTX<(outs RegI16:$d), (ins RegPred:$a), "selp.u16\t$d, 1, 0, $a",
             [(set RegI16:$d, (zext RegPred:$a))]>;
@@ -964,14 +935,6 @@ def CVT_u16_preds
   : InstPTX<(outs RegI16:$d), (ins RegPred:$a), "selp.u16\t$d, 1, 0, $a",
             [(set RegI16:$d, (sext RegPred:$a))]>;
 
-def CVT_u16_u8
-  : InstPTX<(outs RegI16:$d), (ins RegI8:$a), "cvt.u16.u8\t$d, $a",
-            [(set RegI16:$d, (zext RegI8:$a))]>;
-
-def CVT_u16_s8
-  : InstPTX<(outs RegI16:$d), (ins RegI8:$a), "cvt.u16.s8\t$d, $a",
-            [(set RegI16:$d, (sext RegI8:$a))]>;
-
 def CVT_u16_u32
   : InstPTX<(outs RegI16:$d), (ins RegI32:$a), "cvt.u16.u32\t$d, $a",
             [(set RegI16:$d, (trunc RegI32:$a))]>;
@@ -994,9 +957,9 @@ def CVT_u32_pred
   : InstPTX<(outs RegI32:$d), (ins RegPred:$a), "selp.u32\t$d, 1, 0, $a",
             [(set RegI32:$d, (zext RegPred:$a))]>;
 
-def CVT_u32_u8
-  : InstPTX<(outs RegI32:$d), (ins RegI8:$a), "cvt.u32.u8\t$d, $a",
-            [(set RegI32:$d, (zext RegI8:$a))]>;
+def CVT_u32_b16
+  : InstPTX<(outs RegI32:$d), (ins RegI16:$a), "cvt.u32.u16\t$d, $a",
+            [(set RegI32:$d, (anyext RegI16:$a))]>;
 
 def CVT_u32_u16
   : InstPTX<(outs RegI32:$d), (ins RegI16:$a), "cvt.u32.u16\t$d, $a",
@@ -1006,10 +969,6 @@ def CVT_u32_preds
   : InstPTX<(outs RegI32:$d), (ins RegPred:$a), "selp.u32\t$d, 1, 0, $a",
             [(set RegI32:$d, (sext RegPred:$a))]>;
 
-def CVT_u32_s8
-  : InstPTX<(outs RegI32:$d), (ins RegI8:$a), "cvt.u32.s8\t$d, $a",
-            [(set RegI32:$d, (zext RegI8:$a))]>;
-
 def CVT_u32_s16
   : InstPTX<(outs RegI32:$d), (ins RegI16:$a), "cvt.u32.s16\t$d, $a",
             [(set RegI32:$d, (sext RegI16:$a))]>;
@@ -1032,30 +991,22 @@ def CVT_u64_pred
   : InstPTX<(outs RegI64:$d), (ins RegPred:$a), "selp.u64\t$d, 1, 0, $a",
             [(set RegI64:$d, (zext RegPred:$a))]>;
 
-def CVT_u64_u8
-  : InstPTX<(outs RegI64:$d), (ins RegI8:$a), "cvt.u64.u8\t$d, $a",
-            [(set RegI64:$d, (zext RegI8:$a))]>;
-
-def CVT_u64_u16
-  : InstPTX<(outs RegI64:$d), (ins RegI16:$a), "cvt.u64.u16\t$d, $a",
-            [(set RegI64:$d, (zext RegI16:$a))]>;
-
-def CVT_u64_u32
-  : InstPTX<(outs RegI64:$d), (ins RegI32:$a), "cvt.u64.u32\t$d, $a",
-            [(set RegI64:$d, (zext RegI32:$a))]>;
-
 def CVT_u64_preds
   : InstPTX<(outs RegI64:$d), (ins RegPred:$a), "selp.u64\t$d, 1, 0, $a",
             [(set RegI64:$d, (sext RegPred:$a))]>;
 
-def CVT_u64_s8
-  : InstPTX<(outs RegI64:$d), (ins RegI8:$a), "cvt.u64.s8\t$d, $a",
-            [(set RegI64:$d, (zext RegI8:$a))]>;
+def CVT_u64_u16
+  : InstPTX<(outs RegI64:$d), (ins RegI16:$a), "cvt.u64.u16\t$d, $a",
+            [(set RegI64:$d, (zext RegI16:$a))]>;
 
 def CVT_u64_s16
   : InstPTX<(outs RegI64:$d), (ins RegI16:$a), "cvt.u64.s16\t$d, $a",
             [(set RegI64:$d, (sext RegI16:$a))]>;
 
+def CVT_u64_u32
+  : InstPTX<(outs RegI64:$d), (ins RegI32:$a), "cvt.u64.u32\t$d, $a",
+            [(set RegI64:$d, (zext RegI32:$a))]>;
+
 def CVT_u64_s32
   : InstPTX<(outs RegI64:$d), (ins RegI32:$a), "cvt.u64.s32\t$d, $a",
             [(set RegI64:$d, (sext RegI32:$a))]>;
@@ -1075,10 +1026,6 @@ def CVT_f32_pred
             "selp.f32\t$d, 0F3F800000, 0F00000000, $a",  // 1.0
             [(set RegF32:$d, (uint_to_fp RegPred:$a))]>;
 
-def CVT_f32_u8
-  : InstPTX<(outs RegF32:$d), (ins RegI8:$a), "cvt.rn.f32.u8\t$d, $a",
-            [(set RegF32:$d, (uint_to_fp RegI8:$a))]>;
-
 def CVT_f32_u16
   : InstPTX<(outs RegF32:$d), (ins RegI16:$a), "cvt.rn.f32.u16\t$d, $a",
             [(set RegF32:$d, (uint_to_fp RegI16:$a))]>;
@@ -1102,10 +1049,6 @@ def CVT_f64_pred
             "selp.f64\t$d, 0D3F80000000000000, 0D0000000000000000, $a",  // 1.0
             [(set RegF64:$d, (uint_to_fp RegPred:$a))]>;
 
-def CVT_f64_u8
-  : InstPTX<(outs RegF64:$d), (ins RegI8:$a), "cvt.rn.f64.u8\t$d, $a",
-            [(set RegF64:$d, (uint_to_fp RegI8:$a))]>;
-
 def CVT_f64_u16
   : InstPTX<(outs RegF64:$d), (ins RegI16:$a), "cvt.rn.f64.u16\t$d, $a",
             [(set RegF64:$d, (uint_to_fp RegI16:$a))]>;
@@ -1142,10 +1085,13 @@ let isReturn = 1, isTerminator = 1, isBarrier = 1 in {
   def RET  : InstPTX<(outs), (ins), "ret",  [(PTXret)]>;
 }
 
+let hasSideEffects = 1 in {
+  def CALL : InstPTX<(outs), (ins), "call", [(PTXcall)]>;
+}
+
+
 ///===- Spill Instructions ------------------------------------------------===//
 // Special instructions used for stack spilling
-def STACKSTOREI8  : InstPTX<(outs), (ins i32imm:$d, RegI8:$a),
-                            "mov.u8\ts$d, $a", []>;
 def STACKSTOREI16 : InstPTX<(outs), (ins i32imm:$d, RegI16:$a),
                             "mov.u16\ts$d, $a", []>;
 def STACKSTOREI32 : InstPTX<(outs), (ins i32imm:$d, RegI32:$a),
@@ -1157,8 +1103,6 @@ def STACKSTOREF32 : InstPTX<(outs), (ins i32imm:$d, RegF32:$a),
 def STACKSTOREF64 : InstPTX<(outs), (ins i32imm:$d, RegF64:$a),
                             "mov.f64\ts$d, $a", []>;
 
-def STACKLOADI8  : InstPTX<(outs), (ins RegI8:$d, i32imm:$a),
-                           "mov.u8\t$d, s$a", []>;
 def STACKLOADI16 : InstPTX<(outs), (ins RegI16:$d, i32imm:$a),
                            "mov.u16\t$d, s$a", []>;
 def STACKLOADI32 : InstPTX<(outs), (ins RegI32:$d, i32imm:$a),
@@ -1170,6 +1114,15 @@ def STACKLOADF32 : InstPTX<(outs), (ins RegF32:$d, i32imm:$a),
 def STACKLOADF64 : InstPTX<(outs), (ins RegF64:$d, i32imm:$a),
                            "mov.f64\t$d, s$a", []>;
 
+
+// Call handling
+// def ADJCALLSTACKUP :
+//   InstPTX<(outs), (ins i32imm:$amt1, i32imm:$amt2), "",
+//           [(PTXcallseq_end timm:$amt1, timm:$amt2)]>;
+// def ADJCALLSTACKDOWN :
+//   InstPTX<(outs), (ins i32imm:$amt), "",
+//           [(PTXcallseq_start timm:$amt)]>;
+
 ///===- Intrinsic Instructions --------------------------------------------===//
 
 include "PTXIntrinsicInstrInfo.td"