@@ -2323,23 +2323,26 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
2323
2323
return (LT.first * 2 );
2324
2324
}
2325
2325
2326
- // If we can't lower fmuladd into an FMA estimate the cost as a floating
2327
- // point mul followed by an add.
2328
- if (IID == Intrinsic::fmuladd)
2326
+ switch (IID) {
2327
+ case Intrinsic::fmuladd: {
2328
+ // If we can't lower fmuladd into an FMA estimate the cost as a floating
2329
+ // point mul followed by an add.
2330
+
2329
2331
return thisT ()->getArithmeticInstrCost (BinaryOperator::FMul, RetTy,
2330
2332
CostKind) +
2331
2333
thisT ()->getArithmeticInstrCost (BinaryOperator::FAdd, RetTy,
2332
2334
CostKind);
2333
- if (IID == Intrinsic::experimental_constrained_fmuladd) {
2335
+ }
2336
+ case Intrinsic::experimental_constrained_fmuladd: {
2334
2337
IntrinsicCostAttributes FMulAttrs (
2335
2338
Intrinsic::experimental_constrained_fmul, RetTy, Tys);
2336
2339
IntrinsicCostAttributes FAddAttrs (
2337
2340
Intrinsic::experimental_constrained_fadd, RetTy, Tys);
2338
2341
return thisT ()->getIntrinsicInstrCost (FMulAttrs, CostKind) +
2339
2342
thisT ()->getIntrinsicInstrCost (FAddAttrs, CostKind);
2340
2343
}
2341
-
2342
- if (IID == Intrinsic::sadd_sat || IID == Intrinsic:: ssub_sat) {
2344
+ case Intrinsic::sadd_sat:
2345
+ case Intrinsic::ssub_sat: {
2343
2346
// Assume a default expansion.
2344
2347
Type *CondTy = RetTy->getWithNewBitWidth (1 );
2345
2348
@@ -2361,8 +2364,8 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
2361
2364
CondTy, Pred, CostKind);
2362
2365
return Cost;
2363
2366
}
2364
-
2365
- if (IID == Intrinsic::uadd_sat || IID == Intrinsic:: usub_sat) {
2367
+ case Intrinsic::uadd_sat:
2368
+ case Intrinsic::usub_sat: {
2366
2369
Type *CondTy = RetTy->getWithNewBitWidth (1 );
2367
2370
2368
2371
Type *OpTy = StructType::create ({RetTy, CondTy});
@@ -2379,6 +2382,9 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
2379
2382
CmpInst::BAD_ICMP_PREDICATE, CostKind);
2380
2383
return Cost;
2381
2384
}
2385
+ default :
2386
+ break ;
2387
+ }
2382
2388
2383
2389
// Else, assume that we need to scalarize this intrinsic. For math builtins
2384
2390
// this will emit a costly libcall, adding call overhead and spills. Make it
0 commit comments