target/i386: set rip_offset for further SSE instructions
PATCH 1/1 target/i386: set rip_offset for further SSE instructions
It turns out that my recent fix to set rip_offset when emulating some SSE4.1 instructions needs generalizing to cover a wider class of instructions. Specifically, every instruction in the sse_op_table7 table, coming from various instruction set extensions, has an 8-bit immediate operand that comes after any memory operand, and so needs rip_offset set for correctness if there is a memory operand that is rip-relative, and my patch only set it for a subset of those instructions. This patch moves the rip_offset setting to cover the wider class of instructions, so fixing 9 further gcc testsuite failures in my GCC 6-based testing. (I do not know whether there might be still further classes of instructions missing this setting.)
---
target/i386/translate.c +2 -1
@@ -4077,10 +4077,11 @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b,if (!(s->cpuid_ext_features & sse_op_table7[b].ext_mask)) goto illegal_op; + s->rip_offset =1 ; +if (sse_fn_eppi ==SSE_SPECIAL ) { ot =mo_64_32 (s->dflag); rm = (modrm &7 ) |REX_B (s); - s->rip_offset =1 ;if (mod !=3 )gen_lea_modrm (env, s, modrm); reg = ((modrm >>3 ) &7 ) | rex_r;
Signature · 2 lines
Joseph S. Myers [email protected]
Paolo Bonzini
AppliedQuoted 24 lines · Joseph Myers
It turns out that my recent fix to set
rip_offsetwhen emulating some SSE4.1 instructions needs generalizing to cover a wider class of instructions. Specifically, every instruction in thesse_op_table7table, coming from various instruction set extensions, has an 8-bit immediate operand that comes after any memory operand, and so needsrip_offsetset for correctness if there is a memory operand that is rip-relative, and my patch only set it for a subset of those instructions. This patch moves therip_offsetsetting to cover the wider class of instructions, so fixing 9 further gcc testsuite failures in my GCC 6-based testing. (I do not know whether there might be still further classes of instructions missing this setting.)Signed-off-by Joseph Myers <[email protected]>---
target/i386/translate.c +0
-0@@ -4077,10 +4077,11 @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b,if (!(s->cpuid_ext_features & sse_op_table7[b].ext_mask)) goto illegal_op;
target/i386/translate.c static void gen_sse(CPUX86State *env, DisasContext *s, int b, · line 4087
Quoted 10 lines
target/i386/translate.c +2
-1+ s->rip_offset =1 ; +if (sse_fn_eppi ==SSE_SPECIAL ) { ot =mo_64_32 (s->dflag); rm = (modrm &7 ) |REX_B (s); - s->rip_offset =1 ;if (mod !=3 )gen_lea_modrm (env, s, modrm); reg = ((modrm >>3 ) &7 ) | rex_r;
Queued, thanks.
Paolo