public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][ARM] Fix PR target/64460: Set 'shift' attr properly on some patterns
@ 2015-01-12 14:29 Kyrill Tkachov
  2015-01-12 14:38 ` Kyrill Tkachov
  0 siblings, 1 reply; 3+ messages in thread
From: Kyrill Tkachov @ 2015-01-12 14:29 UTC (permalink / raw)
  To: GCC Patches; +Cc: Ramana Radhakrishnan, Richard Earnshaw

Hi all,

In this PR we ICE when compiling with -mtune=xscale. The ICE is a 
segfault in xscale_sched_adjust_cost.
The root cause is that xscale_sched_adjust_cost uses the value of the 
'shift' insn attribute to index
the recog operands. In GCC 5 the form and number of operands in those 
patterns were updated but the
shift value was not:

Author: rearnsha <rearnsha@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Thu May 29 09:39:07 2014 +0000

             * arm/iterators.md (shiftable_ops): New code iterator.
             (t2_binop0, arith_shift_insn): New code attributes.
         * arm/predicates.md (shift_nomul_operator): New predicate.
             * arm/arm.md (insn_enabled): Delete.
             (enabled): Remove insn_enabled test.
             (*arith_shiftsi): Delete.  Replace with ...
             (*<arith_shift_insn>_multsi): ... new pattern.
         (*<arith_shift_insn>_shiftsi): ... new pattern.
         * config/arm/arm.c (arm_print_operand): Handle operand format 'b'.

This led to an out-of-bounds array access. Only xscale_sched_adjust_cost 
uses the shift
attribute, so the segfault only happens for xscale tuning. In the future 
we might want
to use a more general pattern-matching approach to find the shifted 
operand in an rtx...

In any case, this patch fixes the value of 'shift' for the offending 
pattern and also
updates 'shift'  for the *<arith_shift_insn>_shiftsi pattern to point to 
the correct
operand that is being shifted.

Tested arm-none-eabi and bootstrapped with -mtune=xscale in BOOT_CFLAGS.

Ok for trunk?

Thanks,
Kyrill

2014-01-12  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

     PR target/64460
     * config/arm/arm.md (*<arith_shift_insn>_multsi): Set 'shift' attr
     to 2.
     (*<arith_shift_insn>_shiftsi): Set 'shift' attr to 3.

2014-01-12  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

     PR target/64460
     * gcc.target/arm/pr64460_1.c: New test.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-01-14  9:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-12 14:29 [PATCH][ARM] Fix PR target/64460: Set 'shift' attr properly on some patterns Kyrill Tkachov
2015-01-12 14:38 ` Kyrill Tkachov
2015-01-14  9:58   ` Ramana Radhakrishnan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).