@@ -736,8 +736,9 @@ static unsigned int getCodeMemorySemantic(MemSDNode *N,
736
736
// | No | Yes | Generic,Shared, | .volatile | .volatile |
737
737
// | | | Global [0] | | |
738
738
// | No | Yes | Local,Const,Param | plain [1] | .weak [1] |
739
- // | Relaxed | No | Generic,Shared, | | |
740
- // | | | Global [0] | .volatile | <atomic sem> |
739
+ // | Unorder | Yes/No | All | == Relaxed | == Relaxed |
740
+ // | Relaxed | No | Generic,Shared, | .volatile | <atomic sem> |
741
+ // | | | Global [0] | | |
741
742
// | Other | No | Generic,Shared, | Error [2] | <atomic sem> |
742
743
// | | | Global [0] | | |
743
744
// | Yes | No | Local,Const,Param | plain [1] | .weak [1] |
@@ -794,9 +795,10 @@ static unsigned int getCodeMemorySemantic(MemSDNode *N,
794
795
return NVPTX::PTXLdStInstCode::NotAtomic;
795
796
}
796
797
797
- // [2]: Atomics with Ordering different than Relaxed are not supported on
798
- // sm_60 and older; this includes volatile atomics.
798
+ // [2]: Atomics with Ordering different than Unordered or Relaxed are not
799
+ // supported on sm_60 and older; this includes volatile atomics.
799
800
if (!(Ordering == AtomicOrdering::NotAtomic ||
801
+ Ordering == AtomicOrdering::Unordered ||
800
802
Ordering == AtomicOrdering::Monotonic) &&
801
803
!HasMemoryOrdering) {
802
804
SmallString<256 > Msg;
@@ -826,6 +828,9 @@ static unsigned int getCodeMemorySemantic(MemSDNode *N,
826
828
return N->isVolatile () && AddrGenericOrGlobalOrShared
827
829
? NVPTX::PTXLdStInstCode::Volatile
828
830
: NVPTX::PTXLdStInstCode::NotAtomic;
831
+ case AtomicOrdering::Unordered:
832
+ // We lower unordered in the exact same way as 'monotonic' to respect
833
+ // LLVM IR atomicity requirements.
829
834
case AtomicOrdering::Monotonic:
830
835
if (N->isVolatile ())
831
836
return UseRelaxedMMIO ? NVPTX::PTXLdStInstCode::RelaxedMMIO
@@ -866,7 +871,6 @@ static unsigned int getCodeMemorySemantic(MemSDNode *N,
866
871
report_fatal_error (OS.str ());
867
872
}
868
873
case AtomicOrdering::SequentiallyConsistent:
869
- case AtomicOrdering::Unordered:
870
874
// TODO: support AcquireRelease and SequentiallyConsistent
871
875
SmallString<256 > Msg;
872
876
raw_svector_ostream OS (Msg);
0 commit comments