[Bug target/49281] New: lea_general_4 doesn't work for x32

hjl.tools at gmail dot com gcc-bugzilla@gcc.gnu.org
Sat Jun 4 01:08:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49281

           Summary: lea_general_4 doesn't work for x32
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: hjl.tools@gmail.com
                CC: jakub@redhat.com, ubizjak@gmail.com


We added:

(define_insn_and_split "*lea_general_4"
  [(set (match_operand:SWI 0 "register_operand" "=r")
        (any_or:SWI (ashift:SWI (match_operand:SWI 1 "index_register_operand"
"l")
                                (match_operand:SWI 2 "const_int_operand" "n"))
                    (match_operand 3 "const_int_operand" "n")))]
  "(<MODE>mode == DImode
    || <MODE>mode == SImode
    || !TARGET_PARTIAL_REG_STALL
    || optimize_function_for_size_p (cfun))
   && ((unsigned HOST_WIDE_INT) INTVAL (operands[2])) - 1 < 3
   && ((unsigned HOST_WIDE_INT) INTVAL (operands[3])
       <= ((unsigned HOST_WIDE_INT) 1 << INTVAL (operands[2])))"
  "#"
  "&& reload_completed"
  [(const_int 0)]
{
  rtx pat;
  if (<MODE>mode != DImode)
    operands[0] = gen_lowpart (SImode, operands[0]);
  operands[1] = gen_lowpart (Pmode, operands[1]);
  operands[2] = GEN_INT (1 << INTVAL (operands[2]));
  pat = plus_constant (gen_rtx_MULT (Pmode, operands[1], operands[2]),
                       INTVAL (operands[3]));
  if (Pmode != SImode && <MODE>mode != DImode)
    pat = gen_rtx_SUBREG (SImode, pat, 0);
  emit_insn (gen_rtx_SET (VOIDmode, operands[0], pat));
  DONE;
}
  [(set_attr "type" "lea")
   (set (attr "mode")
      (if_then_else (eq (symbol_ref "<MODE>mode == DImode") (const_int 0))
        (const_string "SI")
        (const_string "DI")))])

It miscompiled 458.sjeng and 464.h264ref in SPEC CPU 2006 on x32.
I am trying to figure out what went wrong.



More information about the Gcc-bugs mailing list