From: Mohamed Shafi <shafitvm@gmail.com>
To: GCC <gcc@gcc.gnu.org>
Subject: How to write shift and add pattern?
Date: Fri, 28 Aug 2009 19:56:00 -0000 [thread overview]
Message-ID: <ba0bd44d0908280651r676484a5r6b776a2f6d1f12b7@mail.gmail.com> (raw)
Hello all,
I am trying to port a 32bit arch in GCC 4.4.0. My target has support
for 1bit, 2bit shift and add operations. I tried to write patterns for
this , but gcc is not generating those. The following are the patterns
that i have written in md file:
(define_insn "shift_add_<mode>"
[(set (match_operand:SI 0 "register_operand" "")
(plus:SI (match_operand:SI 3 "register_operand" "")
(ashift:SI (match_operand:SI 1 "register_operand" "")
(match_operand:SI 2 "immediate_operand" ""))))]
""
"shadd1\\t%1, %0"
)
(define_insn "shift_add1_<mode>"
[(set (match_operand:SI 0 "register_operand" "")
(plus:SI (ashift:SI (match_operand:SI 1 "register_operand" "")
(match_operand:SI 2 "immediate_operand" ""))
(match_operand:SI 3 "register_operand" "")))]
""
"shadd1\\t%1, %0"
)
(define_insn "shift_n_add_<mode>"
[(set (match_operand:SI 1 "register_operand" "")
(ashift:SI (match_dup 1)
(match_operand:SI 2 "immediate_operand" "")))
(set (match_operand:SI 0 "register_operand" "")
(plus:SI (match_dup 0)
(match_dup 1)))]
""
"shadd2\\t%1, %0"
)
As you can see i have tried combinations. Since i was looking for
pattern matching i didnt bother to write according to the target.
Thought i will do that after i get a matching pattern. When i debugged
GCC was generating patterns with multiply. But that gets discarded
since md file doesnt have those patterns. How can i make GCC generate
shift and add pattern? Is GCC generating patterns with multiply due to
cost issues? I havent mentioned any cost details.
Regards,
Shafi
next reply other threads:[~2009-08-28 13:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-28 19:56 Mohamed Shafi [this message]
2009-08-28 23:49 ` Richard Henderson
2009-11-06 13:30 ` Mohamed Shafi
2009-11-06 15:34 ` Ian Lance Taylor
2009-11-09 12:53 ` Mohamed Shafi
2009-11-09 15:26 ` Ian Lance Taylor
2009-11-06 16:17 ` Richard Henderson
2009-11-09 12:49 ` Mohamed Shafi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ba0bd44d0908280651r676484a5r6b776a2f6d1f12b7@mail.gmail.com \
--to=shafitvm@gmail.com \
--cc=gcc@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).