qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH-for-10.1] target/i386: Replace MO_TE -> MO_LE
@ 2025-03-12 10:38 Philippe Mathieu-Daudé
  2025-03-12 12:52 ` Richard Henderson
  0 siblings, 1 reply; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-03-12 10:38 UTC (permalink / raw)
  To: qemu-devel
  Cc: Richard Henderson, Paolo Bonzini, Eduardo Habkost,
	Philippe Mathieu-Daudé

The x86 architecture is only implemented as little-endian.
The MO_TE definition always expands to MO_LE.

Replace:
 - MO_TEUQ -> MO_LE | MO_UQ
 - MO_TE   -> MO_LE

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 target/i386/tcg/emit.c.inc | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/target/i386/tcg/emit.c.inc b/target/i386/tcg/emit.c.inc
index 0fa1664a24f..c7a40a2f9e4 100644
--- a/target/i386/tcg/emit.c.inc
+++ b/target/i386/tcg/emit.c.inc
@@ -1796,7 +1796,7 @@ static void gen_CMPXCHG(DisasContext *s, X86DecodedInsn *decode)
 static void gen_CMPXCHG16B(DisasContext *s, X86DecodedInsn *decode)
 {
 #ifdef TARGET_X86_64
-    MemOp mop = MO_TE | MO_128 | MO_ALIGN;
+    MemOp mop = MO_LE | MO_128 | MO_ALIGN;
     TCGv_i64 t0, t1;
     TCGv_i128 cmp, val;
 
@@ -1853,10 +1853,11 @@ static void gen_CMPXCHG8B(DisasContext *s, X86DecodedInsn *decode)
 
     /* Only require atomic with LOCK; non-parallel handled in generator. */
     if (s->prefix & PREFIX_LOCK) {
-        tcg_gen_atomic_cmpxchg_i64(old, s->A0, cmp, val, s->mem_index, MO_TEUQ);
+        tcg_gen_atomic_cmpxchg_i64(old, s->A0, cmp, val,
+                                   s->mem_index, MO_LE | MO_UQ);
     } else {
         tcg_gen_nonatomic_cmpxchg_i64(old, s->A0, cmp, val,
-                                      s->mem_index, MO_TEUQ);
+                                      s->mem_index, MO_LE | MO_UQ);
     }
 
     /* Set tmp0 to match the required value of Z. */
-- 
2.47.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH-for-10.1] target/i386: Replace MO_TE -> MO_LE
  2025-03-12 10:38 [PATCH-for-10.1] target/i386: Replace MO_TE -> MO_LE Philippe Mathieu-Daudé
@ 2025-03-12 12:52 ` Richard Henderson
  2025-03-12 14:13   ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Henderson @ 2025-03-12 12:52 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel; +Cc: Paolo Bonzini, Eduardo Habkost

On 3/12/25 03:38, Philippe Mathieu-Daudé wrote:
> The x86 architecture is only implemented as little-endian.
> The MO_TE definition always expands to MO_LE.
> 
> Replace:
>   - MO_TEUQ -> MO_LE | MO_UQ
>   - MO_TE   -> MO_LE
> 
> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> ---
>   target/i386/tcg/emit.c.inc | 7 ++++---
>   1 file changed, 4 insertions(+), 3 deletions(-)

Is there a reason not to use MO_LEUQ?  Anyway,

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH-for-10.1] target/i386: Replace MO_TE -> MO_LE
  2025-03-12 12:52 ` Richard Henderson
@ 2025-03-12 14:13   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-03-12 14:13 UTC (permalink / raw)
  To: Richard Henderson, qemu-devel; +Cc: Paolo Bonzini, Eduardo Habkost

On 12/3/25 13:52, Richard Henderson wrote:
> On 3/12/25 03:38, Philippe Mathieu-Daudé wrote:
>> The x86 architecture is only implemented as little-endian.
>> The MO_TE definition always expands to MO_LE.
>>
>> Replace:
>>   - MO_TEUQ -> MO_LE | MO_UQ
>>   - MO_TE   -> MO_LE
>>
>> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
>> ---
>>   target/i386/tcg/emit.c.inc | 7 ++++---
>>   1 file changed, 4 insertions(+), 3 deletions(-)
> 
> Is there a reason not to use MO_LEUQ?

No, I'll respin using it.

>  Anyway,
> 
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

Thanks!


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-03-12 14:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-12 10:38 [PATCH-for-10.1] target/i386: Replace MO_TE -> MO_LE Philippe Mathieu-Daudé
2025-03-12 12:52 ` Richard Henderson
2025-03-12 14:13   ` Philippe Mathieu-Daudé

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).