@@ -3028,8 +3028,12 @@ class BaseAddSubEReg64<bit isSub, bit setFlags, RegisterClass dstRegtype,
3028
3028
3029
3029
// Aliases for register+register add/subtract.
3030
3030
class AddSubRegAlias<string asm, Instruction inst, RegisterClass dstRegtype,
3031
- RegisterClass src1Regtype, RegisterClass src2Regtype,
3032
- int shiftExt>
3031
+ RegisterClass src1Regtype, dag src2>
3032
+ : InstAlias<asm#"\t$dst, $src1, $src2",
3033
+ (inst dstRegtype:$dst, src1Regtype:$src1, src2)>;
3034
+ class AddSubRegAlias64<string asm, Instruction inst, RegisterClass dstRegtype,
3035
+ RegisterClass src1Regtype, RegisterClass src2Regtype,
3036
+ int shiftExt>
3033
3037
: InstAlias<asm#"\t$dst, $src1, $src2",
3034
3038
(inst dstRegtype:$dst, src1Regtype:$src1, src2Regtype:$src2,
3035
3039
shiftExt)>;
@@ -3097,22 +3101,22 @@ multiclass AddSub<bit isSub, string mnemonic, string alias,
3097
3101
3098
3102
// Register/register aliases with no shift when SP is not used.
3099
3103
def : AddSubRegAlias<mnemonic, !cast<Instruction>(NAME#"Wrs"),
3100
- GPR32, GPR32, GPR32, 0>;
3104
+ GPR32, GPR32, (arith_shifted_reg32 GPR32:$src2 , 0) >;
3101
3105
def : AddSubRegAlias<mnemonic, !cast<Instruction>(NAME#"Xrs"),
3102
- GPR64, GPR64, GPR64, 0>;
3106
+ GPR64, GPR64, (arith_shifted_reg64 GPR64:$src2 , 0) >;
3103
3107
3104
3108
// Register/register aliases with no shift when either the destination or
3105
3109
// first source register is SP.
3106
3110
def : AddSubRegAlias<mnemonic, !cast<Instruction>(NAME#"Wrx"),
3107
- GPR32sponly, GPR32sp, GPR32, 16>; // UXTW #0
3111
+ GPR32sponly, GPR32sp,
3112
+ (arith_extended_reg32_i32 GPR32:$src2, 16)>; // UXTW #0
3108
3113
def : AddSubRegAlias<mnemonic, !cast<Instruction>(NAME#"Wrx"),
3109
- GPR32sp, GPR32sponly, GPR32, 16>; // UXTW #0
3110
- def : AddSubRegAlias<mnemonic,
3111
- !cast<Instruction>(NAME#"Xrx64"),
3112
- GPR64sponly, GPR64sp, GPR64, 24>; // UXTX #0
3113
- def : AddSubRegAlias<mnemonic,
3114
- !cast<Instruction>(NAME#"Xrx64"),
3115
- GPR64sp, GPR64sponly, GPR64, 24>; // UXTX #0
3114
+ GPR32sp, GPR32sponly,
3115
+ (arith_extended_reg32_i32 GPR32:$src2, 16)>; // UXTW #0
3116
+ def : AddSubRegAlias64<mnemonic, !cast<Instruction>(NAME#"Xrx64"),
3117
+ GPR64sponly, GPR64sp, GPR64, 24>; // UXTX #0
3118
+ def : AddSubRegAlias64<mnemonic, !cast<Instruction>(NAME#"Xrx64"),
3119
+ GPR64sp, GPR64sponly, GPR64, 24>; // UXTX #0
3116
3120
}
3117
3121
3118
3122
multiclass AddSubS<bit isSub, string mnemonic, SDNode OpNode, string cmp,
@@ -3176,15 +3180,19 @@ multiclass AddSubS<bit isSub, string mnemonic, SDNode OpNode, string cmp,
3176
3180
def : InstAlias<cmp#"\t$src, $imm", (!cast<Instruction>(NAME#"Xri")
3177
3181
XZR, GPR64sp:$src, addsub_shifted_imm64:$imm), 5>;
3178
3182
def : InstAlias<cmp#"\t$src1, $src2$sh", (!cast<Instruction>(NAME#"Wrx")
3179
- WZR, GPR32sp:$src1, GPR32:$src2, arith_extend:$sh), 4>;
3183
+ WZR, GPR32sp:$src1,
3184
+ (arith_extended_reg32_i32 GPR32:$src2, arith_extend:$sh)), 4>;
3180
3185
def : InstAlias<cmp#"\t$src1, $src2$sh", (!cast<Instruction>(NAME#"Xrx")
3181
- XZR, GPR64sp:$src1, GPR32:$src2, arith_extend:$sh), 4>;
3186
+ XZR, GPR64sp:$src1,
3187
+ (arith_extended_reg32_i64 GPR32:$src2, arith_extend:$sh)), 4>;
3182
3188
def : InstAlias<cmp#"\t$src1, $src2$sh", (!cast<Instruction>(NAME#"Xrx64")
3183
3189
XZR, GPR64sp:$src1, GPR64:$src2, arith_extendlsl64:$sh), 4>;
3184
3190
def : InstAlias<cmp#"\t$src1, $src2$sh", (!cast<Instruction>(NAME#"Wrs")
3185
- WZR, GPR32:$src1, GPR32:$src2, arith_shift32:$sh), 4>;
3191
+ WZR, GPR32:$src1,
3192
+ (arith_shifted_reg32 GPR32:$src2, arith_shift32:$sh)), 4>;
3186
3193
def : InstAlias<cmp#"\t$src1, $src2$sh", (!cast<Instruction>(NAME#"Xrs")
3187
- XZR, GPR64:$src1, GPR64:$src2, arith_shift64:$sh), 4>;
3194
+ XZR, GPR64:$src1,
3195
+ (arith_shifted_reg64 GPR64:$src2, arith_shift64:$sh)), 4>;
3188
3196
3189
3197
// Support negative immediates, e.g. cmp Rn, -imm -> cmn Rn, imm
3190
3198
def : InstSubst<cmpAlias#"\t$src, $imm", (!cast<Instruction>(NAME#"Wri")
@@ -3194,27 +3202,28 @@ multiclass AddSubS<bit isSub, string mnemonic, SDNode OpNode, string cmp,
3194
3202
3195
3203
// Compare shorthands
3196
3204
def : InstAlias<cmp#"\t$src1, $src2", (!cast<Instruction>(NAME#"Wrs")
3197
- WZR, GPR32:$src1, GPR32:$src2, 0), 5>;
3205
+ WZR, GPR32:$src1, (arith_shifted_reg32 GPR32:$src2, 0) ), 5>;
3198
3206
def : InstAlias<cmp#"\t$src1, $src2", (!cast<Instruction>(NAME#"Xrs")
3199
- XZR, GPR64:$src1, GPR64:$src2, 0), 5>;
3207
+ XZR, GPR64:$src1, (arith_shifted_reg64 GPR64:$src2, 0) ), 5>;
3200
3208
def : InstAlias<cmp#"\t$src1, $src2", (!cast<Instruction>(NAME#"Wrx")
3201
- WZR, GPR32sponly:$src1, GPR32:$src2, 16), 5>;
3209
+ WZR, GPR32sponly:$src1,
3210
+ (arith_extended_reg32_i32 GPR32:$src2, 16)), 5>;
3202
3211
def : InstAlias<cmp#"\t$src1, $src2", (!cast<Instruction>(NAME#"Xrx64")
3203
3212
XZR, GPR64sponly:$src1, GPR64:$src2, 24), 5>;
3204
3213
3205
3214
// Register/register aliases with no shift when SP is not used.
3206
3215
def : AddSubRegAlias<mnemonic, !cast<Instruction>(NAME#"Wrs"),
3207
- GPR32, GPR32, GPR32, 0>;
3216
+ GPR32, GPR32, (arith_shifted_reg32 GPR32:$src2 , 0) >;
3208
3217
def : AddSubRegAlias<mnemonic, !cast<Instruction>(NAME#"Xrs"),
3209
- GPR64, GPR64, GPR64, 0>;
3218
+ GPR64, GPR64, (arith_shifted_reg64 GPR64:$src2 , 0) >;
3210
3219
3211
3220
// Register/register aliases with no shift when the first source register
3212
3221
// is SP.
3213
3222
def : AddSubRegAlias<mnemonic, !cast<Instruction>(NAME#"Wrx"),
3214
- GPR32, GPR32sponly, GPR32, 16>; // UXTW #0
3215
- def : AddSubRegAlias<mnemonic,
3216
- !cast<Instruction>(NAME#"Xrx64"),
3217
- GPR64, GPR64sponly, GPR64, 24>; // UXTX #0
3223
+ GPR32, GPR32sponly,
3224
+ (arith_extended_reg32_i32 GPR32:$src2, 16)>; // UXTW #0
3225
+ def : AddSubRegAlias64<mnemonic, !cast<Instruction>(NAME#"Xrx64"),
3226
+ GPR64, GPR64sponly, GPR64, 24>; // UXTX #0
3218
3227
}
3219
3228
3220
3229
class AddSubG<bit isSub, string asm_inst, SDPatternOperator OpNode>
@@ -3399,9 +3408,10 @@ class BaseLogicalSReg<bits<2> opc, bit N, RegisterClass regtype,
3399
3408
}
3400
3409
3401
3410
// Aliases for register+register logical instructions.
3402
- class LogicalRegAlias<string asm, Instruction inst, RegisterClass regtype>
3411
+ class LogicalRegAlias<string asm, Instruction inst, RegisterClass regtype,
3412
+ dag op2>
3403
3413
: InstAlias<asm#"\t$dst, $src1, $src2",
3404
- (inst regtype:$dst, regtype:$src1, regtype:$src2, 0 )>;
3414
+ (inst regtype:$dst, regtype:$src1, op2 )>;
3405
3415
3406
3416
multiclass LogicalImm<bits<2> opc, string mnemonic, SDNode OpNode,
3407
3417
string Alias> {
@@ -3473,10 +3483,10 @@ multiclass LogicalReg<bits<2> opc, bit N, string mnemonic,
3473
3483
let Inst{31} = 1;
3474
3484
}
3475
3485
3476
- def : LogicalRegAlias<mnemonic,
3477
- !cast<Instruction>(NAME#"Wrs"), GPR32>;
3478
- def : LogicalRegAlias<mnemonic,
3479
- !cast<Instruction>(NAME#"Xrs"), GPR64>;
3486
+ def : LogicalRegAlias<mnemonic, !cast<Instruction>(NAME#"Wrs"),
3487
+ GPR32, (logical_shifted_reg32 GPR32:$src2, 0) >;
3488
+ def : LogicalRegAlias<mnemonic, !cast<Instruction>(NAME#"Xrs"),
3489
+ GPR64, (logical_shifted_reg64 GPR64:$src2, 0) >;
3480
3490
}
3481
3491
3482
3492
// Split from LogicalReg to allow setting NZCV Defs
@@ -3496,10 +3506,10 @@ multiclass LogicalRegS<bits<2> opc, bit N, string mnemonic,
3496
3506
}
3497
3507
} // Defs = [NZCV]
3498
3508
3499
- def : LogicalRegAlias<mnemonic,
3500
- !cast<Instruction>(NAME#"Wrs"), GPR32>;
3501
- def : LogicalRegAlias<mnemonic,
3502
- !cast<Instruction>(NAME#"Xrs"), GPR64>;
3509
+ def : LogicalRegAlias<mnemonic, !cast<Instruction>(NAME#"Wrs"),
3510
+ GPR32, (logical_shifted_reg32 GPR32:$src2, 0) >;
3511
+ def : LogicalRegAlias<mnemonic, !cast<Instruction>(NAME#"Xrs"),
3512
+ GPR64, (logical_shifted_reg64 GPR64:$src2, 0) >;
3503
3513
}
3504
3514
3505
3515
//---
@@ -3987,9 +3997,10 @@ class LoadStore8RO<bits<2> sz, bit V, bits<2> opc, string asm, dag ins,
3987
3997
let Inst{4-0} = Rt;
3988
3998
}
3989
3999
3990
- class ROInstAlias<string asm, DAGOperand regtype, Instruction INST>
4000
+ class ROInstAlias<string asm, DAGOperand regtype, Instruction INST,
4001
+ ro_extend ext>
3991
4002
: InstAlias<asm # "\t$Rt, [$Rn, $Rm]",
3992
- (INST regtype:$Rt, GPR64sp:$Rn, GPR64:$Rm, 0, 0)>;
4003
+ (INST regtype:$Rt, GPR64sp:$Rn, GPR64:$Rm, (ext 0, 0) )>;
3993
4004
3994
4005
multiclass Load8RO<bits<2> sz, bit V, bits<2> opc, DAGOperand regtype,
3995
4006
string asm, ValueType Ty, SDPatternOperator loadop> {
@@ -4015,7 +4026,7 @@ multiclass Load8RO<bits<2> sz, bit V, bits<2> opc, DAGOperand regtype,
4015
4026
let Inst{13} = 0b1;
4016
4027
}
4017
4028
4018
- def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX")>;
4029
+ def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX"), ro_Xextend8 >;
4019
4030
}
4020
4031
4021
4032
multiclass Store8RO<bits<2> sz, bit V, bits<2> opc, DAGOperand regtype,
@@ -4040,7 +4051,7 @@ multiclass Store8RO<bits<2> sz, bit V, bits<2> opc, DAGOperand regtype,
4040
4051
let Inst{13} = 0b1;
4041
4052
}
4042
4053
4043
- def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX")>;
4054
+ def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX"), ro_Xextend8 >;
4044
4055
}
4045
4056
4046
4057
class LoadStore16RO<bits<2> sz, bit V, bits<2> opc, string asm, dag ins,
@@ -4087,7 +4098,7 @@ multiclass Load16RO<bits<2> sz, bit V, bits<2> opc, DAGOperand regtype,
4087
4098
let Inst{13} = 0b1;
4088
4099
}
4089
4100
4090
- def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX")>;
4101
+ def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX"), ro_Xextend16 >;
4091
4102
}
4092
4103
4093
4104
multiclass Store16RO<bits<2> sz, bit V, bits<2> opc, DAGOperand regtype,
@@ -4112,7 +4123,7 @@ multiclass Store16RO<bits<2> sz, bit V, bits<2> opc, DAGOperand regtype,
4112
4123
let Inst{13} = 0b1;
4113
4124
}
4114
4125
4115
- def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX")>;
4126
+ def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX"), ro_Xextend16 >;
4116
4127
}
4117
4128
4118
4129
class LoadStore32RO<bits<2> sz, bit V, bits<2> opc, string asm, dag ins,
@@ -4159,7 +4170,7 @@ multiclass Load32RO<bits<2> sz, bit V, bits<2> opc, DAGOperand regtype,
4159
4170
let Inst{13} = 0b1;
4160
4171
}
4161
4172
4162
- def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX")>;
4173
+ def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX"), ro_Xextend32 >;
4163
4174
}
4164
4175
4165
4176
multiclass Store32RO<bits<2> sz, bit V, bits<2> opc, DAGOperand regtype,
@@ -4184,7 +4195,7 @@ multiclass Store32RO<bits<2> sz, bit V, bits<2> opc, DAGOperand regtype,
4184
4195
let Inst{13} = 0b1;
4185
4196
}
4186
4197
4187
- def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX")>;
4198
+ def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX"), ro_Xextend32 >;
4188
4199
}
4189
4200
4190
4201
class LoadStore64RO<bits<2> sz, bit V, bits<2> opc, string asm, dag ins,
@@ -4231,7 +4242,7 @@ multiclass Load64RO<bits<2> sz, bit V, bits<2> opc, DAGOperand regtype,
4231
4242
let Inst{13} = 0b1;
4232
4243
}
4233
4244
4234
- def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX")>;
4245
+ def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX"), ro_Xextend64 >;
4235
4246
}
4236
4247
4237
4248
multiclass Store64RO<bits<2> sz, bit V, bits<2> opc, DAGOperand regtype,
@@ -4256,7 +4267,7 @@ multiclass Store64RO<bits<2> sz, bit V, bits<2> opc, DAGOperand regtype,
4256
4267
let Inst{13} = 0b1;
4257
4268
}
4258
4269
4259
- def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX")>;
4270
+ def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX"), ro_Xextend64 >;
4260
4271
}
4261
4272
4262
4273
class LoadStore128RO<bits<2> sz, bit V, bits<2> opc, string asm, dag ins,
@@ -4303,7 +4314,7 @@ multiclass Load128RO<bits<2> sz, bit V, bits<2> opc, DAGOperand regtype,
4303
4314
let Inst{13} = 0b1;
4304
4315
}
4305
4316
4306
- def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX")>;
4317
+ def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX"), ro_Xextend128 >;
4307
4318
}
4308
4319
4309
4320
multiclass Store128RO<bits<2> sz, bit V, bits<2> opc, DAGOperand regtype,
@@ -4324,7 +4335,7 @@ multiclass Store128RO<bits<2> sz, bit V, bits<2> opc, DAGOperand regtype,
4324
4335
let Inst{13} = 0b1;
4325
4336
}
4326
4337
4327
- def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX")>;
4338
+ def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX"), ro_Xextend128 >;
4328
4339
}
4329
4340
4330
4341
let mayLoad = 0, mayStore = 0, hasSideEffects = 1 in
@@ -4373,9 +4384,7 @@ multiclass PrefetchRO<bits<2> sz, bit V, bits<2> opc, string asm> {
4373
4384
let Inst{13} = 0b1;
4374
4385
}
4375
4386
4376
- def : InstAlias<"prfm $Rt, [$Rn, $Rm]",
4377
- (!cast<Instruction>(NAME # "roX") prfop:$Rt,
4378
- GPR64sp:$Rn, GPR64:$Rm, 0, 0)>;
4387
+ def : ROInstAlias<"prfm", prfop, !cast<Instruction>(NAME # "roX"), ro_Xextend64>;
4379
4388
}
4380
4389
4381
4390
//---
0 commit comments