Hi guys, in pass .166r.split1, avr-gcc makes a wrong transformation for the following testcase, compiled with -O:

void g(unsigned char);

void f1(unsigned x)
{
        unsigned char y;
        y = (x >> 12) & 0x0F;
        g(y);
}

It deletes this insn

(insn 8 20 9 2 foo.c:7 (set (reg:QI 24 r24)
        (lshiftrt:QI (reg:QI 25 r25 [ x+1 ])
(const_int 4 [0x4]))) 63 {*lshrqi3_const4} (expr_list:REG_DEAD (reg:QI 25 r25 [ x+1 ])
        (nil)))

and replaces with the obviously wrong UNSPEC_SWAP

(insn 22 20 23 2 foo.c:7 (set (reg:QI 24 r24)
        (unspec:QI [
                (reg:QI 24 r24)
            ] 2)) -1 (nil))

I didn't debug yet, seems to be a prob of missing constraints or match_dup before reload in the splitter

(define_split   ; lshrqi3_const4
  [(set (match_operand:QI 0 "d_register_operand" "")
        (lshiftrt:QI (match_dup 0)
                     (const_int 4)))]
  ""
  [(set (match_dup 0) (unspec:QI [(match_dup 0)] UNSPEC_SWAP))
   (set (match_dup 0) (and:QI (match_dup 0) (const_int 15)))]
  "")

Georg-Johann


_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Reply via email to