From: Richard Henderson <rth@redhat.com>
To: Denis Chertykov <chertykov@gmail.com>
Cc: Georg-Johann Lay <avr@gjlay.de>,
gcc-patches@gcc.gnu.org, Anatoly Sokolov <aesok@post.ru>,
Eric Weddington <eric.weddington@atmel.com>
Subject: Re: [Patch,AVR]: FIX ICE in optabs due to bad rotate expander.
Date: Wed, 20 Apr 2011 17:44:00 -0000 [thread overview]
Message-ID: <4DAF16AC.3020801@redhat.com> (raw)
In-Reply-To: <BANLkTinnuS=jd=_jVO_Bk1_PDTBY57Yrng@mail.gmail.com>
On 04/19/2011 02:52 AM, Denis Chertykov wrote:
> 2011/4/19 Georg-Johann Lay <avr@gjlay.de>:
>> How can add, sub etc. be split? This would need an explicit
>> representation of carry.
>
> Yes.
>
> Look at http://gcc.gnu.org/ml/gcc/2005-03/msg00871.html
Well, sort-of, but not really.
It gets a tad ugly, but have a look at the adddi3* patterns in
the mn10300 and rx ports.
In particular note how both the inputs and outputs to the insn
(not the expander) are all SImode, allowing for lower_subreg to
do its job. The patterns are split post-reload -- some of that
is for scheduling, some of that simply makes computing the
individual insn lengths significantly easier -- but you wouldn't
really have to do that for AVR.
For AVR things would become even trickier. You might consider
(define_predicate "concat_operator"
(match_code "concat"))
(define_insn "addsi3_qqqq"
[(set (match_operand:QI 0 "register_operand" "=r")
(truncate:QI
(plus:SI
(match_operator:SI 12 "concat_operator"
[(match_operand:QI 4 "register_operand" "0")
(match_operand:QI 5 "register_operand" "1")
(match_operand:QI 6 "register_operand" "2")
(match_operand:QI 7 "register_operand" "3")])
(match_operator:SI 13 "concat_operator"
[(match_operand:QI 8 "reg_or_0_operand" "rL")
(match_operand:QI 9 "reg_or_0_operand" "rL")
(match_operand:QI 10 "reg_or_0_operand" "rL")
(match_operand:QI 11 "reg_or_0_operand" "rL")])))
(set (match_operand:QI 1 "register_operand" "=r")
(truncate:QI
(lshiftrt:SI
(plus:SI (match_dup 24) (match_dup 25))
(const_int 8))))
(set (match_operand:QI 2 "register_operand" "=r")
(truncate:QI
(lshiftrt:SI
(plus:SI (match_dup 24) (match_dup 25))
(const_int 16))))
(set (match_operand:QI 3 "register_operand" "=r")
(truncate:QI
(lshiftrt:SI
(plus:SI (match_dup 24) (match_dup 25))
(const_int 24))))]
""
"add %0,%Z8\;adc %1,%Z9\;adc %2,%Z10\;adc %3,%Z11"
[(set_attr "length" "4")]
)
This may require a little bit of code inside combine to handle
CONCAT in a reasonable way, but that should be fairly minimal.
It may also want some more special case patterns and/or peep2s
to more efficiently handle constants, particularly considering
adiw and subic. But I think it's at least worth investigating.
r~
next prev parent reply other threads:[~2011-04-20 17:24 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-14 10:25 Georg-Johann Lay
2011-04-14 16:21 ` Denis Chertykov
2011-04-14 17:20 ` Georg-Johann Lay
2011-04-14 18:15 ` Denis Chertykov
2011-04-15 17:56 ` Georg-Johann Lay
2011-04-17 10:23 ` Denis Chertykov
2011-04-17 19:43 ` Denis Chertykov
2011-04-18 11:10 ` Georg-Johann Lay
2011-04-18 16:35 ` Denis Chertykov
2011-04-18 16:46 ` Denis Chertykov
2011-04-19 9:46 ` Georg-Johann Lay
2011-04-19 10:16 ` Denis Chertykov
2011-04-19 10:36 ` Georg-Johann Lay
2011-04-19 12:07 ` Denis Chertykov
2011-04-19 13:15 ` Richard Earnshaw
2011-04-20 17:44 ` Richard Henderson [this message]
2011-04-20 11:25 ` Georg-Johann Lay
2011-04-20 12:56 ` Denis Chertykov
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=4DAF16AC.3020801@redhat.com \
--to=rth@redhat.com \
--cc=aesok@post.ru \
--cc=avr@gjlay.de \
--cc=chertykov@gmail.com \
--cc=eric.weddington@atmel.com \
--cc=gcc-patches@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).