This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: How to write shift and add pattern?
- From: Richard Henderson <rth at redhat dot com>
- To: Mohamed Shafi <shafitvm at gmail dot com>
- Cc: GCC <gcc at gcc dot gnu dot org>
- Date: Fri, 06 Nov 2009 08:17:17 -0800
- Subject: Re: How to write shift and add pattern?
- References: <ba0bd44d0908280651r676484a5r6b776a2f6d1f12b7@mail.gmail.com> <4A97E98C.8040009@redhat.com> <ba0bd44d0911060529r5f6b9a3al83a8dea954a836a5@mail.gmail.com>
On 11/06/2009 05:29 AM, Mohamed Shafi wrote:
The target that i am working on has 1& 2 bit shift-add patterns.
GCC is not generating shift-add patterns when the shift count is 1. It
is currently generating add operations. What should be done to
generate shift-add pattern instead of add-add pattern?
I'm not sure. You may have to resort to matching
(set (match_operand 0 "register_operand" "")
(plus (plus (match_operand 1 "register_operand" "")
(match_dup 1))
(match_operand 2 "register_operand" ""))))
But you should debug make_compound_operation first to
figure out what's going on for your port, because it's
working for x86_64:
long foo(long a, long b) { return a*2 + b; }
leaq (%rsi,%rdi,2), %rax # 8 *lea_2_rex64
ret # 26 return_internal
r~