@@ -3027,8 +3027,12 @@ class BaseAddSubEReg64<bit isSub, bit setFlags, RegisterClass dstRegtype,
30273027
30283028// Aliases for register+register add/subtract.
30293029class AddSubRegAlias<string asm, Instruction inst, RegisterClass dstRegtype,
3030- RegisterClass src1Regtype, RegisterClass src2Regtype,
3031- int shiftExt>
3030+ RegisterClass src1Regtype, dag src2>
3031+ : InstAlias<asm#"\t$dst, $src1, $src2",
3032+ (inst dstRegtype:$dst, src1Regtype:$src1, src2)>;
3033+ class AddSubRegAlias64<string asm, Instruction inst, RegisterClass dstRegtype,
3034+ RegisterClass src1Regtype, RegisterClass src2Regtype,
3035+ int shiftExt>
30323036 : InstAlias<asm#"\t$dst, $src1, $src2",
30333037 (inst dstRegtype:$dst, src1Regtype:$src1, src2Regtype:$src2,
30343038 shiftExt)>;
@@ -3096,22 +3100,22 @@ multiclass AddSub<bit isSub, string mnemonic, string alias,
30963100
30973101 // Register/register aliases with no shift when SP is not used.
30983102 def : AddSubRegAlias<mnemonic, !cast<Instruction>(NAME#"Wrs"),
3099- GPR32, GPR32, GPR32, 0>;
3103+ GPR32, GPR32, (arith_shifted_reg32 GPR32:$src2 , 0) >;
31003104 def : AddSubRegAlias<mnemonic, !cast<Instruction>(NAME#"Xrs"),
3101- GPR64, GPR64, GPR64, 0>;
3105+ GPR64, GPR64, (arith_shifted_reg64 GPR64:$src2 , 0) >;
31023106
31033107 // Register/register aliases with no shift when either the destination or
31043108 // first source register is SP.
31053109 def : AddSubRegAlias<mnemonic, !cast<Instruction>(NAME#"Wrx"),
3106- GPR32sponly, GPR32sp, GPR32, 16>; // UXTW #0
3110+ GPR32sponly, GPR32sp,
3111+ (arith_extended_reg32_i32 GPR32:$src2, 16)>; // UXTW #0
31073112 def : AddSubRegAlias<mnemonic, !cast<Instruction>(NAME#"Wrx"),
3108- GPR32sp, GPR32sponly, GPR32, 16>; // UXTW #0
3109- def : AddSubRegAlias<mnemonic,
3110- !cast<Instruction>(NAME#"Xrx64"),
3111- GPR64sponly, GPR64sp, GPR64, 24>; // UXTX #0
3112- def : AddSubRegAlias<mnemonic,
3113- !cast<Instruction>(NAME#"Xrx64"),
3114- GPR64sp, GPR64sponly, GPR64, 24>; // UXTX #0
3113+ GPR32sp, GPR32sponly,
3114+ (arith_extended_reg32_i32 GPR32:$src2, 16)>; // UXTW #0
3115+ def : AddSubRegAlias64<mnemonic, !cast<Instruction>(NAME#"Xrx64"),
3116+ GPR64sponly, GPR64sp, GPR64, 24>; // UXTX #0
3117+ def : AddSubRegAlias64<mnemonic, !cast<Instruction>(NAME#"Xrx64"),
3118+ GPR64sp, GPR64sponly, GPR64, 24>; // UXTX #0
31153119}
31163120
31173121multiclass AddSubS<bit isSub, string mnemonic, SDNode OpNode, string cmp,
@@ -3175,15 +3179,19 @@ multiclass AddSubS<bit isSub, string mnemonic, SDNode OpNode, string cmp,
31753179 def : InstAlias<cmp#"\t$src, $imm", (!cast<Instruction>(NAME#"Xri")
31763180 XZR, GPR64sp:$src, addsub_shifted_imm64:$imm), 5>;
31773181 def : InstAlias<cmp#"\t$src1, $src2$sh", (!cast<Instruction>(NAME#"Wrx")
3178- WZR, GPR32sp:$src1, GPR32:$src2, arith_extend:$sh), 4>;
3182+ WZR, GPR32sp:$src1,
3183+ (arith_extended_reg32_i32 GPR32:$src2, arith_extend:$sh)), 4>;
31793184 def : InstAlias<cmp#"\t$src1, $src2$sh", (!cast<Instruction>(NAME#"Xrx")
3180- XZR, GPR64sp:$src1, GPR32:$src2, arith_extend:$sh), 4>;
3185+ XZR, GPR64sp:$src1,
3186+ (arith_extended_reg32_i64 GPR32:$src2, arith_extend:$sh)), 4>;
31813187 def : InstAlias<cmp#"\t$src1, $src2$sh", (!cast<Instruction>(NAME#"Xrx64")
31823188 XZR, GPR64sp:$src1, GPR64:$src2, arith_extendlsl64:$sh), 4>;
31833189 def : InstAlias<cmp#"\t$src1, $src2$sh", (!cast<Instruction>(NAME#"Wrs")
3184- WZR, GPR32:$src1, GPR32:$src2, arith_shift32:$sh), 4>;
3190+ WZR, GPR32:$src1,
3191+ (arith_shifted_reg32 GPR32:$src2, arith_shift32:$sh)), 4>;
31853192 def : InstAlias<cmp#"\t$src1, $src2$sh", (!cast<Instruction>(NAME#"Xrs")
3186- XZR, GPR64:$src1, GPR64:$src2, arith_shift64:$sh), 4>;
3193+ XZR, GPR64:$src1,
3194+ (arith_shifted_reg64 GPR64:$src2, arith_shift64:$sh)), 4>;
31873195
31883196 // Support negative immediates, e.g. cmp Rn, -imm -> cmn Rn, imm
31893197 def : InstSubst<cmpAlias#"\t$src, $imm", (!cast<Instruction>(NAME#"Wri")
@@ -3193,27 +3201,28 @@ multiclass AddSubS<bit isSub, string mnemonic, SDNode OpNode, string cmp,
31933201
31943202 // Compare shorthands
31953203 def : InstAlias<cmp#"\t$src1, $src2", (!cast<Instruction>(NAME#"Wrs")
3196- WZR, GPR32:$src1, GPR32:$src2, 0), 5>;
3204+ WZR, GPR32:$src1, (arith_shifted_reg32 GPR32:$src2, 0) ), 5>;
31973205 def : InstAlias<cmp#"\t$src1, $src2", (!cast<Instruction>(NAME#"Xrs")
3198- XZR, GPR64:$src1, GPR64:$src2, 0), 5>;
3206+ XZR, GPR64:$src1, (arith_shifted_reg64 GPR64:$src2, 0) ), 5>;
31993207 def : InstAlias<cmp#"\t$src1, $src2", (!cast<Instruction>(NAME#"Wrx")
3200- WZR, GPR32sponly:$src1, GPR32:$src2, 16), 5>;
3208+ WZR, GPR32sponly:$src1,
3209+ (arith_extended_reg32_i32 GPR32:$src2, 16)), 5>;
32013210 def : InstAlias<cmp#"\t$src1, $src2", (!cast<Instruction>(NAME#"Xrx64")
32023211 XZR, GPR64sponly:$src1, GPR64:$src2, 24), 5>;
32033212
32043213 // Register/register aliases with no shift when SP is not used.
32053214 def : AddSubRegAlias<mnemonic, !cast<Instruction>(NAME#"Wrs"),
3206- GPR32, GPR32, GPR32, 0>;
3215+ GPR32, GPR32, (arith_shifted_reg32 GPR32:$src2 , 0) >;
32073216 def : AddSubRegAlias<mnemonic, !cast<Instruction>(NAME#"Xrs"),
3208- GPR64, GPR64, GPR64, 0>;
3217+ GPR64, GPR64, (arith_shifted_reg64 GPR64:$src2 , 0) >;
32093218
32103219 // Register/register aliases with no shift when the first source register
32113220 // is SP.
32123221 def : AddSubRegAlias<mnemonic, !cast<Instruction>(NAME#"Wrx"),
3213- GPR32, GPR32sponly, GPR32, 16>; // UXTW #0
3214- def : AddSubRegAlias<mnemonic,
3215- !cast<Instruction>(NAME#"Xrx64"),
3216- GPR64, GPR64sponly, GPR64, 24>; // UXTX #0
3222+ GPR32, GPR32sponly,
3223+ (arith_extended_reg32_i32 GPR32:$src2, 16)>; // UXTW #0
3224+ def : AddSubRegAlias64<mnemonic, !cast<Instruction>(NAME#"Xrx64"),
3225+ GPR64, GPR64sponly, GPR64, 24>; // UXTX #0
32173226}
32183227
32193228class AddSubG<bit isSub, string asm_inst, SDPatternOperator OpNode>
@@ -3398,9 +3407,10 @@ class BaseLogicalSReg<bits<2> opc, bit N, RegisterClass regtype,
33983407}
33993408
34003409// Aliases for register+register logical instructions.
3401- class LogicalRegAlias<string asm, Instruction inst, RegisterClass regtype>
3410+ class LogicalRegAlias<string asm, Instruction inst, RegisterClass regtype,
3411+ dag op2>
34023412 : InstAlias<asm#"\t$dst, $src1, $src2",
3403- (inst regtype:$dst, regtype:$src1, regtype:$src2, 0 )>;
3413+ (inst regtype:$dst, regtype:$src1, op2 )>;
34043414
34053415multiclass LogicalImm<bits<2> opc, string mnemonic, SDNode OpNode,
34063416 string Alias> {
@@ -3472,10 +3482,10 @@ multiclass LogicalReg<bits<2> opc, bit N, string mnemonic,
34723482 let Inst{31} = 1;
34733483 }
34743484
3475- def : LogicalRegAlias<mnemonic,
3476- !cast<Instruction>(NAME#"Wrs"), GPR32>;
3477- def : LogicalRegAlias<mnemonic,
3478- !cast<Instruction>(NAME#"Xrs"), GPR64>;
3485+ def : LogicalRegAlias<mnemonic, !cast<Instruction>(NAME#"Wrs"),
3486+ GPR32, (logical_shifted_reg32 GPR32:$src2, 0) >;
3487+ def : LogicalRegAlias<mnemonic, !cast<Instruction>(NAME#"Xrs"),
3488+ GPR64, (logical_shifted_reg64 GPR64:$src2, 0) >;
34793489}
34803490
34813491// Split from LogicalReg to allow setting NZCV Defs
@@ -3495,10 +3505,10 @@ multiclass LogicalRegS<bits<2> opc, bit N, string mnemonic,
34953505 }
34963506 } // Defs = [NZCV]
34973507
3498- def : LogicalRegAlias<mnemonic,
3499- !cast<Instruction>(NAME#"Wrs"), GPR32>;
3500- def : LogicalRegAlias<mnemonic,
3501- !cast<Instruction>(NAME#"Xrs"), GPR64>;
3508+ def : LogicalRegAlias<mnemonic, !cast<Instruction>(NAME#"Wrs"),
3509+ GPR32, (logical_shifted_reg32 GPR32:$src2, 0) >;
3510+ def : LogicalRegAlias<mnemonic, !cast<Instruction>(NAME#"Xrs"),
3511+ GPR64, (logical_shifted_reg64 GPR64:$src2, 0) >;
35023512}
35033513
35043514//---
@@ -3986,9 +3996,10 @@ class LoadStore8RO<bits<2> sz, bit V, bits<2> opc, string asm, dag ins,
39863996 let Inst{4-0} = Rt;
39873997}
39883998
3989- class ROInstAlias<string asm, DAGOperand regtype, Instruction INST>
3999+ class ROInstAlias<string asm, DAGOperand regtype, Instruction INST,
4000+ ro_extend ext>
39904001 : InstAlias<asm # "\t$Rt, [$Rn, $Rm]",
3991- (INST regtype:$Rt, GPR64sp:$Rn, GPR64:$Rm, 0, 0)>;
4002+ (INST regtype:$Rt, GPR64sp:$Rn, GPR64:$Rm, (ext 0, 0) )>;
39924003
39934004multiclass Load8RO<bits<2> sz, bit V, bits<2> opc, DAGOperand regtype,
39944005 string asm, ValueType Ty, SDPatternOperator loadop> {
@@ -4014,7 +4025,7 @@ multiclass Load8RO<bits<2> sz, bit V, bits<2> opc, DAGOperand regtype,
40144025 let Inst{13} = 0b1;
40154026 }
40164027
4017- def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX")>;
4028+ def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX"), ro_Xextend8 >;
40184029}
40194030
40204031multiclass Store8RO<bits<2> sz, bit V, bits<2> opc, DAGOperand regtype,
@@ -4039,7 +4050,7 @@ multiclass Store8RO<bits<2> sz, bit V, bits<2> opc, DAGOperand regtype,
40394050 let Inst{13} = 0b1;
40404051 }
40414052
4042- def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX")>;
4053+ def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX"), ro_Xextend8 >;
40434054}
40444055
40454056class LoadStore16RO<bits<2> sz, bit V, bits<2> opc, string asm, dag ins,
@@ -4086,7 +4097,7 @@ multiclass Load16RO<bits<2> sz, bit V, bits<2> opc, DAGOperand regtype,
40864097 let Inst{13} = 0b1;
40874098 }
40884099
4089- def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX")>;
4100+ def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX"), ro_Xextend16 >;
40904101}
40914102
40924103multiclass Store16RO<bits<2> sz, bit V, bits<2> opc, DAGOperand regtype,
@@ -4111,7 +4122,7 @@ multiclass Store16RO<bits<2> sz, bit V, bits<2> opc, DAGOperand regtype,
41114122 let Inst{13} = 0b1;
41124123 }
41134124
4114- def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX")>;
4125+ def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX"), ro_Xextend16 >;
41154126}
41164127
41174128class LoadStore32RO<bits<2> sz, bit V, bits<2> opc, string asm, dag ins,
@@ -4158,7 +4169,7 @@ multiclass Load32RO<bits<2> sz, bit V, bits<2> opc, DAGOperand regtype,
41584169 let Inst{13} = 0b1;
41594170 }
41604171
4161- def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX")>;
4172+ def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX"), ro_Xextend32 >;
41624173}
41634174
41644175multiclass Store32RO<bits<2> sz, bit V, bits<2> opc, DAGOperand regtype,
@@ -4183,7 +4194,7 @@ multiclass Store32RO<bits<2> sz, bit V, bits<2> opc, DAGOperand regtype,
41834194 let Inst{13} = 0b1;
41844195 }
41854196
4186- def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX")>;
4197+ def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX"), ro_Xextend32 >;
41874198}
41884199
41894200class LoadStore64RO<bits<2> sz, bit V, bits<2> opc, string asm, dag ins,
@@ -4230,7 +4241,7 @@ multiclass Load64RO<bits<2> sz, bit V, bits<2> opc, DAGOperand regtype,
42304241 let Inst{13} = 0b1;
42314242 }
42324243
4233- def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX")>;
4244+ def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX"), ro_Xextend64 >;
42344245}
42354246
42364247multiclass Store64RO<bits<2> sz, bit V, bits<2> opc, DAGOperand regtype,
@@ -4255,7 +4266,7 @@ multiclass Store64RO<bits<2> sz, bit V, bits<2> opc, DAGOperand regtype,
42554266 let Inst{13} = 0b1;
42564267 }
42574268
4258- def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX")>;
4269+ def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX"), ro_Xextend64 >;
42594270}
42604271
42614272class LoadStore128RO<bits<2> sz, bit V, bits<2> opc, string asm, dag ins,
@@ -4302,7 +4313,7 @@ multiclass Load128RO<bits<2> sz, bit V, bits<2> opc, DAGOperand regtype,
43024313 let Inst{13} = 0b1;
43034314 }
43044315
4305- def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX")>;
4316+ def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX"), ro_Xextend128 >;
43064317}
43074318
43084319multiclass Store128RO<bits<2> sz, bit V, bits<2> opc, DAGOperand regtype,
@@ -4323,7 +4334,7 @@ multiclass Store128RO<bits<2> sz, bit V, bits<2> opc, DAGOperand regtype,
43234334 let Inst{13} = 0b1;
43244335 }
43254336
4326- def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX")>;
4337+ def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX"), ro_Xextend128 >;
43274338}
43284339
43294340let mayLoad = 0, mayStore = 0, hasSideEffects = 1 in
@@ -4372,9 +4383,7 @@ multiclass PrefetchRO<bits<2> sz, bit V, bits<2> opc, string asm> {
43724383 let Inst{13} = 0b1;
43734384 }
43744385
4375- def : InstAlias<"prfm $Rt, [$Rn, $Rm]",
4376- (!cast<Instruction>(NAME # "roX") prfop:$Rt,
4377- GPR64sp:$Rn, GPR64:$Rm, 0, 0)>;
4386+ def : ROInstAlias<"prfm", prfop, !cast<Instruction>(NAME # "roX"), ro_Xextend64>;
43784387}
43794388
43804389//---
0 commit comments