This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, rtl-optimization]: Fix PR37997: ICE shifting byte to the right with constant > 7FFFFFFF


> Convert modes is called from expand_binop_directly, and we try to figure
> out the mode of the constant via:
>
>    if (GET_MODE (xop0) != mode0 && mode0 != VOIDmode)
>      xop0 = convert_modes (mode0,
>                GET_MODE (xop0) != VOIDmode
>                ? GET_MODE (xop0)
>
>                : mode,
>
>                xop0, unsignedp);
>
> where mode is the mode of the insn and mode0 is the mode of operand
> predicate. For QImode operator, this ends with QImode/QImode. See
> optabs.c around line 1460.

Thanks.  It would be interesting to understand why this doesn't happen for 
0x7fffffff but for 0x80000000:

int test (char v1)
{
  v1 >>= 0x7fffffff;
  v1 >>= 0x80000000;
  return v1;
}

pr39779.c:6:1: error: unrecognizable insn:
(insn 10 9 11 3 pr39779.c:4 (set (reg:QI 63)
        (const_int -2147483648 [0x80000000])) -1 (nil))
pr39779.c:6:1: internal compiler error: in extract_insn, at recog.c:2093

test (char v1)
{
  int D.1977;
  int D.1976;
  int D.1975;

<bb 2>:
  D.1975_2 = (int) v1_1(D);
  D.1976_3 = D.1975_2 >> 2147483647;
  v1_4 = (char) D.1976_3;
  v1_5 = v1_4 >> -2147483648;
  D.1977_6 = (int) v1_5;
  return D.1977_6;

}

Joseph, do you have any insight?

-- 
Eric Botcazou


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]