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