@@ -298,31 +298,24 @@ RISCVCallLowering::RISCVCallLowering(const RISCVTargetLowering &TLI)
298
298
: CallLowering(&TLI) {}
299
299
300
300
// / Return true if scalable vector with ScalarTy is legal for lowering.
301
- static bool isLegalElementTypeForRVV (EVT ScalarTy ,
301
+ static bool isLegalElementTypeForRVV (Type *EltTy ,
302
302
const RISCVSubtarget &Subtarget) {
303
- if (!ScalarTy.isSimple ())
304
- return false ;
305
- switch (ScalarTy.getSimpleVT ().SimpleTy ) {
306
- case MVT::iPTR:
303
+ if (EltTy->isPointerTy ())
307
304
return Subtarget.is64Bit () ? Subtarget.hasVInstructionsI64 () : true ;
308
- case MVT::i1:
309
- case MVT::i8:
310
- case MVT::i16:
311
- case MVT::i32:
305
+ if (EltTy->isIntegerTy (1 ) || EltTy->isIntegerTy (8 ) ||
306
+ EltTy->isIntegerTy (16 ) || EltTy->isIntegerTy (32 ))
312
307
return true ;
313
- case MVT::i64:
308
+ if (EltTy-> isIntegerTy ( 64 ))
314
309
return Subtarget.hasVInstructionsI64 ();
315
- case MVT::f16:
310
+ if (EltTy-> isHalfTy ())
316
311
return Subtarget.hasVInstructionsF16 ();
317
- case MVT::bf16:
312
+ if (EltTy-> isBFloatTy ())
318
313
return Subtarget.hasVInstructionsBF16 ();
319
- case MVT::f32:
314
+ if (EltTy-> isFloatTy ())
320
315
return Subtarget.hasVInstructionsF32 ();
321
- case MVT::f64:
316
+ if (EltTy-> isDoubleTy ())
322
317
return Subtarget.hasVInstructionsF64 ();
323
- default :
324
- return false ;
325
- }
318
+ return false ;
326
319
}
327
320
328
321
// TODO: Support all argument types.
@@ -340,7 +333,7 @@ static bool isSupportedArgumentType(Type *T, const RISCVSubtarget &Subtarget,
340
333
// TODO: Support fixed vector types.
341
334
if (IsLowerArgs && T->isVectorTy () && Subtarget.hasVInstructions () &&
342
335
T->isScalableTy () &&
343
- isLegalElementTypeForRVV (EVT::getEVT ( T->getScalarType () ), Subtarget))
336
+ isLegalElementTypeForRVV (T->getScalarType (), Subtarget))
344
337
return true ;
345
338
return false ;
346
339
}
0 commit comments