Porting TCG to alpha platform

Submitted by Richard Henderson on Jan. 29, 2010, 5:37 p.m.

Details

Message ID 4B631CD7.3010900@twiddle.net
State New
Headers show

Commit Message

Richard Henderson Jan. 29, 2010, 5:37 p.m.
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 <rth@twiddle.net>
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.

Patch hide | download patch | download mbox

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;