From patchwork Fri Jan 29 17:37:27 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Porting TCG to alpha platform Date: Fri, 29 Jan 2010 07:37:27 -0000 From: Richard Henderson X-Patchwork-Id: 44002 Message-Id: <4B631CD7.3010900@twiddle.net> To: identifier scorpio Cc: qemu-devel@nongnu.org On 01/25/2010 05:19 PM, Richard Henderson wrote: > + } else if (~val == (uint8_t)~val) { > + tcg_out_fmt_opi(s, INSN_BIC, ra, ~val, rc); Bug here. I've applied the following to my local tree. r~ commit 2ecce92da6eee4b3496c7655da45259308abb536 Author: Richard Henderson Date: Fri Jan 29 09:36:28 2010 -0800 tcg-alpha: Fix cast error with immediate op to BIC. The cast was in the wrong place. A change to ~(uint8_t)val would technically produce the correct result, but via a string of implicit conversions that are more difficult to follow than simply using the 0xff mask with the original type. Adjust the AND test to match, lexically, for cleanliness. diff --git a/tcg/alpha/tcg-target.c b/tcg/alpha/tcg-target.c index dcf23f2..5b7dd25 100644 --- a/tcg/alpha/tcg-target.c +++ b/tcg/alpha/tcg-target.c @@ -344,9 +344,9 @@ static inline void tcg_out_addi(TCGContext *s, int reg, long val) static void tcg_out_andi(TCGContext *s, int ra, long val, int rc) { - if (val == (uint8_t)val) { + if (val == (val & 0xff)) { tcg_out_fmt_opi(s, INSN_AND, ra, val, rc); - } else if (~val == (uint8_t)~val) { + } else if (~val == ~(val & 0xff)) { tcg_out_fmt_opi(s, INSN_BIC, ra, ~val, rc); } else { long mask0, maskff;