Skip to content

Commit 981f25a

Browse files
authored
[TableGen] Require complex operands in InstAlias to be specified as DAGs (#136411)
Currently, complex operands of an instruction are flattened in the resulting DAG of `InstAlias`. This change makes it required to specify complex operands in `InstAlias` as sub-DAGs: ``` InstAlias<"foo $rd, $rs1, $rs2", (Inst RC:$rd, (ComplexOp RC:$rs1, GR0, 42), SimpleOp:$rs2)>; ``` instead of ``` InstAlias<"foo $rd, $rs1, $rs2", (Inst RC:$rd, RC:$rs1, GR0, 42, SimpleOp:$rs2)>; ``` The advantages of the new syntax are improved readability and more robust type checking, although it is a bit more verbose.
1 parent 1bbac05 commit 981f25a

File tree

12 files changed

+327
-314
lines changed

12 files changed

+327
-314
lines changed

llvm/lib/Target/AArch64/AArch64InstrFormats.td

Lines changed: 59 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -3032,8 +3032,12 @@ class BaseAddSubEReg64<bit isSub, bit setFlags, RegisterClass dstRegtype,
30323032

30333033
// Aliases for register+register add/subtract.
30343034
class 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

31223126
multiclass 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

32243233
class 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

34103420
multiclass 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

39984009
multiclass 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

40254036
multiclass 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

40504061
class 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

40974108
multiclass 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

41224133
class 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

41694180
multiclass 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

41944205
class 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

42414252
multiclass 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

42664277
class 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

43134324
multiclass 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

43344345
let 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
//---

llvm/lib/Target/AArch64/AArch64InstrInfo.td

Lines changed: 54 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2663,13 +2663,17 @@ defm ADD : AddSub<0, "add", "sub", add>;
26632663
defm SUB : AddSub<1, "sub", "add">;
26642664

26652665
def : InstAlias<"mov $dst, $src",
2666-
(ADDWri GPR32sponly:$dst, GPR32sp:$src, 0, 0)>;
2666+
(ADDWri GPR32sponly:$dst, GPR32sp:$src,
2667+
(addsub_shifted_imm32 0, 0))>;
26672668
def : InstAlias<"mov $dst, $src",
2668-
(ADDWri GPR32sp:$dst, GPR32sponly:$src, 0, 0)>;
2669+
(ADDWri GPR32sp:$dst, GPR32sponly:$src,
2670+
(addsub_shifted_imm32 0, 0))>;
26692671
def : InstAlias<"mov $dst, $src",
2670-
(ADDXri GPR64sponly:$dst, GPR64sp:$src, 0, 0)>;
2672+
(ADDXri GPR64sponly:$dst, GPR64sp:$src,
2673+
(addsub_shifted_imm64 0, 0))>;
26712674
def : InstAlias<"mov $dst, $src",
2672-
(ADDXri GPR64sp:$dst, GPR64sponly:$src, 0, 0)>;
2675+
(ADDXri GPR64sp:$dst, GPR64sponly:$src,
2676+
(addsub_shifted_imm64 0, 0))>;
26732677

26742678
defm ADDS : AddSubS<0, "adds", AArch64add_flag, "cmn", "subs", "cmp">;
26752679
defm SUBS : AddSubS<1, "subs", AArch64sub_flag, "cmp", "adds", "cmn">;
@@ -2729,19 +2733,31 @@ def : Pat<(AArch64sub_flag GPR64:$Rn, neg_addsub_shifted_imm64:$imm),
27292733
(ADDSXri GPR64:$Rn, neg_addsub_shifted_imm64:$imm)>;
27302734
}
27312735

2732-
def : InstAlias<"neg $dst, $src", (SUBWrs GPR32:$dst, WZR, GPR32:$src, 0), 3>;
2733-
def : InstAlias<"neg $dst, $src", (SUBXrs GPR64:$dst, XZR, GPR64:$src, 0), 3>;
2736+
def : InstAlias<"neg $dst, $src",
2737+
(SUBWrs GPR32:$dst, WZR,
2738+
(arith_shifted_reg32 GPR32:$src, 0)), 3>;
2739+
def : InstAlias<"neg $dst, $src",
2740+
(SUBXrs GPR64:$dst, XZR,
2741+
(arith_shifted_reg64 GPR64:$src, 0)), 3>;
27342742
def : InstAlias<"neg $dst, $src$shift",
2735-
(SUBWrs GPR32:$dst, WZR, GPR32:$src, arith_shift32:$shift), 2>;
2743+
(SUBWrs GPR32:$dst, WZR,
2744+
(arith_shifted_reg32 GPR32:$src, arith_shift32:$shift)), 2>;
27362745
def : InstAlias<"neg $dst, $src$shift",
2737-
(SUBXrs GPR64:$dst, XZR, GPR64:$src, arith_shift64:$shift), 2>;
2738-
2739-
def : InstAlias<"negs $dst, $src", (SUBSWrs GPR32:$dst, WZR, GPR32:$src, 0), 3>;
2740-
def : InstAlias<"negs $dst, $src", (SUBSXrs GPR64:$dst, XZR, GPR64:$src, 0), 3>;
2746+
(SUBXrs GPR64:$dst, XZR,
2747+
(arith_shifted_reg64 GPR64:$src, arith_shift64:$shift)), 2>;
2748+
2749+
def : InstAlias<"negs $dst, $src",
2750+
(SUBSWrs GPR32:$dst, WZR,
2751+
(arith_shifted_reg32 GPR32:$src, 0)), 3>;
2752+
def : InstAlias<"negs $dst, $src",
2753+
(SUBSXrs GPR64:$dst, XZR,
2754+
(arith_shifted_reg64 GPR64:$src, 0)), 3>;
27412755
def : InstAlias<"negs $dst, $src$shift",
2742-
(SUBSWrs GPR32:$dst, WZR, GPR32:$src, arith_shift32:$shift), 2>;
2756+
(SUBSWrs GPR32:$dst, WZR,
2757+
(arith_shifted_reg32 GPR32:$src, arith_shift32:$shift)), 2>;
27432758
def : InstAlias<"negs $dst, $src$shift",
2744-
(SUBSXrs GPR64:$dst, XZR, GPR64:$src, arith_shift64:$shift), 2>;
2759+
(SUBSXrs GPR64:$dst, XZR,
2760+
(arith_shifted_reg64 GPR64:$src, arith_shift64:$shift)), 2>;
27452761

27462762

27472763
// Unsigned/Signed divide
@@ -3168,31 +3184,45 @@ defm ORN : LogicalReg<0b01, 1, "orn",
31683184
BinOpFrag<(or node:$LHS, (not node:$RHS))>>;
31693185
defm ORR : LogicalReg<0b01, 0, "orr", or>;
31703186

3171-
def : InstAlias<"mov $dst, $src", (ORRWrs GPR32:$dst, WZR, GPR32:$src, 0), 2>;
3172-
def : InstAlias<"mov $dst, $src", (ORRXrs GPR64:$dst, XZR, GPR64:$src, 0), 2>;
3173-
3174-
def : InstAlias<"mvn $Wd, $Wm", (ORNWrs GPR32:$Wd, WZR, GPR32:$Wm, 0), 3>;
3175-
def : InstAlias<"mvn $Xd, $Xm", (ORNXrs GPR64:$Xd, XZR, GPR64:$Xm, 0), 3>;
3187+
def : InstAlias<"mov $dst, $src",
3188+
(ORRWrs GPR32:$dst, WZR,
3189+
(logical_shifted_reg32 GPR32:$src, 0)), 2>;
3190+
def : InstAlias<"mov $dst, $src",
3191+
(ORRXrs GPR64:$dst, XZR,
3192+
(logical_shifted_reg64 GPR64:$src, 0)), 2>;
3193+
3194+
def : InstAlias<"mvn $Wd, $Wm",
3195+
(ORNWrs GPR32:$Wd, WZR,
3196+
(logical_shifted_reg32 GPR32:$Wm, 0)), 3>;
3197+
def : InstAlias<"mvn $Xd, $Xm",
3198+
(ORNXrs GPR64:$Xd, XZR,
3199+
(logical_shifted_reg64 GPR64:$Xm, 0)), 3>;
31763200

31773201
def : InstAlias<"mvn $Wd, $Wm$sh",
3178-
(ORNWrs GPR32:$Wd, WZR, GPR32:$Wm, logical_shift32:$sh), 2>;
3202+
(ORNWrs GPR32:$Wd, WZR,
3203+
(logical_shifted_reg32 GPR32:$Wm, logical_shift32:$sh)), 2>;
31793204
def : InstAlias<"mvn $Xd, $Xm$sh",
3180-
(ORNXrs GPR64:$Xd, XZR, GPR64:$Xm, logical_shift64:$sh), 2>;
3205+
(ORNXrs GPR64:$Xd, XZR,
3206+
(logical_shifted_reg64 GPR64:$Xm, logical_shift64:$sh)), 2>;
31813207

31823208
def : InstAlias<"tst $src1, $src2",
31833209
(ANDSWri WZR, GPR32:$src1, logical_imm32:$src2), 2>;
31843210
def : InstAlias<"tst $src1, $src2",
31853211
(ANDSXri XZR, GPR64:$src1, logical_imm64:$src2), 2>;
31863212

31873213
def : InstAlias<"tst $src1, $src2",
3188-
(ANDSWrs WZR, GPR32:$src1, GPR32:$src2, 0), 3>;
3214+
(ANDSWrs WZR, GPR32:$src1,
3215+
(logical_shifted_reg32 GPR32:$src2, 0)), 3>;
31893216
def : InstAlias<"tst $src1, $src2",
3190-
(ANDSXrs XZR, GPR64:$src1, GPR64:$src2, 0), 3>;
3217+
(ANDSXrs XZR, GPR64:$src1,
3218+
(logical_shifted_reg64 GPR64:$src2, 0)), 3>;
31913219

31923220
def : InstAlias<"tst $src1, $src2$sh",
3193-
(ANDSWrs WZR, GPR32:$src1, GPR32:$src2, logical_shift32:$sh), 2>;
3221+
(ANDSWrs WZR, GPR32:$src1,
3222+
(logical_shifted_reg32 GPR32:$src2, logical_shift32:$sh)), 2>;
31943223
def : InstAlias<"tst $src1, $src2$sh",
3195-
(ANDSXrs XZR, GPR64:$src1, GPR64:$src2, logical_shift64:$sh), 2>;
3224+
(ANDSXrs XZR, GPR64:$src1,
3225+
(logical_shifted_reg64 GPR64:$src2, logical_shift64:$sh)), 2>;
31963226

31973227

31983228
def : Pat<(not GPR32:$Wm), (ORNWrr WZR, GPR32:$Wm)>;

0 commit comments

Comments
 (0)