Skip to content
  • Aurelien Jarno's avatar
    tcg/arm: fix cross-endian qemu_st16 · 7aab08aa
    Aurelien Jarno authored
    
    
    The bswap16 TCG opcode assumes that the high bytes of the temp equal
    to 0 before calling it. The ARM backend implementation takes this
    assumption to slightly optimize the generated code.
    
    The same implementation is called for implementing the cross-endian
    qemu_st16 opcode, where this assumption is not true anymore. One way to
    fix that would be to zero the high bytes before calling it. Given the
    store instruction just ignore them, it is possible to provide a slightly
    more optimized version. With ARMv6+ the rev16 instruction does the work
    correctly. For lower ARM versions the patch provides a version which
    behaves correctly with non-zero high bytes, but fill them with junk.
    
    Cc: Andrzej Zaborowski <balrogg@gmail.com>
    Cc: Peter Maydell <peter.maydell@linaro.org>
    Cc: qemu-stable@nongnu.org
    Reviewed-by: default avatarPeter Maydell <peter.maydell@linaro.org>
    Signed-off-by: default avatarAurelien Jarno <aurelien@aurel32.net>
    7aab08aa