@@ -3027,8 +3027,12 @@ class BaseAddSubEReg64<bit isSub, bit setFlags, RegisterClass dstRegtype,
3027
3027
3028
3028
// Aliases for register+register add/subtract.
3029
3029
class 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>
3032
3036
: InstAlias<asm#"\t$dst, $src1, $src2",
3033
3037
(inst dstRegtype:$dst, src1Regtype:$src1, src2Regtype:$src2,
3034
3038
shiftExt)>;
@@ -3096,22 +3100,22 @@ multiclass AddSub<bit isSub, string mnemonic, string alias,
3096
3100
3097
3101
// Register/register aliases with no shift when SP is not used.
3098
3102
def : AddSubRegAlias<mnemonic, !cast<Instruction>(NAME#"Wrs"),
3099
- GPR32, GPR32, GPR32, 0>;
3103
+ GPR32, GPR32, (arith_shifted_reg32 GPR32:$src2 , 0) >;
3100
3104
def : AddSubRegAlias<mnemonic, !cast<Instruction>(NAME#"Xrs"),
3101
- GPR64, GPR64, GPR64, 0>;
3105
+ GPR64, GPR64, (arith_shifted_reg64 GPR64:$src2 , 0) >;
3102
3106
3103
3107
// Register/register aliases with no shift when either the destination or
3104
3108
// first source register is SP.
3105
3109
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
3107
3112
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
3115
3119
}
3116
3120
3117
3121
multiclass AddSubS<bit isSub, string mnemonic, SDNode OpNode, string cmp,
@@ -3175,15 +3179,19 @@ multiclass AddSubS<bit isSub, string mnemonic, SDNode OpNode, string cmp,
3175
3179
def : InstAlias<cmp#"\t$src, $imm", (!cast<Instruction>(NAME#"Xri")
3176
3180
XZR, GPR64sp:$src, addsub_shifted_imm64:$imm), 5>;
3177
3181
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>;
3179
3184
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>;
3181
3187
def : InstAlias<cmp#"\t$src1, $src2$sh", (!cast<Instruction>(NAME#"Xrx64")
3182
3188
XZR, GPR64sp:$src1, GPR64:$src2, arith_extendlsl64:$sh), 4>;
3183
3189
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>;
3185
3192
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>;
3187
3195
3188
3196
// Support negative immediates, e.g. cmp Rn, -imm -> cmn Rn, imm
3189
3197
def : InstSubst<cmpAlias#"\t$src, $imm", (!cast<Instruction>(NAME#"Wri")
@@ -3193,27 +3201,28 @@ multiclass AddSubS<bit isSub, string mnemonic, SDNode OpNode, string cmp,
3193
3201
3194
3202
// Compare shorthands
3195
3203
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>;
3197
3205
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>;
3199
3207
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>;
3201
3210
def : InstAlias<cmp#"\t$src1, $src2", (!cast<Instruction>(NAME#"Xrx64")
3202
3211
XZR, GPR64sponly:$src1, GPR64:$src2, 24), 5>;
3203
3212
3204
3213
// Register/register aliases with no shift when SP is not used.
3205
3214
def : AddSubRegAlias<mnemonic, !cast<Instruction>(NAME#"Wrs"),
3206
- GPR32, GPR32, GPR32, 0>;
3215
+ GPR32, GPR32, (arith_shifted_reg32 GPR32:$src2 , 0) >;
3207
3216
def : AddSubRegAlias<mnemonic, !cast<Instruction>(NAME#"Xrs"),
3208
- GPR64, GPR64, GPR64, 0>;
3217
+ GPR64, GPR64, (arith_shifted_reg64 GPR64:$src2 , 0) >;
3209
3218
3210
3219
// Register/register aliases with no shift when the first source register
3211
3220
// is SP.
3212
3221
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
3217
3226
}
3218
3227
3219
3228
class AddSubG<bit isSub, string asm_inst, SDPatternOperator OpNode>
@@ -3398,9 +3407,10 @@ class BaseLogicalSReg<bits<2> opc, bit N, RegisterClass regtype,
3398
3407
}
3399
3408
3400
3409
// 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>
3402
3412
: InstAlias<asm#"\t$dst, $src1, $src2",
3403
- (inst regtype:$dst, regtype:$src1, regtype:$src2, 0 )>;
3413
+ (inst regtype:$dst, regtype:$src1, op2 )>;
3404
3414
3405
3415
multiclass LogicalImm<bits<2> opc, string mnemonic, SDNode OpNode,
3406
3416
string Alias> {
@@ -3472,10 +3482,10 @@ multiclass LogicalReg<bits<2> opc, bit N, string mnemonic,
3472
3482
let Inst{31} = 1;
3473
3483
}
3474
3484
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) >;
3479
3489
}
3480
3490
3481
3491
// Split from LogicalReg to allow setting NZCV Defs
@@ -3495,10 +3505,10 @@ multiclass LogicalRegS<bits<2> opc, bit N, string mnemonic,
3495
3505
}
3496
3506
} // Defs = [NZCV]
3497
3507
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) >;
3502
3512
}
3503
3513
3504
3514
//---
@@ -3986,9 +3996,10 @@ class LoadStore8RO<bits<2> sz, bit V, bits<2> opc, string asm, dag ins,
3986
3996
let Inst{4-0} = Rt;
3987
3997
}
3988
3998
3989
- class ROInstAlias<string asm, DAGOperand regtype, Instruction INST>
3999
+ class ROInstAlias<string asm, DAGOperand regtype, Instruction INST,
4000
+ ro_extend ext>
3990
4001
: 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) )>;
3992
4003
3993
4004
multiclass Load8RO<bits<2> sz, bit V, bits<2> opc, DAGOperand regtype,
3994
4005
string asm, ValueType Ty, SDPatternOperator loadop> {
@@ -4014,7 +4025,7 @@ multiclass Load8RO<bits<2> sz, bit V, bits<2> opc, DAGOperand regtype,
4014
4025
let Inst{13} = 0b1;
4015
4026
}
4016
4027
4017
- def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX")>;
4028
+ def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX"), ro_Xextend8 >;
4018
4029
}
4019
4030
4020
4031
multiclass 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,
4039
4050
let Inst{13} = 0b1;
4040
4051
}
4041
4052
4042
- def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX")>;
4053
+ def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX"), ro_Xextend8 >;
4043
4054
}
4044
4055
4045
4056
class 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,
4086
4097
let Inst{13} = 0b1;
4087
4098
}
4088
4099
4089
- def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX")>;
4100
+ def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX"), ro_Xextend16 >;
4090
4101
}
4091
4102
4092
4103
multiclass 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,
4111
4122
let Inst{13} = 0b1;
4112
4123
}
4113
4124
4114
- def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX")>;
4125
+ def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX"), ro_Xextend16 >;
4115
4126
}
4116
4127
4117
4128
class 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,
4158
4169
let Inst{13} = 0b1;
4159
4170
}
4160
4171
4161
- def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX")>;
4172
+ def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX"), ro_Xextend32 >;
4162
4173
}
4163
4174
4164
4175
multiclass 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,
4183
4194
let Inst{13} = 0b1;
4184
4195
}
4185
4196
4186
- def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX")>;
4197
+ def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX"), ro_Xextend32 >;
4187
4198
}
4188
4199
4189
4200
class 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,
4230
4241
let Inst{13} = 0b1;
4231
4242
}
4232
4243
4233
- def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX")>;
4244
+ def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX"), ro_Xextend64 >;
4234
4245
}
4235
4246
4236
4247
multiclass 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,
4255
4266
let Inst{13} = 0b1;
4256
4267
}
4257
4268
4258
- def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX")>;
4269
+ def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX"), ro_Xextend64 >;
4259
4270
}
4260
4271
4261
4272
class 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,
4302
4313
let Inst{13} = 0b1;
4303
4314
}
4304
4315
4305
- def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX")>;
4316
+ def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX"), ro_Xextend128 >;
4306
4317
}
4307
4318
4308
4319
multiclass 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,
4323
4334
let Inst{13} = 0b1;
4324
4335
}
4325
4336
4326
- def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX")>;
4337
+ def : ROInstAlias<asm, regtype, !cast<Instruction>(NAME # "roX"), ro_Xextend128 >;
4327
4338
}
4328
4339
4329
4340
let mayLoad = 0, mayStore = 0, hasSideEffects = 1 in
@@ -4372,9 +4383,7 @@ multiclass PrefetchRO<bits<2> sz, bit V, bits<2> opc, string asm> {
4372
4383
let Inst{13} = 0b1;
4373
4384
}
4374
4385
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>;
4378
4387
}
4379
4388
4380
4389
//---
0 commit comments