From: Mohamed Shafi <shafitvm@gmail.com>
To: Richard Henderson <rth@redhat.com>
Cc: GCC <gcc@gcc.gnu.org>
Subject: Re: How to split mulsi3 pattern
Date: Thu, 12 Nov 2009 13:40:00 -0000 [thread overview]
Message-ID: <ba0bd44d0911120540q426e094bldbdb8fa4af254cee@mail.gmail.com> (raw)
In-Reply-To: <4AF9A4B1.20704@redhat.com>
2009/11/10 Richard Henderson <rth@redhat.com>:
> On 11/10/2009 05:48 AM, Mohamed Shafi wrote:
>>
>> (define_insn "mulsi3"
>> [(set (match_operand:SI 0 "register_operand" "=&d")
>> (mult:SI (match_operand:SI 1 "register_operand" "%d")
>> (match_operand:SI 2 "register_operand" "d")))]
>
> Note that "%" is only useful if the constraints for the two operands are
> different (e.g. only one operand accepts an immediate input). When they're
> identical, you simply waste cpu cycles asking reload to try the operands in
> the other order.
>
>> [(set (match_dup 0)
>> (ashift:SI
>> (plus:SI (mult:HI (unspec:HI [(match_dup 2)] UNSPEC_REG_LOW)
>> (unspec:HI [(match_dup 1)] UNSPEC_REG_HIGH))
>> (mult:HI (unspec:HI [(match_dup 2)] UNSPEC_REG_HIGH)
>> (unspec:HI [(match_dup 1)] UNSPEC_REG_LOW)))
>> (const_int 16)))
>> (set (match_dup 0)
>> (plus:SI (match_dup 0)
>> (mult:HI (unspec:HI [(match_dup 2)] UNSPEC_REG_LOW)
>> (unspec:HI [(match_dup 1)] UNSPEC_REG_LOW))))]
>
> Well for one, your modes don't match. You actually want your unspecs and
> MULTs to be SImode.
>
> You could probably usefully model the second insn as
>
> (define_insn "mulsi3_part2"
> [(set (match_operand:SI 0 "register_operand" "=d")
> (plus:SI
> (mult:SI (zero_extend:SI
> (match_operand:HI 1 "register_operand" "d"))
> (zero_extend:SI
> (match_operand:HI 2 "register_operand" "d")))
> (match_operand:SI 3 "register_operand" "0")))]
> ""
> ...)
So i need to change the mode of the register from SI to HI after
reloading. Is that allowed?
Regards,
Shafi
next prev parent reply other threads:[~2009-11-12 13:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-10 13:48 Mohamed Shafi
2009-11-10 17:37 ` Richard Henderson
2009-11-12 13:40 ` Mohamed Shafi [this message]
2009-11-12 16:02 ` Richard Henderson
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=ba0bd44d0911120540q426e094bldbdb8fa4af254cee@mail.gmail.com \
--to=shafitvm@gmail.com \
--cc=gcc@gcc.gnu.org \
--cc=rth@redhat.com \
/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).