From: James Y Knight Date: Tue, 31 Jan 2023 21:33:31 +0000 (-0500) Subject: [VE] Fix useDeprecatedPositionallyEncodedOperands errors. X-Git-Tag: upstream/17.0.6~18986 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=61e9e6199e2ef8620f0a2c4f30dafec6b7843565;p=platform%2Fupstream%2Fllvm.git [VE] Fix useDeprecatedPositionallyEncodedOperands errors. This is a follow-on to https://reviews.llvm.org/D134073. Behavior is unchanged by this cleanup, except that previously the 'CVTRDm' pattern was accidentally getting the top bit of 'sz' from the 'sx' input, instead of setting it to 0. Differential Revision: https://reviews.llvm.org/D140922 --- diff --git a/llvm/lib/Target/VE/VE.td b/llvm/lib/Target/VE/VE.td index 16d6c36..1cb4a64 100644 --- a/llvm/lib/Target/VE/VE.td +++ b/llvm/lib/Target/VE/VE.td @@ -30,9 +30,7 @@ include "VERegisterInfo.td" include "VECallingConv.td" include "VEInstrInfo.td" -def VEInstrInfo : InstrInfo { - let useDeprecatedPositionallyEncodedOperands = 1; -} +def VEInstrInfo : InstrInfo {} def VEAsmParser : AsmParser { // Use both VE register name matcher to accept "S0~S63" register names diff --git a/llvm/lib/Target/VE/VEInstrFormats.td b/llvm/lib/Target/VE/VEInstrFormats.td index f43c975..a2d2ae92 100644 --- a/llvm/lib/Target/VE/VEInstrFormats.td +++ b/llvm/lib/Target/VE/VEInstrFormats.td @@ -117,7 +117,7 @@ class CFopVal, dag outs, dag ins, string asmstr, list pattern = []> bits<1> cx = 0; bits<1> cx2 = 0; bits<2> bpf = 0; - bits<4> cf; + bits<4> cond; bits<1> cy = 1; bits<7> sy; bits<1> cz = 1; @@ -127,7 +127,7 @@ class CFopVal, dag outs, dag ins, string asmstr, list pattern = []> let Inst{55} = cx; let Inst{54} = cx2; let Inst{53-52} = bpf; - let Inst{51-48} = cf; + let Inst{51-48} = cond; let Inst{47} = cy; let Inst{46-40} = sy; let Inst{39} = cz; diff --git a/llvm/lib/Target/VE/VEInstrInfo.td b/llvm/lib/Target/VE/VEInstrInfo.td index 40cfa4b..6598aba 100644 --- a/llvm/lib/Target/VE/VEInstrInfo.td +++ b/llvm/lib/Target/VE/VEInstrInfo.td @@ -760,14 +760,14 @@ multiclass CVTRDm opc, RegisterClass RCo, def r : RR { bits<4> rd; - let sz{5-4} = 0; + let sz{6-4} = 0; let sz{3-0} = rd; } let cy = 0 in def i : RR { bits<4> rd; - let sz{5-4} = 0; + let sz{6-4} = 0; let sz{3-0} = rd; } } @@ -790,33 +790,33 @@ multiclass CVTm opc, RegisterClass RCo, ValueType Tyo, // e.g. PFCH let sx = 0, hasSideEffects = 0 in multiclass PFCHmopc> { - def rri : RM; let cy = 0 in - def rii : RM; let cz = 0 in - def zri : RM; let cy = 0, cz = 0 in - def zii : RM; } // Multiclass for CAS instructions. // e.g. TS1AML, TS1AMW, TS2AM, and etc. -let Constraints = "$dest = $sd", DisableEncoding = "$sd", +let Constraints = "$sx = $sd", DisableEncoding = "$sd", mayStore=1, mayLoad = 1, hasSideEffects = 0 in multiclass RRCAStgmopc, RegisterClass RC, ValueType Ty, Operand immOp, Operand MEM, ComplexPattern ADDR, SDPatternOperator OpNode = null_frag> { - def r : RRM; + def r : RRM; let cy = 0 in - def i : RRM; + def i : RRM; } multiclass RRCASmopc, RegisterClass RC, ValueType Ty, Operand immOp, SDPatternOperator OpNode = null_frag> { @@ -831,13 +831,13 @@ let isBranch = 1, isTerminator = 1, isIndirectBranch = 1, hasSideEffects = 0 in multiclass BCbpfm opc, dag cond, Operand ADDR> { let bpf = 0 /* NONE */ in - def "" : CF; let bpf = 2 /* NOT TAKEN */ in - def _nt : CF; let bpf = 3 /* TAKEN */ in - def _t : CF; } multiclass BCtgm opc, dag cond> { @@ -847,14 +847,14 @@ multiclass BCtgm opc, dag cond> { multiclass BCm opc, RegisterClass RC, Operand immOp> { let DecoderMethod = "DecodeBranchCondition" in - defm r : BCtgm; + defm r : BCtgm; let DecoderMethod = "DecodeBranchCondition", cy = 0 in - defm i : BCtgm; + defm i : BCtgm; let DecoderMethod = "DecodeBranchConditionAlways", cy = 0, sy = 0, - cf = 15 /* AT */, isBarrier = 1 in + cond = 15 /* AT */, isBarrier = 1 in defm a : BCtgm; let DecoderMethod = "DecodeBranchConditionAlways", cy = 0, sy = 0, - cf = 0 /* AF */ in + cond = 0 /* AF */ in defm na : BCtgm; } @@ -874,19 +874,19 @@ multiclass BCRbpfm opc, dag cond> { } multiclass BCRm opc, RegisterClass RC, Operand immOp, Operand zeroOp> { - defm rr : BCRbpfm; + defm rr : BCRbpfm; let cy = 0 in - defm ir : BCRbpfm; let cz = 0 in - defm rz : BCRbpfm; let cy = 0, cz = 0 in - defm iz : BCRbpfm; - let cy = 0, sy = 0, cz = 0, sz = 0, cf = 15 /* AT */, isBarrier = 1 in + let cy = 0, sy = 0, cz = 0, sz = 0, cond = 15 /* AT */, isBarrier = 1 in defm a : BCRbpfm; - let cy = 0, sy = 0, cz = 0, sz = 0, cf = 0 /* AF */ in + let cy = 0, sy = 0, cz = 0, sz = 0, cond = 0 /* AF */ in defm na : BCRbpfm; } @@ -947,20 +947,20 @@ multiclass FIDCRmopc, RegisterClass RC> { // Multiclass for LHM instruction. let mayLoad = 1, hasSideEffects = 0 in multiclass LHMm opc, RegisterClass RC> { - def ri : RRMHM; + def ri : RRMHM; let cz = 0 in - def zi : RRMHM; + def zi : RRMHM; } // Multiclass for SHM instruction. let mayStore = 1, hasSideEffects = 0 in multiclass SHMm opc, RegisterClass RC> { - def ri : RRMHM; let cz = 0 in - def zi : RRMHM; } @@ -978,17 +978,17 @@ multiclass SHMm opc, RegisterClass RC> { // Multiclass for generic RM instructions multiclass RMmopc, RegisterClass RC, bit MoveImm = 0> { - def rri : RM; + def rri : RM; let cy = 0 in - def rii : RM; + def rii : RM; let cz = 0 in - def zri : RM; + def zri : RM; let cy = 0, cz = 0 in - def zii : RM { + def zii : RM { // VE uses LEAzii and LEASLzii as a move immediate instruction, so declare // it here. An instruction declared as MoveImm will be optimized in // FoldImmediate later. @@ -1014,21 +1014,21 @@ def : Pat<(add I64:$base, lozero:$disp), (LEASLrii $base, 0, (HI32 $disp))>; let mayLoad = 1, hasSideEffects = 0 in multiclass LOADm opc, RegisterClass RC, ValueType Ty, SDPatternOperator OpNode = null_frag> { - def rri : RM; + def rri : RM; let cy = 0 in - def rii : RM; + def rii : RM; let cz = 0 in - def zri : RM; + def zri : RM; let cy = 0, cz = 0 in - def zii : RM; + def zii : RM; } // Section 8.2.2 - LDS @@ -1072,19 +1072,19 @@ let mayLoad = 1, hasSideEffects = 0 in { let mayStore = 1 in multiclass STOREm opc, RegisterClass RC, ValueType Ty, SDPatternOperator OpNode = null_frag> { - def rri : RM; let cy = 0 in - def rii : RM; let cz = 0 in - def zri : RM; let cy = 0, cz = 0 in - def zii : RM; } @@ -1463,7 +1463,7 @@ def : Pat<(brind I64:$reg), (BCFLari_t $reg, 0)>; def : Pat<(brind tblockaddress:$imm), (BCFLazi_t 0, $imm)>; // Return instruction is a special case of jump. -let Uses = [SX10], bpf = 3 /* TAKEN */, cf = 15 /* AT */, cy = 0, sy = 0, +let Uses = [SX10], bpf = 3 /* TAKEN */, cond = 15 /* AT */, cy = 0, sy = 0, sz = 10 /* SX10 */, imm32 = 0, isReturn = 1, isTerminator = 1, isBarrier = 1, isCodeGenOnly = 1, hasSideEffects = 0 in def RET : CF<0x19, (outs), (ins), "b.l.t (, %s10)", [(retflag)]>; @@ -1478,13 +1478,13 @@ defm BCFS : BCm<"b${cond}.s", "b.s", "baf.s", 0x1C, F32, simm7fp>; // Section 8.8.4 - BCR (Branch on Condition Relative) let cx = 0, cx2 = 0 in -defm BRCFL : BCRm<"br${cf}.l", "br.l", "braf.l", 0x18, I64, simm7, zero>; +defm BRCFL : BCRm<"br${cond}.l", "br.l", "braf.l", 0x18, I64, simm7, zero>; let cx = 1, cx2 = 0 in -defm BRCFW : BCRm<"br${cf}.w", "br.w", "braf.w", 0x18, I32, simm7, zero>; +defm BRCFW : BCRm<"br${cond}.w", "br.w", "braf.w", 0x18, I32, simm7, zero>; let cx = 0, cx2 = 1 in -defm BRCFD : BCRm<"br${cf}.d", "br.d", "braf.d", 0x18, I64, simm7fp, zerofp>; +defm BRCFD : BCRm<"br${cond}.d", "br.d", "braf.d", 0x18, I64, simm7fp, zerofp>; let cx = 1, cx2 = 1 in -defm BRCFS : BCRm<"br${cf}.s", "br.s", "braf.s", 0x18, F32, simm7fp, zerofp>; +defm BRCFS : BCRm<"br${cond}.s", "br.s", "braf.s", 0x18, F32, simm7fp, zerofp>; // Section 8.8.5 - BSIC (Branch and Save IC) let isCall = 1, hasSideEffects = 0, DecoderMethod = "DecodeCall" in