[COMMITTED] Fix ICE compiling sbgdec.c in ffmpeg package

John David Anglin dave.anglin@bell.net
Sat Sep 12 15:02:00 GMT 2015

The attached change fixes an ICE caused by pa_output_move_double's failure to handle a DImode high
const_int operand, (high:DI (const_int 86400000000 [0x141dd76000])).  The need to handle this operand
form in pa_output_move_double is quite infrequent, so the problem has gone unnoticed for many years.

This issue only affects 32-bit targets.

DImode constants are split by pa_emit_move_sequence into high and lo_sum parts.  These parts are
handled by separate insn patterns in pa.md.  There is a third pattern which handles all other DImode moves
using pa_output_move_double for moves involving the integer registers.  There is an 'i' immediate_operand
constraint to handle immediate operands.  The problem occurs when an equivalent reg value,
REG_EQUIV (high:DI (const_int 86400000000 [0x141dd76000])), is substituted for a register operand and
the instruction is NOT re-recognized.

Splitting DImode constants was presumably done to improve optimization opportunities.  However, this only
works because the predicate does not allow immediate operands.  This is not recommended since insn recognition
may fail if an immediate operand is substituted (e.g., a const_int) as there is no predicate that accepts a const_int.
However, if the predicate is changed to allow immediate operands, then the high/lo_sum splits are just put back
together and the optimization benefit lost.  There is no cost benefit in doing this, so I'm not sure why it happens.

There is also an issue regarding the insn length when we have a high immediate operand.  It should be
12 not 16 for that case.  I intend to look at fixing this but it's not a major issue.

Tested on hppa-unknown-linux-gnu and hppa2.0w-hp-hpux11.11 with no regressions.  Committed to active
branches and trunk.

John David Anglin	dave.anglin@bell.net

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: dimode.d.5.txt
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20150912/962e5fb1/attachment.txt>

More information about the Gcc-patches mailing list