Skip to contentSkip to conversation

target/i386: Inline translator_ld[uw,l,q]() calls

PATCH In review Philippe Mathieu-Daudé 2 participants 3 messages Feb 2 – Feb 3

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target/i386: Inline translator_ld[uw,l,q]() calls

In preparation of removing the translator_ld[uw,l,q]() methods, inline them for the x86 targets, expanding MO_TE -> MO_LE since the architecture uses little endian order.

Mechanical change using the following Coccinelle 'spatch' script:

    @@
    expression env, db, pc, do_swap;
    @@
    (
    - translator_lduw(env, db, pc)
    + translator_lduw_end(env, db, pc, MO_LE)
    |
    - translator_ldl(env, db, pc)
    + translator_ldl_end(env, db, pc, MO_LE)
    |
    - translator_ldq(env, db, pc)
    + translator_ldq_end(env, db, pc, MO_LE)
    )
---
 target/i386/tcg/decode-new.c.inc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
target/i386/tcg/decode-new.c.inc +3 -3
index 086a3bcec18..bc105aab9ea 100644
@@ -315,18 +315,18 @@ static inline uint8_t x86_ldub_code(CPUX86State *env, DisasContext *s)
 
 static inline uint16_t x86_lduw_code(CPUX86State *env, DisasContext *s)
 {
-    return translator_lduw(env, &s->base, advance_pc(env, s, 2));
+    return translator_lduw_end(env, &s->base, advance_pc(env, s, 2), MO_LE);
 }
 
 static inline uint32_t x86_ldl_code(CPUX86State *env, DisasContext *s)
 {
-    return translator_ldl(env, &s->base, advance_pc(env, s, 4));
+    return translator_ldl_end(env, &s->base, advance_pc(env, s, 4), MO_LE);
 }
 
 #ifdef TARGET_X86_64
 static inline uint64_t x86_ldq_code(CPUX86State *env, DisasContext *s)
 {
-    return translator_ldq(env, &s->base, advance_pc(env, s, 8));
+    return translator_ldq_end(env, &s->base, advance_pc(env, s, 8), MO_LE);
 }
 #endif
 
Signature · 1 line
2.52.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 20 lines · Philippe Mathieu-Daudé

In preparation of removing the translator_ld[uw,l,q]() methods, inline them for the x86 targets, expanding MO_TE -> MO_LE since the architecture uses little endian order.

Mechanical change using the following Coccinelle 'spatch' script:

     @@
     expression env, db, pc, do_swap;
     @@
     (
     - translator_lduw(env, db, pc)
     + translator_lduw_end(env, db, pc, MO_LE)
     |
     - translator_ldl(env, db, pc)
     + translator_ldl_end(env, db, pc, MO_LE)
     |
     - translator_ldq(env, db, pc)
     + translator_ldq_end(env, db, pc, MO_LE)
     )
Quoted 4 lines
---
  target/i386/tcg/decode-new.c.inc | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

r~

#2 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 20 lines · Philippe Mathieu-Daudé

In preparation of removing the translator_ld[uw,l,q]() methods, inline them for the x86 targets, expanding MO_TE -> MO_LE since the architecture uses little endian order.

Mechanical change using the following Coccinelle 'spatch' script:

     @@
     expression env, db, pc, do_swap;
     @@
     (
     - translator_lduw(env, db, pc)
     + translator_lduw_end(env, db, pc, MO_LE)
     |
     - translator_ldl(env, db, pc)
     + translator_ldl_end(env, db, pc, MO_LE)
     |
     - translator_ldq(env, db, pc)
     + translator_ldq_end(env, db, pc, MO_LE)
     )
Quoted 4 lines
---
  target/i386/tcg/decode-new.c.inc | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

Patch queued, thanks.