This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH][RFA][LRA] Don't try to break down subreg expressions if insn already matches
- From: pinskia at gmail dot com
- To: Kyrill Tkachov <kyrylo dot tkachov at arm dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Vladimir Makarov <vmakarov at redhat dot com>
- Date: Fri, 13 Feb 2015 02:10:54 -0800
- Subject: Re: [PATCH][RFA][LRA] Don't try to break down subreg expressions if insn already matches
- Authentication-results: sourceware.org; auth=none
- References: <54DDC859 dot 3010805 at arm dot com>
> On Feb 13, 2015, at 1:48 AM, Kyrill Tkachov <email@example.com> wrote:
> Hi all,
> In my tree added a pattern to the arm backend that's supposed to match:
> (set (reg:SI r0)
> (mult:DI (sign_extend:DI (reg:SI r1))
> (sign_extend:DI (reg:SI r2)))
> (const_int 2147483648 [0x80000000])) 4))
> That is, take two SImode regs, sign-extend to DImode, multiply in DImode,
> add a const_int and take the most significant SImode subreg.
Seems better to use shifts for the most significant simode and low part subreg after that. Isn't that what other targets do?
> Combine matches it fine but I get an ICE in lra:
> 0xa665a5 crash_signal
> 0x91ec1c lra_emit_add(rtx_def*, rtx_def*, rtx_def*)
> 0x91ef8a lra_emit_move(rtx_def*, rtx_def*)
> 0x9279b2 insert_move_for_subreg
> 0x931bdb simplify_operand_subreg
> 0x931bdb curr_insn_transform
> 0x934793 lra_constraints(bool)
> 0x9217d0 lra(_IO_FILE*)
> 0x8e0dba do_reload
> 0x8e0dba execute
> I *think* the problem is that simplify_operand_subreg tries to break down
> this complex RTX involving the subreg into separate MULT/PLUS operations
> and breaking down the line.
> If I apply the attached patch that stops trying to simplify the subreg
> expression if the whole thing matches something already my code compiles
> succesfully, and passes arm testing and x86_64 bootstrap.
> However, I'm concerned that calling recog_memoized is too heavy-handed,
> is there a better approach?
> Or is this even the right way to go about this?
> I'm also attaching the patch to the arm backend that can be used to
> reproduce this ICE with the following C-code at -O2:
> smmulr (int a, int b)
> return ((long long)a * b + 0x80000000) >> 32;
> 2015-02-10 Kyrylo Tkachov <firstname.lastname@example.org>
> * lra-constraints.c (simplify_operand_subreg): Do not try to simplify
> subreg if the pattern already matches.