@@ -56194,19 +56194,19 @@ X86TargetLowering::getConstraintType(StringRef Constraint) const {
56194
56194
/// This object must already have been set up with the operand type
56195
56195
/// and the current alternative constraint selected.
56196
56196
TargetLowering::ConstraintWeight
56197
- X86TargetLowering::getSingleConstraintMatchWeight(
56198
- AsmOperandInfo &info , const char *constraint ) const {
56199
- ConstraintWeight weight = CW_Invalid;
56200
- Value *CallOperandVal = info .CallOperandVal;
56201
- // If we don't have a value, we can't do a match,
56202
- // but allow it at the lowest weight.
56197
+ X86TargetLowering::getSingleConstraintMatchWeight(
56198
+ AsmOperandInfo &Info , const char *Constraint ) const {
56199
+ ConstraintWeight Wt = CW_Invalid;
56200
+ Value *CallOperandVal = Info .CallOperandVal;
56201
+ // If we don't have a value, we can't do a match,
56202
+ // but allow it at the lowest weight.
56203
56203
if (!CallOperandVal)
56204
56204
return CW_Default;
56205
- Type *type = CallOperandVal->getType();
56205
+ Type *Ty = CallOperandVal->getType();
56206
56206
// Look at the constraint type.
56207
- switch (*constraint ) {
56207
+ switch (*Constraint ) {
56208
56208
default:
56209
- weight = TargetLowering::getSingleConstraintMatchWeight(info, constraint );
56209
+ Wt = TargetLowering::getSingleConstraintMatchWeight(Info, Constraint );
56210
56210
[[fallthrough]];
56211
56211
case 'R':
56212
56212
case 'q':
@@ -56219,121 +56219,112 @@ TargetLowering::ConstraintWeight
56219
56219
case 'D':
56220
56220
case 'A':
56221
56221
if (CallOperandVal->getType()->isIntegerTy())
56222
- weight = CW_SpecificReg;
56222
+ Wt = CW_SpecificReg;
56223
56223
break;
56224
56224
case 'f':
56225
56225
case 't':
56226
56226
case 'u':
56227
- if (type ->isFloatingPointTy())
56228
- weight = CW_SpecificReg;
56227
+ if (Ty ->isFloatingPointTy())
56228
+ Wt = CW_SpecificReg;
56229
56229
break;
56230
56230
case 'y':
56231
- if (type ->isX86_MMXTy() && Subtarget.hasMMX())
56232
- weight = CW_SpecificReg;
56231
+ if (Ty ->isX86_MMXTy() && Subtarget.hasMMX())
56232
+ Wt = CW_SpecificReg;
56233
56233
break;
56234
56234
case 'Y':
56235
- if (StringRef(constraint ).size() != 2)
56235
+ if (StringRef(Constraint ).size() != 2)
56236
56236
break;
56237
- switch (constraint[1]) {
56238
- default:
56239
- return CW_Invalid;
56240
- // XMM0
56241
- case 'z':
56242
- if (((type->getPrimitiveSizeInBits() == 128) && Subtarget.hasSSE1()) ||
56243
- ((type->getPrimitiveSizeInBits() == 256) && Subtarget.hasAVX()) ||
56244
- ((type->getPrimitiveSizeInBits() == 512) && Subtarget.hasAVX512()))
56245
- return CW_SpecificReg;
56246
- return CW_Invalid;
56247
- // Conditional OpMask regs (AVX512)
56248
- case 'k':
56249
- if ((type->getPrimitiveSizeInBits() == 64) && Subtarget.hasAVX512())
56250
- return CW_Register;
56251
- return CW_Invalid;
56252
- // Any MMX reg
56253
- case 'm':
56254
- if (type->isX86_MMXTy() && Subtarget.hasMMX())
56255
- return weight;
56237
+ switch (Constraint[1]) {
56238
+ default:
56239
+ return CW_Invalid;
56240
+ // XMM0
56241
+ case 'z':
56242
+ if (((Ty->getPrimitiveSizeInBits() == 128) && Subtarget.hasSSE1()) ||
56243
+ ((Ty->getPrimitiveSizeInBits() == 256) && Subtarget.hasAVX()) ||
56244
+ ((Ty->getPrimitiveSizeInBits() == 512) && Subtarget.hasAVX512()))
56245
+ return CW_SpecificReg;
56246
+ return CW_Invalid;
56247
+ // Conditional OpMask regs (AVX512)
56248
+ case 'k':
56249
+ if ((Ty->getPrimitiveSizeInBits() == 64) && Subtarget.hasAVX512())
56250
+ return CW_Register;
56251
+ return CW_Invalid;
56252
+ // Any MMX reg
56253
+ case 'm':
56254
+ if (Ty->isX86_MMXTy() && Subtarget.hasMMX())
56255
+ return Wt;
56256
+ return CW_Invalid;
56257
+ // Any SSE reg when ISA >= SSE2, same as 'x'
56258
+ case 'i':
56259
+ case 't':
56260
+ case '2':
56261
+ if (!Subtarget.hasSSE2())
56256
56262
return CW_Invalid;
56257
- // Any SSE reg when ISA >= SSE2, same as 'x'
56258
- case 'i':
56259
- case 't':
56260
- case '2':
56261
- if (!Subtarget.hasSSE2())
56262
- return CW_Invalid;
56263
- break;
56263
+ break;
56264
56264
}
56265
56265
break;
56266
56266
case 'v':
56267
- if ((type ->getPrimitiveSizeInBits() == 512) && Subtarget.hasAVX512())
56268
- weight = CW_Register;
56267
+ if ((Ty ->getPrimitiveSizeInBits() == 512) && Subtarget.hasAVX512())
56268
+ Wt = CW_Register;
56269
56269
[[fallthrough]];
56270
56270
case 'x':
56271
- if (((type ->getPrimitiveSizeInBits() == 128) && Subtarget.hasSSE1()) ||
56272
- ((type ->getPrimitiveSizeInBits() == 256) && Subtarget.hasAVX()))
56273
- weight = CW_Register;
56271
+ if (((Ty ->getPrimitiveSizeInBits() == 128) && Subtarget.hasSSE1()) ||
56272
+ ((Ty ->getPrimitiveSizeInBits() == 256) && Subtarget.hasAVX()))
56273
+ Wt = CW_Register;
56274
56274
break;
56275
56275
case 'k':
56276
56276
// Enable conditional vector operations using %k<#> registers.
56277
- if ((type ->getPrimitiveSizeInBits() == 64) && Subtarget.hasAVX512())
56278
- weight = CW_Register;
56277
+ if ((Ty ->getPrimitiveSizeInBits() == 64) && Subtarget.hasAVX512())
56278
+ Wt = CW_Register;
56279
56279
break;
56280
56280
case 'I':
56281
- if (auto *C = dyn_cast<ConstantInt>(info .CallOperandVal)) {
56281
+ if (auto *C = dyn_cast<ConstantInt>(Info .CallOperandVal))
56282
56282
if (C->getZExtValue() <= 31)
56283
- weight = CW_Constant;
56284
- }
56283
+ Wt = CW_Constant;
56285
56284
break;
56286
56285
case 'J':
56287
- if (auto *C = dyn_cast<ConstantInt>(CallOperandVal)) {
56286
+ if (auto *C = dyn_cast<ConstantInt>(CallOperandVal))
56288
56287
if (C->getZExtValue() <= 63)
56289
- weight = CW_Constant;
56290
- }
56288
+ Wt = CW_Constant;
56291
56289
break;
56292
56290
case 'K':
56293
- if (auto *C = dyn_cast<ConstantInt>(CallOperandVal)) {
56291
+ if (auto *C = dyn_cast<ConstantInt>(CallOperandVal))
56294
56292
if ((C->getSExtValue() >= -0x80) && (C->getSExtValue() <= 0x7f))
56295
- weight = CW_Constant;
56296
- }
56293
+ Wt = CW_Constant;
56297
56294
break;
56298
56295
case 'L':
56299
- if (auto *C = dyn_cast<ConstantInt>(CallOperandVal)) {
56296
+ if (auto *C = dyn_cast<ConstantInt>(CallOperandVal))
56300
56297
if ((C->getZExtValue() == 0xff) || (C->getZExtValue() == 0xffff))
56301
- weight = CW_Constant;
56302
- }
56298
+ Wt = CW_Constant;
56303
56299
break;
56304
56300
case 'M':
56305
- if (auto *C = dyn_cast<ConstantInt>(CallOperandVal)) {
56301
+ if (auto *C = dyn_cast<ConstantInt>(CallOperandVal))
56306
56302
if (C->getZExtValue() <= 3)
56307
- weight = CW_Constant;
56308
- }
56303
+ Wt = CW_Constant;
56309
56304
break;
56310
56305
case 'N':
56311
- if (auto *C = dyn_cast<ConstantInt>(CallOperandVal)) {
56306
+ if (auto *C = dyn_cast<ConstantInt>(CallOperandVal))
56312
56307
if (C->getZExtValue() <= 0xff)
56313
- weight = CW_Constant;
56314
- }
56308
+ Wt = CW_Constant;
56315
56309
break;
56316
56310
case 'G':
56317
56311
case 'C':
56318
- if (isa<ConstantFP>(CallOperandVal)) {
56319
- weight = CW_Constant;
56320
- }
56312
+ if (isa<ConstantFP>(CallOperandVal))
56313
+ Wt = CW_Constant;
56321
56314
break;
56322
56315
case 'e':
56323
- if (auto *C = dyn_cast<ConstantInt>(CallOperandVal)) {
56316
+ if (auto *C = dyn_cast<ConstantInt>(CallOperandVal))
56324
56317
if ((C->getSExtValue() >= -0x80000000LL) &&
56325
56318
(C->getSExtValue() <= 0x7fffffffLL))
56326
- weight = CW_Constant;
56327
- }
56319
+ Wt = CW_Constant;
56328
56320
break;
56329
56321
case 'Z':
56330
- if (auto *C = dyn_cast<ConstantInt>(CallOperandVal)) {
56322
+ if (auto *C = dyn_cast<ConstantInt>(CallOperandVal))
56331
56323
if (C->getZExtValue() <= 0xffffffff)
56332
- weight = CW_Constant;
56333
- }
56324
+ Wt = CW_Constant;
56334
56325
break;
56335
56326
}
56336
- return weight ;
56327
+ return Wt ;
56337
56328
}
56338
56329
56339
56330
/// Try to replace an X constraint, which matches anything, with another that
0 commit comments