From faf0152f73920d45851f2433e0a5dcb5e7c1006e Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Sat, 20 Mar 2021 10:36:51 -0700 Subject: [PATCH] [VE] Fix types of multiclass template arguments in TableGen files There were not properly checked before `[TableGen] Improve handling of template arguments`. --- lib/Target/VE/VEInstrInfo.td | 75 ++++++++++++++--------------- lib/Target/VE/VEInstrPatternsVec.td | 8 +-- 2 files changed, 41 insertions(+), 42 deletions(-) diff --git a/lib/Target/VE/VEInstrInfo.td b/lib/Target/VE/VEInstrInfo.td index b6862cf7b30..2f77daae713 100644 --- a/lib/Target/VE/VEInstrInfo.td +++ b/lib/Target/VE/VEInstrInfo.td @@ -793,7 +793,7 @@ multiclass PFCHmopc> { let Constraints = "$dest = $sd", DisableEncoding = "$sd", mayStore=1, mayLoad = 1, hasSideEffects = 0 in multiclass RRCAStgmopc, RegisterClass RC, ValueType Ty, - Operand immOp, Operand MEM, Operand ADDR, + Operand immOp, Operand MEM, ComplexPattern ADDR, SDPatternOperator OpNode = null_frag> { def r : RRM { + RM torri, + RM torii, + RM tozri, + RM tozii> { def : Pat<(i64 (from ADDRrri:$addr)), (INSERT_SUBREG (i64 (IMPLICIT_DEF)), (torri MEMrri:$addr), sub_i32)>; @@ -1748,10 +1748,10 @@ defm : EXT64m; // anyextload multiclass EXT32m { + RM torri, + RM torii, + RM tozri, + RM tozii> { def : Pat<(from ADDRrri:$addr), (torri MEMrri:$addr)>; def : Pat<(from ADDRrii:$addr), (torii MEMrii:$addr)>; def : Pat<(from ADDRzri:$addr), (tozri MEMzri:$addr)>; @@ -1762,10 +1762,10 @@ defm : EXT32m; // truncstore multiclass TRUNC64m { + RM torri, + RM torii, + RM tozri, + RM tozii> { def : Pat<(from i64:$src, ADDRrri:$addr), (torri MEMrri:$addr, (EXTRACT_SUBREG $src, sub_i32))>; def : Pat<(from i64:$src, ADDRrii:$addr), @@ -1781,8 +1781,8 @@ defm : TRUNC64m; // Atomic loads multiclass ATMLDm { + RM torri, RM torii, + RM tozri, RM tozii> { def : Pat<(from ADDRrri:$addr), (torri MEMrri:$addr)>; def : Pat<(from ADDRrii:$addr), (torii MEMrii:$addr)>; def : Pat<(from ADDRzri:$addr), (tozri MEMzri:$addr)>; @@ -1794,9 +1794,9 @@ defm : ATMLDm; defm : ATMLDm; // Optimized atomic loads with sext -multiclass SXATMLDm { +multiclass SXATMLDm { def : Pat<(i64 (sext_inreg (i64 (anyext (from ADDRrri:$addr))), TY)), (i2l (torri MEMrri:$addr))>; def : Pat<(i64 (sext_inreg (i64 (anyext (from ADDRrii:$addr))), TY)), @@ -1807,8 +1807,8 @@ multiclass SXATMLDm; } multiclass SXATMLD32m { + RM torri, RM torii, + RM tozri, RM tozii> { def : Pat<(i64 (sext (from ADDRrri:$addr))), (i2l (torri MEMrri:$addr))>; def : Pat<(i64 (sext (from ADDRrii:$addr))), @@ -1824,9 +1824,9 @@ defm : SXATMLDm; // Optimized atomic loads with zext -multiclass ZXATMLDm { +multiclass ZXATMLDm { def : Pat<(i64 (and (anyext (from ADDRrri:$addr)), VAL)), (i2l (torri MEMrri:$addr))>; def : Pat<(i64 (and (anyext (from ADDRrii:$addr)), VAL)), @@ -1836,9 +1836,9 @@ multiclass ZXATMLDm; } -multiclass ZXATMLD32m { +multiclass ZXATMLD32m { def : Pat<(i64 (zext (from ADDRrri:$addr))), (i2l (torri MEMrri:$addr))>; def : Pat<(i64 (zext (from ADDRrii:$addr))), @@ -1857,8 +1857,8 @@ defm : ZXATMLD32m { + RM torri, RM torii, + RM tozri, RM tozii> { def : Pat<(from ADDRrri:$addr, ty:$src), (torri MEMrri:$addr, $src)>; def : Pat<(from ADDRrii:$addr, ty:$src), (torii MEMrii:$addr, $src)>; def : Pat<(from ADDRzri:$addr, ty:$src), (tozri MEMzri:$addr, $src)>; @@ -1872,10 +1872,10 @@ defm : ATMSTm; // Optimized atomic stores with truncate multiclass TRATMSTm { + RM torri, + RM torii, + RM tozri, + RM tozii> { def : Pat<(from ADDRrri:$addr, (i32 (trunc i64:$src))), (torri MEMrri:$addr, (EXTRACT_SUBREG $src, sub_i32))>; def : Pat<(from ADDRrii:$addr, (i32 (trunc i64:$src))), @@ -1929,10 +1929,10 @@ def : Pat<(br bb:$addr), (BRCFLa bb:$addr)>; // brcc // integer brcc -multiclass BRCCIm { +multiclass BRCCIm { def : Pat<(brcc CCSIOp:$cond, ty:$l, simm7:$r, bb:$addr), (BrOpNode2 (icond2ccSwap $cond), (LO7 $r), $l, bb:$addr)>; def : Pat<(brcc CCSIOp:$cond, ty:$l, ty:$r, bb:$addr), @@ -1947,8 +1947,7 @@ defm : BRCCIm; defm : BRCCIm; // floating point brcc -multiclass BRCCFm { +multiclass BRCCFm { def : Pat<(brcc cond:$cond, ty:$l, simm7fp:$r, bb:$addr), (BrOpNode2 (fcond2ccSwap $cond), (LO7FP $r), $l, bb:$addr)>; def : Pat<(brcc cond:$cond, ty:$l, ty:$r, bb:$addr), diff --git a/lib/Target/VE/VEInstrPatternsVec.td b/lib/Target/VE/VEInstrPatternsVec.td index 0084876f9f1..dc3c913c918 100644 --- a/lib/Target/VE/VEInstrPatternsVec.td +++ b/lib/Target/VE/VEInstrPatternsVec.td @@ -16,7 +16,7 @@ //===----------------------------------------------------------------------===// multiclass vbrd_elem32 { + SDNodeXForm ImmCast, OutPatFrag SuperRegCast> { // VBRDil def : Pat<(v32 (vec_broadcast (s32 ImmOp:$sy), i32:$vl)), (VBRDil (ImmCast $sy), i32:$vl)>; @@ -38,8 +38,8 @@ multiclass vbrd_elem64 { + OutPatFrag SubRegCast, + OutPatFrag SuperRegCast> { // LVSvi def: Pat<(s32 (extractelt v32:$vec, uimm7:$idx)), (SubRegCast (LVSvi v32:$vec, (ULO7 $idx)))>; @@ -73,7 +73,7 @@ multiclass extract_insert_elem64 { multiclass patterns_elem32 { + OutPatFrag SubRegCast, OutPatFrag SuperRegCast> { defm : vbrd_elem32; defm : extract_insert_elem32; }