This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: PR rtl-optimization/54157: [x32] -maddress-mode=long failures
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: gcc-patches at gcc dot gnu dot org, rdsandiford at googlemail dot com
- Date: Wed, 1 Aug 2012 12:14:17 -0700
- Subject: Re: PATCH: PR rtl-optimization/54157: [x32] -maddress-mode=long failures
- References: <20120801184138.GA3787@intel.com> <87a9ye1lsh.fsf@talisman.home>
On Wed, Aug 1, 2012 at 11:58 AM, Richard Sandiford
<rdsandiford@googlemail.com> wrote:
> "H.J. Lu" <hongjiu.lu@intel.com> writes:
>> We have
>>
>> (gdb) r -fpreprocessed x.i -quiet -dumpbase x.i -mx32
>> -maddress-mode=long -mtune=generic -march=x86-64 -auxbase x -O2 -version
>> -ftree-vectorize -o x.s
>> Starting program: /export/build/gnu/gcc-x32/build-x86_64-linux/gcc/cc1
>> -fpreprocessed x.i -quiet -dumpbase x.i -mx32 -maddress-mode=long
>> -mtune=generic -march=x86-64 -auxbase x -O2 -version -ftree-vectorize -o
>> x.s
>> GNU C (GCC) version 4.8.0 20120801 (experimental)
>> (x86_64-unknown-linux-gnu)
>> compiled by GNU C version 4.7.1 20120629 (Red Hat 4.7.1-1), GMP
>> version 5.0.2, MPFR version 3.1.0, MPC version 0.9
>> GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
>> GNU C (GCC) version 4.8.0 20120801 (experimental)
>> (x86_64-unknown-linux-gnu)
>> compiled by GNU C version 4.7.1 20120629 (Red Hat 4.7.1-1), GMP
>> version 5.0.2, MPFR version 3.1.0, MPC version 0.9
>> GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
>> Compiler executable checksum: 07a4e516c4e8fe4abfdafa83737d8f4a
>>
>> Breakpoint 1, fancy_abort (
>> file=0x130fe68 "/export/gnu/import/git/gcc/gcc/explow.c", line=88,
>> function=0x131032e <__FUNCTION__.39220> "plus_constant")
>> at /export/gnu/import/git/gcc/gcc/diagnostic.c:1011
>> 1011 internal_error ("in %s, at %s:%d", function, trim_filename
>> (file), line);
>> (gdb) f 1
>> #1 0x0000000000743e07 in plus_constant (mode=DImode, x=0x7ffff106a7e0,
>> c=99452) at /export/gnu/import/git/gcc/gcc/explow.c:88
>> 88 gcc_assert (GET_MODE (x) == VOIDmode || GET_MODE (x) == mode);
>> (gdb) f 2
>> #2 0x0000000000adc4b1 in simplify_binary_operation_1 (code=PLUS,
>> mode=DImode,
>> op0=0x7ffff106a7e0, op1=0x7ffff1010e80, trueop0=0x7ffff106a7e0,
>> trueop1=0x7ffff1010e80)
>> at /export/gnu/import/git/gcc/gcc/simplify-rtx.c:1956
>> 1956 return plus_constant (mode, op0, INTVAL (op1));
>> (gdb) call debug_rtx (op0)
>> (symbol_ref:SI ("tmp2") <var_decl 0x7ffff0f06140 tmp2>)
>> (gdb) call debug_rtx (op1)
>> (const_int 99452 [0x1847c])
>> (gdb) bt
>> #0 fancy_abort (file=0x130fe68
>> "/export/gnu/import/git/gcc/gcc/explow.c",
>> line=88, function=0x131032e <__FUNCTION__.39220> "plus_constant")
>> at /export/gnu/import/git/gcc/gcc/diagnostic.c:1011
>> #1 0x0000000000743e07 in plus_constant (mode=DImode, x=0x7ffff106a7e0,
>> c=99452) at /export/gnu/import/git/gcc/gcc/explow.c:88
>> #2 0x0000000000adc4b1 in simplify_binary_operation_1 (code=PLUS,
>> mode=DImode,
>> op0=0x7ffff106a7e0, op1=0x7ffff1010e80, trueop0=0x7ffff106a7e0,
>> trueop1=0x7ffff1010e80)
>> at /export/gnu/import/git/gcc/gcc/simplify-rtx.c:1956
>> #3 0x0000000000adc221 in simplify_binary_operation (code=PLUS,
>> mode=DImode,
>> op0=0x7ffff106a7e0, op1=0x7ffff1010e80)
>> at /export/gnu/import/git/gcc/gcc/simplify-rtx.c:1904
>
> Things have already gone wrong by this frame: we have a DImode
> addition of an SImode value, which isn't allowed. Where does
> that mismatch get introduced?
>
make_extraction in combine generates:
7474 inner = force_to_mode (inner, wanted_inner_mode,
7475 pos_rtx
7476 || len + orig_pos >= HOST_BITS_PER_WIDE_INT
7477 ? ~(unsigned HOST_WIDE_INT) 0
7478 : ((((unsigned HOST_WIDE_INT) 1 << len) - 1)
(gdb) call debug_rtx (inner)
(plus:SI (reg:SI 109 [ D.1765 ])
(const:SI (plus:SI (symbol_ref:SI ("tmp2") <var_decl 0x7ffff0f06140 tmp2>)
(const_int 99452 [0x1847c]))))
(gdb) p wanted_inner_mode
$2 = DImode
(gdb)
--
H.J.