From: Lars Knoll Date: Sat, 16 Feb 2013 19:44:53 +0000 (+0100) Subject: Fix inline assembly version of ushr X-Git-Tag: upstream/5.2.1~669^2~659^2~213 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=baf73673e15e7a2a4594a53d953a76c021b9fc82;p=platform%2Fupstream%2Fqtdeclarative.git Fix inline assembly version of ushr -1 >> 0 should return UINT_MAX, as the result is an unsigned int according to spec. The only way the result of the inline shr operation can be signed is by shifting 0 bytes. But the easiest implementation is to test the result for signed-ness and then fall back to the slow implementation. Change-Id: Ic4614006d06cf01376ef95b6f23ca2c7216a2812 Reviewed-by: Simon Hausmann --- diff --git a/src/v4/qv4isel_masm_p.h b/src/v4/qv4isel_masm_p.h index c68ee91..91c908f 100644 --- a/src/v4/qv4isel_masm_p.h +++ b/src/v4/qv4isel_masm_p.h @@ -648,14 +648,24 @@ public: load32(addr, ScratchRegister); and32(TrustedImm32(0x1f), ScratchRegister); urshift32(ScratchRegister, reg); - return Jump(); +#if CPU(X86) || CPU(X86_64) + m_assembler.testl_rr(reg, reg); + return Jump(m_assembler.jCC(x86Condition(Signed))); +#else +#error "Implement me: Branch if result is negative" +#endif } Jump inline_ushr32(TrustedImm32 imm, RegisterID reg) { imm.m_value &= 0x1f; urshift32(imm, reg); - return Jump(); +#if CPU(X86) || CPU(X86_64) + m_assembler.testl_rr(reg, reg); + return Jump(m_assembler.jCC(x86Condition(Signed))); +#else +#error "Implement me: Branch if result is negative" +#endif } Jump inline_and32(Address addr, RegisterID reg)