@@ -3032,8 +3032,12 @@ class BaseAddSubEReg64<bit isSub, bit setFlags, RegisterClass dstRegtype,
30323032
30333033// Aliases for register+register add/subtract.
30343034class AddSubRegAlias<string asm, Instruction inst, RegisterClass dstRegtype,
3035- RegisterClass src1Regtype, RegisterClass src2Regtype,
3036- int shiftExt>
3035+ RegisterClass src1Regtype, dag src2>
3036+ : InstAlias<asm#"\t$dst, $src1, $src2",
3037+ (inst dstRegtype:$dst, src1Regtype:$src1, src2)>;
3038+ class AddSubRegAlias64<string asm, Instruction inst, RegisterClass dstRegtype,
3039+ RegisterClass src1Regtype, RegisterClass src2Regtype,
3040+ int shiftExt>
30373041 : InstAlias<asm#"\t$dst, $src1, $src2",
30383042 (inst dstRegtype:$dst, src1Regtype:$src1, src2Regtype:$src2,
30393043 shiftExt)>;
@@ -3101,22 +3105,22 @@ multiclass AddSub<bit isSub, string mnemonic, string alias,
31013105
31023106 // Register/register aliases with no shift when SP is not used.
31033107 def : AddSubRegAlias<mnemonic, !cast<Instruction>(NAME#"Wrs"),
3104- GPR32, GPR32, GPR32, 0>;
3108+ GPR32, GPR32, (arith_shifted_reg32 GPR32:$src2 , 0) >;
31053109 def : AddSubRegAlias<mnemonic, !cast<Instruction>(NAME#"Xrs"),
3106- GPR64, GPR64, GPR64, 0>;
3110+ GPR64, GPR64, (arith_shifted_reg64 GPR64:$src2 , 0) >;
31073111
31083112 // Register/register aliases with no shift when either the destination or
31093113 // first source register is SP.
31103114 def : AddSubRegAlias<mnemonic, !cast<Instruction>(NAME#"Wrx"),
3111- GPR32sponly, GPR32sp, GPR32, 16>; // UXTW #0
3115+ GPR32sponly, GPR32sp,
3116+ (arith_extended_reg32_i32 GPR32:$src2, 16)>; // UXTW #0
31123117 def : AddSubRegAlias<mnemonic, !cast<Instruction>(NAME#"Wrx"),
3113- GPR32sp, GPR32sponly, GPR32, 16>; // UXTW #0
3114- def : AddSubRegAlias<mnemonic,
3115- !cast<Instruction>(NAME#"Xrx64"),
3116- GPR64sponly, GPR64sp, GPR64, 24>; // UXTX #0
3117- def : AddSubRegAlias<mnemonic,
3118- !cast<Instruction>(NAME#"Xrx64"),
3119- GPR64sp, GPR64sponly, GPR64, 24>; // UXTX #0
3118+ GPR32sp, GPR32sponly,
3119+ (arith_extended_reg32_i32 GPR32:$src2, 16)>; // UXTW #0
3120+ def : AddSubRegAlias64<mnemonic, !cast<Instruction>(NAME#"Xrx64"),
3121+ GPR64sponly, GPR64sp, GPR64, 24>; // UXTX #0
3122+ def : AddSubRegAlias64<mnemonic, !cast<Instruction>(NAME#"Xrx64"),
3123+ GPR64sp, GPR64sponly, GPR64, 24>; // UXTX #0
31203124}
31213125
31223126multiclass AddSubS<bit isSub, string mnemonic, SDNode OpNode, string cmp,
@@ -3180,15 +3184,19 @@ multiclass AddSubS<bit isSub, string mnemonic, SDNode OpNode, string cmp,
31803184 def : InstAlias<cmp#"\t$src, $imm", (!cast<Instruction>(NAME#"Xri")
31813185 XZR, GPR64sp:$src, addsub_shifted_imm64:$imm), 5>;
31823186 def : InstAlias<cmp#"\t$src1, $src2$sh", (!cast<Instruction>(NAME#"Wrx")
3183- WZR, GPR32sp:$src1, GPR32:$src2, arith_extend:$sh), 4>;
3187+ WZR, GPR32sp:$src1,
3188+ (arith_extended_reg32_i32 GPR32:$src2, arith_extend:$sh)), 4>;
31843189 def : InstAlias<cmp#"\t$src1, $src2$sh", (!cast<Instruction>(NAME#"Xrx")
3185- XZR, GPR64sp:$src1, GPR32:$src2, arith_extend:$sh), 4>;
3190+ XZR, GPR64sp:$src1,
3191+ (arith_extended_reg32_i64 GPR32:$src2, arith_extend:$sh)), 4>;
31863192 def : InstAlias<cmp#"\t$src1, $src2$sh", (!cast<Instruction>(NAME#"Xrx64")
31873193 XZR, GPR64sp:$src1, GPR64:$src2, arith_extendlsl64:$sh), 4>;
31883194 def : InstAlias<cmp#"\t$src1, $src2$sh", (!cast<Instruction>(NAME#"Wrs")
3189- WZR, GPR32:$src1, GPR32:$src2, arith_shift32:$sh), 4>;
3195+ WZR, GPR32:$src1,
3196+ (arith_shifted_reg32 GPR32:$src2, arith_shift32:$sh)), 4>;
31903197 def : InstAlias<cmp#"\t$src1, $src2$sh", (!cast<Instruction>(NAME#"Xrs")
3191- XZR, GPR64:$src1, GPR64:$src2, arith_shift64:$sh), 4>;
3198+ XZR, GPR64:$src1,
3199+ (arith_shifted_reg64 GPR64:$src2, arith_shift64:$sh)), 4>;
31923200
31933201 // Support negative immediates, e.g. cmp Rn, -imm -> cmn Rn, imm
31943202 def : InstSubst<cmpAlias#"\t$src, $imm", (!cast<Instruction>(NAME#"Wri")
@@ -3198,27 +3206,28 @@ multiclass AddSubS<bit isSub, string mnemonic, SDNode OpNode, string cmp,
31983206
31993207 // Compare shorthands
32003208 def : InstAlias<cmp#"\t$src1, $src2", (!cast<Instruction>(NAME#"Wrs")
3201- WZR, GPR32:$src1, GPR32:$src2, 0), 5>;
3209+ WZR, GPR32:$src1, (arith_shifted_reg32 GPR32:$src2, 0) ), 5>;
32023210 def : InstAlias<cmp#"\t$src1, $src2", (!cast<Instruction>(NAME#"Xrs")
3203- XZR, GPR64:$src1, GPR64:$src2, 0), 5>;
3211+ XZR, GPR64:$src1, (arith_shifted_reg64 GPR64:$src2, 0) ), 5>;
32043212 def : InstAlias<cmp#"\t$src1, $src2", (!cast<Instruction>(NAME#"Wrx")
3205- WZR, GPR32sponly:$src1, GPR32:$src2, 16), 5>;
3213+ WZR, GPR32sponly:$src1,
3214+ (arith_extended_reg32_i32 GPR32:$src2, 16)), 5>;
32063215 def : InstAlias<cmp#"\t$src1, $src2", (!cast<Instruction>(NAME#"Xrx64")
32073216 XZR, GPR64sponly:$src1, GPR64:$src2, 24), 5>;
32083217
32093218 // Register/register aliases with no shift when SP is not used.
32103219 def : AddSubRegAlias<mnemonic, !cast<Instruction>(NAME#"Wrs"),
3211- GPR32, GPR32, GPR32, 0>;
3220+ GPR32, GPR32, (arith_shifted_reg32 GPR32:$src2 , 0) >;
32123221 def : AddSubRegAlias<mnemonic, !cast<Instruction>(NAME#"Xrs"),
3213- GPR64, GPR64, GPR64, 0>;
3222+ GPR64, GPR64, (arith_shifted_reg64 GPR64:$src2 , 0) >;
32143223
32153224 // Register/register aliases with no shift when the first source register
32163225 // is SP.
32173226 def : AddSubRegAlias<mnemonic, !cast<Instruction>(NAME#"Wrx"),
3218- GPR32, GPR32sponly, GPR32, 16>; // UXTW #0
3219- def : AddSubRegAlias<mnemonic,
3220- !cast<Instruction>(NAME#"Xrx64"),
3221- GPR64, GPR64sponly, GPR64, 24>; // UXTX #0
3227+ GPR32, GPR32sponly,
3228+ (arith_extended_reg32_i32 GPR32:$src2, 16)>; // UXTW #0
3229+ def : AddSubRegAlias64<mnemonic, !cast<Instruction>(NAME#"Xrx64"),
3230+ GPR64, GPR64sponly, GPR64, 24>; // UXTX #0
32223231}
32233232
32243233class AddSubG<bit isSub, string asm_inst, SDPatternOperator OpNode>
@@ -3403,9 +3412,10 @@ class BaseLogicalSReg<bits<2> opc, bit N, RegisterClass regtype,
34033412}
34043413
34053414// Aliases for register+register logical instructions.
3406- class LogicalRegAlias<string asm, Instruction inst, RegisterClass regtype>
3415+ class LogicalRegAlias<string asm, Instruction inst, RegisterClass regtype,
3416+ dag op2>
34073417 : InstAlias<asm#"\t$dst, $src1, $src2",
3408- (inst regtype:$dst, regtype:$src1, regtype:$src2, 0 )>;
3418+ (inst regtype:$dst, regtype:$src1, op2 )>;
34093419
34103420multiclass LogicalImm<bits<2> opc, string mnemonic, SDNode OpNode,
34113421 string Alias> {
@@ -3477,10 +3487,10 @@ multiclass LogicalReg<bits<2> opc, bit N, string mnemonic,
34773487 let Inst{31} = 1;
34783488 }
34793489
3480- def : LogicalRegAlias<mnemonic,
3481- !cast<Instruction>(NAME#"Wrs"), GPR32>;
3482- def : LogicalRegAlias<mnemonic,
3483- !cast<Instruction>(NAME#"Xrs"), GPR64>;
3490+ def : LogicalRegAlias<mnemonic, !cast<Instruction>(NAME#"Wrs"),
3491+ GPR32, (logical_shifted_reg32 GPR32:$src2, 0) >;
3492+ def : LogicalRegAlias<mnemonic, !cast<Instruction>(NAME#"Xrs"),
3493+ GPR64, (logical_shifted_reg64 GPR64:$src2, 0) >;
34843494}
34853495
34863496// Split from LogicalReg to allow setting NZCV Defs
@@ -3500,10 +3510,10 @@ multiclass LogicalRegS<bits<2> opc, bit N, string mnemonic,
35003510 }
35013511 } // Defs = [NZCV]
35023512
3503- def : LogicalRegAlias<mnemonic,
3504- !cast<Instruction>(NAME#"Wrs"), GPR32>;
3505- def : LogicalRegAlias<mnemonic,
3506- !cast<Instruction>(NAME#"Xrs"), GPR64>;
3513+ def : LogicalRegAlias<mnemonic, !cast<Instruction>(NAME#"Wrs"),
3514+ GPR32, (logical_shifted_reg32 GPR32:$src2, 0) >;
3515+ def : LogicalRegAlias<mnemonic, !cast<Instruction>(NAME#"Xrs"),
3516+ GPR64, (logical_shifted_reg64 GPR64:$src2, 0) >;
35073517}
35083518
35093519//---
@@ -3991,9 +4001,10 @@ class LoadStore8RO<bits<2> sz, bit V, bits<2> opc, string asm, dag ins,
39914001 let Inst{4-0} = Rt;
39924002}
39934003
3994- class ROInstAlias<string asm, DAGOperand regtype, Instruction INST>
4004+ class ROInstAlias<string asm, DAGOperand regtype, Instruction INST,
4005+ ro_extend ext>
39954006 : InstAlias<asm # "\t$Rt, [$Rn, $Rm]",
3996- (INST regtype:$Rt, GPR64sp:$Rn, GPR64:$Rm, 0, 0)>;
4007+ (INST regtype:$Rt, GPR64sp:$Rn, GPR64:$Rm, (ext 0, 0) )>;
39974008
39984009multiclass Load8RO<bits<2> sz, bit V, bits<2> opc, DAGOperand regtype,
39994010 string asm, ValueType Ty, SDPatternOperator loadop> {
@@ -4019,7 +4030,7 @@ multiclass Load8RO<bits<2> sz, bit V, bits<2> opc, DAGOperand regtype,
40194030 let Inst{13} = 0b1;
40204031 }
40214032
4022- def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX")>;
4033+ def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX"), ro_Xextend8 >;
40234034}
40244035
40254036multiclass Store8RO<bits<2> sz, bit V, bits<2> opc, DAGOperand regtype,
@@ -4044,7 +4055,7 @@ multiclass Store8RO<bits<2> sz, bit V, bits<2> opc, DAGOperand regtype,
40444055 let Inst{13} = 0b1;
40454056 }
40464057
4047- def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX")>;
4058+ def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX"), ro_Xextend8 >;
40484059}
40494060
40504061class LoadStore16RO<bits<2> sz, bit V, bits<2> opc, string asm, dag ins,
@@ -4091,7 +4102,7 @@ multiclass Load16RO<bits<2> sz, bit V, bits<2> opc, DAGOperand regtype,
40914102 let Inst{13} = 0b1;
40924103 }
40934104
4094- def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX")>;
4105+ def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX"), ro_Xextend16 >;
40954106}
40964107
40974108multiclass Store16RO<bits<2> sz, bit V, bits<2> opc, DAGOperand regtype,
@@ -4116,7 +4127,7 @@ multiclass Store16RO<bits<2> sz, bit V, bits<2> opc, DAGOperand regtype,
41164127 let Inst{13} = 0b1;
41174128 }
41184129
4119- def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX")>;
4130+ def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX"), ro_Xextend16 >;
41204131}
41214132
41224133class LoadStore32RO<bits<2> sz, bit V, bits<2> opc, string asm, dag ins,
@@ -4163,7 +4174,7 @@ multiclass Load32RO<bits<2> sz, bit V, bits<2> opc, DAGOperand regtype,
41634174 let Inst{13} = 0b1;
41644175 }
41654176
4166- def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX")>;
4177+ def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX"), ro_Xextend32 >;
41674178}
41684179
41694180multiclass Store32RO<bits<2> sz, bit V, bits<2> opc, DAGOperand regtype,
@@ -4188,7 +4199,7 @@ multiclass Store32RO<bits<2> sz, bit V, bits<2> opc, DAGOperand regtype,
41884199 let Inst{13} = 0b1;
41894200 }
41904201
4191- def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX")>;
4202+ def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX"), ro_Xextend32 >;
41924203}
41934204
41944205class LoadStore64RO<bits<2> sz, bit V, bits<2> opc, string asm, dag ins,
@@ -4235,7 +4246,7 @@ multiclass Load64RO<bits<2> sz, bit V, bits<2> opc, DAGOperand regtype,
42354246 let Inst{13} = 0b1;
42364247 }
42374248
4238- def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX")>;
4249+ def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX"), ro_Xextend64 >;
42394250}
42404251
42414252multiclass Store64RO<bits<2> sz, bit V, bits<2> opc, DAGOperand regtype,
@@ -4260,7 +4271,7 @@ multiclass Store64RO<bits<2> sz, bit V, bits<2> opc, DAGOperand regtype,
42604271 let Inst{13} = 0b1;
42614272 }
42624273
4263- def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX")>;
4274+ def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX"), ro_Xextend64 >;
42644275}
42654276
42664277class LoadStore128RO<bits<2> sz, bit V, bits<2> opc, string asm, dag ins,
@@ -4307,7 +4318,7 @@ multiclass Load128RO<bits<2> sz, bit V, bits<2> opc, DAGOperand regtype,
43074318 let Inst{13} = 0b1;
43084319 }
43094320
4310- def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX")>;
4321+ def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX"), ro_Xextend128 >;
43114322}
43124323
43134324multiclass Store128RO<bits<2> sz, bit V, bits<2> opc, DAGOperand regtype,
@@ -4328,7 +4339,7 @@ multiclass Store128RO<bits<2> sz, bit V, bits<2> opc, DAGOperand regtype,
43284339 let Inst{13} = 0b1;
43294340 }
43304341
4331- def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX")>;
4342+ def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX"), ro_Xextend128 >;
43324343}
43334344
43344345let mayLoad = 0, mayStore = 0, hasSideEffects = 1 in
@@ -4377,9 +4388,7 @@ multiclass PrefetchRO<bits<2> sz, bit V, bits<2> opc, string asm> {
43774388 let Inst{13} = 0b1;
43784389 }
43794390
4380- def : InstAlias<"prfm $Rt, [$Rn, $Rm]",
4381- (!cast<Instruction>(NAME # "roX") prfop:$Rt,
4382- GPR64sp:$Rn, GPR64:$Rm, 0, 0)>;
4391+ def : ROInstAlias<"prfm", prfop, !cast<Instruction>(NAME # "roX"), ro_Xextend64>;
43834392}
43844393
43854394//---
0 commit comments