From: Andrew Pinski <andrew.pinski@caviumnetworks.com>
To: Uros Bizjak <ubizjak@gmail.com>
Cc: Paul_Koning@dell.com, gcc-patches@gcc.gnu.org,
rdsandiford@googlemail.com, ebotcazou@adacore.com
Subject: Re: [PATCH v2, rtl-optimization]: Fix PR54457, [x32] Fail to combine 64bit index + constant
Date: Tue, 02 Oct 2012 02:13:00 -0000 [thread overview]
Message-ID: <CA+=Sn1=fn4qgykYurKO3nKq3KMu3Vc1t_WtGQTUqiY7iu2KeUQ@mail.gmail.com> (raw)
In-Reply-To: <CAFULd4bSX2+V028LzMi30Pk4RyA1NKDC1skm3EBCCqeQcc-EAg@mail.gmail.com>
On Thu, Sep 27, 2012 at 11:13 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
> On Thu, Sep 27, 2012 at 8:08 PM, <Paul_Koning@dell.com> wrote:
>
>>>>>>> I agree (subreg:M (op:N A C) 0) to (op:M (subreg:N (A 0)) C) is
>>>>>>> a good transformation, but why do we need to handle as special
>>>>>>> the case where the subreg is itself the operand of a plus or minus?
>>>>>>> I think it should happen regardless of where the subreg occurs.
>>>>>>
>>>>>> Don't we need to restrict this to the low part though?
>>>>>
>>>>> ...
>>>
>>> After some off-line discussion with Richard, attached is v2 of the patch.
>>>
>>> 2012-09-27 Uros Bizjak <ubizjak@gmail.com>
>>>
>>> PR rtl-optimization/54457
>>> * simplify-rtx.c (simplify_subreg):
>>> Simplify (subreg:SI (op:DI ((x:DI) (y:DI)), 0)
>>> to (op:SI (subreg:SI (x:DI) 0) (subreg:SI (x:DI) 0)).
>>> ...
>>
>> Is it just specific to DI -> SI, or is it for any large mode -> smaller mode, like SI -> HI?
>
> Oh, I just copied v1 ChangeLog. The patch converts all modes where
> size of mode M < size of mode N. Updated ChangeLog reads:
>
> 2012-09-27 Uros Bizjak <ubizjak@gmail.com>
>
> PR rtl-optimization/54457
> * simplify-rtx.c (simplify_subreg):
> Simplify (subreg:M (op:N ((x:N) (y:N)), 0)
> to (op:M (subreg:M (x:N) 0) (subreg:M (x:N) 0)), where
> the outer subreg is effectively a truncation to the original mode M.
When I was doing something similar on our internal toolchain at
Cavium. I found doing this caused a regression on MIPS64 n32 in
gcc.c-torture/execute/20040709-1.c Where:
(insn 15 14 16 2 (set (reg/v:DI 200 [ y ])
(reg:DI 2 $2)) t.c:16 301 {*movdi_64bit}
(expr_list:REG_DEAD (reg:DI 2 $2)
(nil)))
(insn 16 15 17 2 (set (reg:DI 210)
(zero_extract:DI (reg/v:DI 200 [ y ])
(const_int 29 [0x1d])
(const_int 0 [0]))) t.c:16 249 {extzvdi}
(expr_list:REG_DEAD (reg/v:DI 200 [ y ])
(nil)))
(insn 17 16 23 2 (set (reg:SI 211)
(truncate:SI (reg:DI 210))) t.c:16 175 {truncdisi2}
(expr_list:REG_DEAD (reg:DI 210)
(nil)))
Gets converted to:
(insn 23 17 26 2 (set (reg/i:SI 2 $2)
(and:SI (reg:SI 2 $2 [+4 ])
(const_int 536870911 [0x1fffffff]))) t.c:18 156 {*andsi3}
(nil))
Which is considered an ext instruction
And with the Octeon simulator which causes undefined arguments to
32bit word operations to come out as 0xDEADBEEF which showed the
regression. I fixed it by changing it to produce TRUNCATE instead of
the subreg.
I did the simplification on ior/and rather than plus/minus/mult so the
issue is only when expanding to this to and/ior.
Thanks,
Andrew Pinski
>
> testsuite/ChangeLog:
>
> 2012-09-27 Uros Bizjak <ubizjak@gmail.com>
>
> PR rtl-optimization/54457
> * gcc.target/i386/pr54457.c: New test.
>
> Uros.
next prev parent reply other threads:[~2012-10-02 2:13 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-25 8:04 [PATCH, " Uros Bizjak
2012-09-26 18:17 ` Richard Sandiford
2012-09-26 21:38 ` Eric Botcazou
2012-09-27 14:25 ` Uros Bizjak
2012-09-27 16:10 ` Richard Sandiford
2012-09-27 18:20 ` [PATCH v2, " Uros Bizjak
2012-09-27 18:35 ` Paul_Koning
2012-09-27 19:21 ` Uros Bizjak
2012-10-02 2:13 ` Andrew Pinski [this message]
2012-10-02 19:32 ` Richard Sandiford
2012-10-06 10:22 ` RFA: Simplifying truncation and integer lowpart subregs Richard Sandiford
2012-10-06 11:13 ` Eric Botcazou
2012-10-06 12:39 ` Richard Sandiford
2012-10-06 13:05 ` Eric Botcazou
2012-10-07 8:56 ` Richard Sandiford
2012-10-07 12:36 ` Eric Botcazou
2012-11-28 2:27 ` Ramana Radhakrishnan
2012-11-28 21:45 ` Richard Sandiford
2012-09-27 20:33 ` [PATCH v2, rtl-optimization]: Fix PR54457, [x32] Fail to combine 64bit index + constant Jakub Jelinek
2012-09-27 22:37 ` Richard Sandiford
2012-09-28 15:39 ` Uros Bizjak
2012-09-30 11:40 ` Richard Sandiford
2012-10-03 11:07 ` Paolo Bonzini
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='CA+=Sn1=fn4qgykYurKO3nKq3KMu3Vc1t_WtGQTUqiY7iu2KeUQ@mail.gmail.com' \
--to=andrew.pinski@caviumnetworks.com \
--cc=Paul_Koning@dell.com \
--cc=ebotcazou@adacore.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=rdsandiford@googlemail.com \
--cc=ubizjak@gmail.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).