Message ID | 1436958199-5181-8-git-send-email-aurelien@aurel32.net |
---|---|
State | New |
Headers | show |
On 07/15/2015 12:03 PM, Aurelien Jarno wrote: > When ext_i32_i64 and extu_i32_i64 ops are not implemented, this means > that the register is already properly zero/sign extended, so we can > simply replace it by a mov. > > In practice it means at least one of the two ops should always be > implemented on 64-bit targets. > > Cc: Paolo Bonzini<pbonzini@redhat.com> > Cc: Richard Henderson<rth@twiddle.net> > Signed-off-by: Aurelien Jarno<aurelien@aurel32.net> > --- > tcg/tcg-op.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) If we're going to do this (and of course pick a solution for all of the other backends), I think perhaps x86 should choose trunc + exts as the two that should be implemented, leaving extu the one that can be folded away. Something to experiment with... r~
diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c index c8db812..b4b1654 100644 --- a/tcg/tcg-op.c +++ b/tcg/tcg-op.c @@ -1775,7 +1775,7 @@ void tcg_gen_extu_i32_i64(TCGv_i64 ret, TCGv_i32 arg) } else { /* Note: we assume the target supports move between 32 and 64 bit registers. */ - tcg_gen_ext32u_i64(ret, MAKE_TCGV_I64(GET_TCGV_I32(arg))); + tcg_gen_mov_i64(ret, MAKE_TCGV_I64(GET_TCGV_I32(arg))); } } @@ -1790,7 +1790,7 @@ void tcg_gen_ext_i32_i64(TCGv_i64 ret, TCGv_i32 arg) } else { /* Note: we assume the target supports move between 32 and 64 bit registers. */ - tcg_gen_ext32s_i64(ret, MAKE_TCGV_I64(GET_TCGV_I32(arg))); + tcg_gen_mov_i64(ret, MAKE_TCGV_I64(GET_TCGV_I32(arg))); } }
When ext_i32_i64 and extu_i32_i64 ops are not implemented, this means that the register is already properly zero/sign extended, so we can simply replace it by a mov. In practice it means at least one of the two ops should always be implemented on 64-bit targets. Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Richard Henderson <rth@twiddle.net> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> --- tcg/tcg-op.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)