@@ -184,6 +184,18 @@ class OneUse2<SDPatternOperator operator>
184184class fpimm_pos_inf<ValueType vt>
185185    : FPImmLeaf<vt, [{ return Imm.isPosInfinity(); }]>;
186186
187+ 
188+ 
189+ // Operands which can hold a Register or an Immediate.
190+ //
191+ // Unfortunately, since most register classes can hold multiple types, we must
192+ // use the 'Any' type for these.
193+ 
194+ def RI1  : Operand<i1>;
195+ def RI16 : Operand<Any>;
196+ def RI32 : Operand<Any>;
197+ def RI64 : Operand<Any>;
198+ 
187199// Utility class to wrap up information about a register and DAG type for more
188200// convenient iteration and parameterization
189201class RegTyInfo<ValueType ty, NVPTXRegClass rc, Operand imm, SDNode imm_node,
@@ -2276,19 +2288,20 @@ let mayLoad=1, hasSideEffects=0 in {
22762288  def LD_i64 : LD<B64>;
22772289}
22782290
2279- class ST<NVPTXRegClass regclass >
2291+ class ST<DAGOperand O >
22802292  : NVPTXInst<
22812293    (outs),
2282-     (ins regclass:$src, LdStCode:$sem, LdStCode:$scope, LdStCode:$addsp,
2283-          LdStCode:$Sign, i32imm:$toWidth, ADDR:$addr),
2284-     "st${sem:sem}${scope:scope}${addsp:addsp}.${Sign:sign}$toWidth"
2294+     (ins O:$src,
2295+          LdStCode:$sem, LdStCode:$scope, LdStCode:$addsp, i32imm:$toWidth,
2296+          ADDR:$addr),
2297+     "st${sem:sem}${scope:scope}${addsp:addsp}.b$toWidth"
22852298    " \t[$addr], $src;", []>;
22862299
22872300let mayStore=1, hasSideEffects=0 in {
2288-   def ST_i8  : ST<B16 >;
2289-   def ST_i16 : ST<B16 >;
2290-   def ST_i32 : ST<B32 >;
2291-   def ST_i64 : ST<B64 >;
2301+   def ST_i8  : ST<RI16 >;
2302+   def ST_i16 : ST<RI16 >;
2303+   def ST_i32 : ST<RI32 >;
2304+   def ST_i64 : ST<RI64 >;
22922305}
22932306
22942307// The following is used only in and after vector elementizations.  Vector
@@ -2324,38 +2337,38 @@ let mayLoad=1, hasSideEffects=0 in {
23242337  defm LDV_i64 : LD_VEC<B64>;
23252338}
23262339
2327- multiclass ST_VEC<NVPTXRegClass regclass , bit support_v8 = false> {
2340+ multiclass ST_VEC<DAGOperand O , bit support_v8 = false> {
23282341  def _v2 : NVPTXInst<
23292342    (outs),
2330-     (ins regclass :$src1, regclass :$src2, LdStCode:$sem, LdStCode:$scope ,
2331-          LdStCode:$addsp , LdStCode:$Sign , i32imm:$fromWidth,
2343+     (ins O :$src1, O :$src2,
2344+          LdStCode:$sem , LdStCode:$scope, LdStCode:$addsp , i32imm:$fromWidth,
23322345         ADDR:$addr),
2333-     "st${sem:sem}${scope:scope}${addsp:addsp}.v2.${Sign:sign} $fromWidth "
2346+     "st${sem:sem}${scope:scope}${addsp:addsp}.v2.b $fromWidth "
23342347    "\t[$addr], {{$src1, $src2}};", []>;
23352348  def _v4 : NVPTXInst<
23362349    (outs),
2337-     (ins regclass :$src1, regclass :$src2, regclass :$src3, regclass :$src4,
2338-          LdStCode:$sem, LdStCode:$scope, LdStCode:$addsp,
2339-          LdStCode:$Sign, i32imm:$fromWidth,  ADDR:$addr),
2340-     "st${sem:sem}${scope:scope}${addsp:addsp}.v4.${Sign:sign} $fromWidth "
2350+     (ins O :$src1, O :$src2, O :$src3, O :$src4,
2351+          LdStCode:$sem, LdStCode:$scope, LdStCode:$addsp, i32imm:$fromWidth, 
2352+          ADDR:$addr),
2353+     "st${sem:sem}${scope:scope}${addsp:addsp}.v4.b $fromWidth "
23412354    "\t[$addr], {{$src1, $src2, $src3, $src4}};", []>;
23422355  if support_v8 then
23432356    def _v8 : NVPTXInst<
23442357      (outs),
2345-       (ins regclass :$src1, regclass :$src2, regclass :$src3, regclass :$src4,
2346-            regclass :$src5, regclass :$src6, regclass :$src7, regclass :$src8,
2347-            LdStCode:$sem, LdStCode:$scope, LdStCode:$addsp, LdStCode:$Sign, 
2348-            i32imm:$fromWidth,  ADDR:$addr),
2349-       "st${sem:sem}${scope:scope}${addsp:addsp}.v8.${Sign:sign} $fromWidth "
2358+       (ins O :$src1, O :$src2, O :$src3, O :$src4,
2359+            O :$src5, O :$src6, O :$src7, O :$src8,
2360+            LdStCode:$sem, LdStCode:$scope, LdStCode:$addsp, i32imm:$fromWidth,  
2361+            ADDR:$addr),
2362+       "st${sem:sem}${scope:scope}${addsp:addsp}.v8.b $fromWidth "
23502363      "\t[$addr], "
23512364      "{{$src1, $src2, $src3, $src4, $src5, $src6, $src7, $src8}};", []>;
23522365}
23532366
23542367let mayStore=1, hasSideEffects=0 in {
2355-   defm STV_i8  : ST_VEC<B16 >;
2356-   defm STV_i16 : ST_VEC<B16 >;
2357-   defm STV_i32 : ST_VEC<B32 , support_v8 = true>;
2358-   defm STV_i64 : ST_VEC<B64 >;
2368+   defm STV_i8  : ST_VEC<RI16 >;
2369+   defm STV_i16 : ST_VEC<RI16 >;
2370+   defm STV_i32 : ST_VEC<RI32 , support_v8 = true>;
2371+   defm STV_i64 : ST_VEC<RI64 >;
23592372}
23602373
23612374//---- Conversion ----
0 commit comments