@@ -1335,8 +1335,8 @@ InstructionCost RISCVTTIImpl::getCmpSelInstrCost(unsigned Opcode, Type *ValTy,
1335
1335
return BaseT::getCmpSelInstrCost (Opcode, ValTy, CondTy, VecPred, CostKind,
1336
1336
I);
1337
1337
1338
+ std::pair<InstructionCost, MVT> LT = getTypeLegalizationCost (ValTy);
1338
1339
if (Opcode == Instruction::Select && ValTy->isVectorTy ()) {
1339
- std::pair<InstructionCost, MVT> LT = getTypeLegalizationCost (ValTy);
1340
1340
if (CondTy->isVectorTy ()) {
1341
1341
if (ValTy->getScalarSizeInBits () == 1 ) {
1342
1342
// vmandn.mm v8, v8, v9
@@ -1375,14 +1375,15 @@ InstructionCost RISCVTTIImpl::getCmpSelInstrCost(unsigned Opcode, Type *ValTy,
1375
1375
LT.second , CostKind);
1376
1376
}
1377
1377
1378
- if ((Opcode == Instruction::ICmp || Opcode == Instruction::FCmp ) &&
1379
- ValTy-> isVectorTy ( )) {
1380
- std::pair<InstructionCost, MVT> LT = getTypeLegalizationCost (ValTy);
1381
-
1382
- // Support natively.
1383
- if ( CmpInst::isIntPredicate (VecPred))
1384
- return LT. first * 1 ;
1378
+ if ((Opcode == Instruction::ICmp) && ValTy-> isVectorTy ( ) &&
1379
+ CmpInst::isIntPredicate (VecPred )) {
1380
+ // Use VMSLT_VV to represent VMSEQ, VMSNE, VMSLTU, VMSLEU, VMSLT, VMSLE
1381
+ // provided they incur the same cost across all implementations
1382
+ return LT. first *
1383
+ getRISCVInstructionCost (RISCV::VMSLT_VV, LT. second , CostKind);
1384
+ }
1385
1385
1386
+ if ((Opcode == Instruction::FCmp) && ValTy->isVectorTy ()) {
1386
1387
// If we do not support the input floating point vector type, use the base
1387
1388
// one which will calculate as:
1388
1389
// ScalarizeCost + Num * Cost for fixed vector,
0 commit comments