@@ -2545,8 +2545,6 @@ void CGOpenMPRuntimeGPU::processRequiresDirective(const OMPRequiresDecl *D) {
25452545 case OffloadArch::GFX90a:
25462546 case OffloadArch::GFX90c:
25472547 case OffloadArch::GFX9_4_GENERIC:
2548- case OffloadArch::GFX940:
2549- case OffloadArch::GFX941:
25502548 case OffloadArch::GFX942:
25512549 case OffloadArch::GFX950:
25522550 case OffloadArch::GFX10_1_GENERIC:
@@ -3380,58 +3378,6 @@ void CGOpenMPRuntimeGPU::emitFlush(CodeGenFunction &CGF, ArrayRef<const Expr *>,
33803378 }
33813379}
33823380
3383- // The only allowed atomicrmw is add on int 32 and 64 bits, cmp_and_swap, swap.
3384- bool CGOpenMPRuntimeGPU::mustEmitSafeAtomic (CodeGenFunction &CGF, LValue X,
3385- RValue Update,
3386- BinaryOperatorKind BO) {
3387- ASTContext &Context = CGF.getContext ();
3388- OffloadArch Arch = getOffloadArch (CGM);
3389-
3390- if (!Context.getTargetInfo ().getTriple ().isAMDGCN () ||
3391- !CGF.CGM .getLangOpts ().OpenMPIsTargetDevice )
3392- return false ;
3393-
3394- if (Arch != OffloadArch::GFX941)
3395- return false ;
3396-
3397- // Non simple types cannot be used in atomicRMW and are handled elsewhere
3398- if (!X.isSimple ())
3399- return false ;
3400-
3401- // Integer types are lowered by backend to atomic ISA (32 and 64 bits) or to
3402- // CAS loop (all other bit widths).
3403- if (BO == BO_Add && Update.getScalarVal ()->getType ()->isIntegerTy ())
3404- return false ;
3405-
3406- // For all other operations, integer types that are not 32 or 64 bits are
3407- // already converted to CAS loop by clang codegen or backend. This allows for
3408- // simpler handling in devicertl call.
3409- if (Update.getScalarVal ()->getType ()->isIntegerTy () &&
3410- (Context.getTypeSize (X.getType ()) < 32 ||
3411- Context.getTypeSize (X.getType ()) > 64 ))
3412- return false ;
3413-
3414- // float and double have a atomic ISA for min, max, and add that need to be
3415- // bypassed. All other operations on float and double are lowered to cas loop
3416- // by the backend
3417- if ((Update.getScalarVal ()->getType ()->isFloatTy () ||
3418- Update.getScalarVal ()->getType ()->isDoubleTy ()) &&
3419- !((BO == BO_Add) || (BO == BO_LT) || (BO == BO_GT)))
3420- return false ;
3421-
3422- // For all types, the ISA only supports certain operations in a "native" way.
3423- // All others are lowered to a CAS loop by the backend
3424- if (!((BO == BO_Add) || (BO == BO_Sub) || (BO == BO_LT) || (BO == BO_GT) ||
3425- (BO == BO_And) || (BO == BO_Or) || (BO == BO_Xor)))
3426- return false ;
3427-
3428- // all other cases must be lowered to safe CAS loop
3429- // which is hidden in a runtime function that uses cmpxchg directly and not
3430- // atomicrmw. This is effectively bypassing the backend on the decision of
3431- // what atomic to use.
3432- return true ;
3433- }
3434-
34353381std::pair<bool , RValue>
34363382CGOpenMPRuntimeGPU::emitAtomicCASLoop (CodeGenFunction &CGF, LValue X,
34373383 RValue Update, BinaryOperatorKind BO) {
0 commit comments