diff --git a/MdePkg/Library/BaseSynchronizationLib/Ia32/GccInline.c b/MdePkg/Library/BaseSynchronizationLib/Ia32/GccInline.c index bd98a5aebf..44188e265a 100644 --- a/MdePkg/Library/BaseSynchronizationLib/Ia32/GccInline.c +++ b/MdePkg/Library/BaseSynchronizationLib/Ia32/GccInline.c @@ -155,11 +155,10 @@ InternalSyncCompareExchange32 ( { __asm__ __volatile__ ( "lock \n\t" - "cmpxchgl %1, %2 \n\t" - : "=a" (CompareValue) // %0 - : "q" (ExchangeValue), // %1 - "m" (*Value), // %2 - "0" (CompareValue) // %3 + "cmpxchgl %2, %1 \n\t" + : "+a" (CompareValue), // %0 + "+m" (*Value) // %1 + : "q" (ExchangeValue) // %2 : "memory", "cc" ); diff --git a/MdePkg/Library/BaseSynchronizationLib/X64/GccInline.c b/MdePkg/Library/BaseSynchronizationLib/X64/GccInline.c index 4338fb8e65..a85cf0265c 100644 --- a/MdePkg/Library/BaseSynchronizationLib/X64/GccInline.c +++ b/MdePkg/Library/BaseSynchronizationLib/X64/GccInline.c @@ -155,12 +155,10 @@ InternalSyncCompareExchange32 ( { __asm__ __volatile__ ( "lock \n\t" - "cmpxchgl %3, %1 \n\t" - : "=a" (CompareValue), // %0 - "=m" (*Value) // %1 - : "a" (CompareValue), // %2 - "r" (ExchangeValue), // %3 - "m" (*Value) // %4 + "cmpxchgl %2, %1 \n\t" + : "+a" (CompareValue), // %0 + "+m" (*Value) // %1 + : "r" (ExchangeValue) // %2 : "memory", "cc" );