@@ -5581,6 +5581,20 @@ class t2LOL<dag oops, dag iops, string asm, string ops>
55815581 let Predicates = [IsThumb2, HasV8_1MMainline, HasLOB];
55825582}
55835583
5584+ def arm_wlssetup
5585+ : SDNode<"ARMISD::WLSSETUP",
5586+ SDTypeProfile<1, 1, [SDTCisInt<0>, SDTCisSameAs<1, 0>]>>;
5587+
5588+ def arm_wls : SDNode<"ARMISD::WLS",
5589+ SDTypeProfile<0, 2, [SDTCisInt<0>, SDTCisVT<1, OtherVT>]>,
5590+ [SDNPHasChain]>;
5591+
5592+ def arm_loop_dec : SDNode<"ARMISD::LOOP_DEC", SDTIntBinOp, [SDNPHasChain]>;
5593+
5594+ def arm_le : SDNode<"ARMISD::LE",
5595+ SDTypeProfile<0, 2, [SDTCisInt<0>, SDTCisVT<1, OtherVT>]>,
5596+ [SDNPHasChain]>;
5597+
55845598let isNotDuplicable = 1 in {
55855599def t2WLS : t2LOL<(outs GPRlr:$LR),
55865600 (ins rGPR:$Rn, wlslabel_u11:$label),
@@ -5651,24 +5665,26 @@ def t2DoLoopStartTP :
56515665// valid after reg alloc, as it should be lowered during MVETPAndVPTOptimisations
56525666// into a t2WhileLoopStartLR (or expanded).
56535667def t2WhileLoopSetup :
5654- t2PseudoInst<(outs GPRlr:$lr), (ins rGPR:$tc), 4, IIC_Br, []>;
5668+ t2PseudoInst<(outs GPRlr:$lr), (ins rGPR:$tc), 4, IIC_Br,
5669+ [(set i32:$lr, (arm_wlssetup i32:$tc))]>;
56555670
56565671// A pseudo to represent the decrement in a low overhead loop. A t2LoopDec and
56575672// t2LoopEnd together represent a LE instruction. Ideally these are converted
56585673// to a t2LoopEndDec which is lowered as a single instruction.
56595674let hasSideEffects = 0 in
56605675def t2LoopDec :
5661- t2PseudoInst<(outs GPRlr:$Rm), (ins GPRlr:$Rn, imm0_7:$size),
5662- 4, IIC_Br, []>, Sched<[WriteBr]>;
5676+ t2PseudoInst<(outs GPRlr:$Rm), (ins GPRlr:$Rn, imm0_7:$size), 4, IIC_Br,
5677+ [(set i32:$Rm, (arm_loop_dec i32:$Rn, timm:$size))]>,
5678+ Sched<[WriteBr]>;
56635679
56645680let isBranch = 1, isTerminator = 1, hasSideEffects = 1, Defs = [CPSR] in {
56655681// The branch in a t2WhileLoopSetup/t2WhileLoopStart pair, eventually turned
56665682// into a t2WhileLoopStartLR that does both the LR setup and branch.
56675683def t2WhileLoopStart :
56685684 t2PseudoInst<(outs),
56695685 (ins GPRlr:$tc, brtarget:$target),
5670- 4, IIC_Br, []>,
5671- Sched<[WriteBr]>;
5686+ 4, IIC_Br, [(arm_wls i32:$tc, bb:$target) ]>,
5687+ Sched<[WriteBr]>;
56725688
56735689// WhileLoopStartLR that sets up LR and branches on zero, equivalent to WLS. It
56745690// is lowered in the ARMLowOverheadLoops pass providing the branches are within
@@ -5690,8 +5706,9 @@ def t2WhileLoopStartTP :
56905706
56915707// t2LoopEnd - the branch half of a t2LoopDec/t2LoopEnd pair.
56925708def t2LoopEnd :
5693- t2PseudoInst<(outs), (ins GPRlr:$tc, brtarget:$target),
5694- 8, IIC_Br, []>, Sched<[WriteBr]>;
5709+ t2PseudoInst<(outs), (ins GPRlr:$tc, brtarget:$target),
5710+ 8, IIC_Br, [(arm_le i32:$tc, bb:$target)]>,
5711+ Sched<[WriteBr]>;
56955712
56965713// The combination of a t2LoopDec and t2LoopEnd, performing both the LR
56975714// decrement and branch as a single instruction. Is lowered to a LE or
0 commit comments