@@ -1360,12 +1360,15 @@ static bool upgradeIntrinsicFunction1(Function *F, Function *&NewFn,
1360
1360
// nvvm.{min,max}.{i,ii,ui,ull}
1361
1361
Expand = Name == " s" || Name == " i" || Name == " ll" || Name == " us" ||
1362
1362
Name == " ui" || Name == " ull" ;
1363
- else if (Name.consume_front (" atomic.load.add." ))
1364
- // nvvm.atomic.load.add.{f32.p,f64.p}
1365
- Expand = Name.starts_with (" f32.p" ) || Name.starts_with (" f64.p" );
1366
- else if (Name.consume_front (" atomic.load." ) && Name.consume_back (" .32" ))
1367
- // nvvm.atomic.load.{inc,dec}.32
1368
- Expand = Name == " inc" || Name == " dec" ;
1363
+ else if (Name.consume_front (" atomic.load." ))
1364
+ // nvvm.atomic.load.add.{f32,f64}.p
1365
+ // nvvm.atomic.load.{inc,dec}.32.p
1366
+ Expand = StringSwitch<bool >(Name)
1367
+ .StartsWith (" add.f32.p" , true )
1368
+ .StartsWith (" add.f64.p" , true )
1369
+ .StartsWith (" inc.32.p" , true )
1370
+ .StartsWith (" dec.32.p" , true )
1371
+ .Default (false );
1369
1372
else if (Name.consume_front (" bitcast." ))
1370
1373
// nvvm.bitcast.{f2i,i2f,ll2d,d2ll}
1371
1374
Expand =
@@ -2407,10 +2410,12 @@ static Value *upgradeNVVMIntrinsicCall(StringRef Name, CallBase *CI,
2407
2410
Value *Val = CI->getArgOperand (1 );
2408
2411
Rep = Builder.CreateAtomicRMW (AtomicRMWInst::FAdd, Ptr, Val, MaybeAlign (),
2409
2412
AtomicOrdering::SequentiallyConsistent);
2410
- } else if (Name.consume_front (" atomic.load." ) && Name.consume_back (" .32" )) {
2413
+ } else if (Name.starts_with (" atomic.load.inc.32.p" ) ||
2414
+ Name.starts_with (" atomic.load.dec.32.p" )) {
2411
2415
Value *Ptr = CI->getArgOperand (0 );
2412
2416
Value *Val = CI->getArgOperand (1 );
2413
- auto Op = Name == " inc" ? AtomicRMWInst::UIncWrap : AtomicRMWInst::UDecWrap;
2417
+ auto Op = Name.starts_with (" atomic.load.inc" ) ? AtomicRMWInst::UIncWrap
2418
+ : AtomicRMWInst::UDecWrap;
2414
2419
Rep = Builder.CreateAtomicRMW (Op, Ptr, Val, MaybeAlign (),
2415
2420
AtomicOrdering::SequentiallyConsistent);
2416
2421
} else if (Name.consume_front (" max." ) &&
0 commit comments