From: Uros Bizjak <ubizjak@gmail.com>
To: Eric Botcazou <ebotcazou@adacore.com>
Cc: Richard Sandiford <rdsandiford@googlemail.com>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH, rtl-optimization]: Fix PR54457, [x32] Fail to combine 64bit index + constant
Date: Thu, 27 Sep 2012 14:25:00 -0000 [thread overview]
Message-ID: <CAFULd4aSLiau+Qa9vC_eUsPrRKwvAqYt=uXxGi5Sj5GphCYMmA@mail.gmail.com> (raw)
In-Reply-To: <3730255.NiV98gQJ1a@polaris>
[-- Attachment #1: Type: text/plain, Size: 1573 bytes --]
On Wed, Sep 26, 2012 at 11:22 PM, Eric Botcazou <ebotcazou@adacore.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?
I have tried this approach with attached patch. Unfortunately,
although it survived bootstrap without libjava on x86_64, it failed
building libjava with:
/home/uros/gcc-svn/trunk/libjava/classpath/javax/swing/plaf/basic/BasicSliderUI.java:1299:0:
error: insn does not satisfy its constraints:
}
^
(insn 237 398 399 7 (set (reg:SI 1 dx [125])
(plus:SI (subreg:SI (mult:DI (reg:DI 1 dx [orig:72 D.78627 ] [72])
(const_int 2 [0x2])) 0)
(reg:SI 5 di)))
/home/uros/gcc-svn/trunk/libjava/classpath/javax/swing/plaf/basic/BasicSliderUI.java:1271
240 {*leasi}
(expr_list:REG_DEAD (reg:DI 5 di)
(nil)))
Original RTX was (subreg:SI (plus:DI (mult:DI (...) reg:DI))), which
is valid RTX pattern for lea insn, the above is not.
Due to these problems, I think the safer approach is to limit the
transformation to (plus:SI (subreg:SI (plus:DI (...) 0)) RTXes, as was
the case with original patch. This approach would fix a specific
problem where simplify_plus_minus is not able to simplify the combined
RTX at combine time. Please note, that combined RTXes are always
checked for correctness at combine pass.
Uros.
[-- Attachment #2: s.diff.txt --]
[-- Type: text/plain, Size: 1199 bytes --]
Index: simplify-rtx.c
===================================================================
--- simplify-rtx.c (revision 191796)
+++ simplify-rtx.c (working copy)
@@ -5689,6 +5688,21 @@ simplify_subreg (enum machine_mode outermode, rtx
return CONST0_RTX (outermode);
}
+ /* Simplify (subreg:SI (plus:DI ((x:DI) (y:DI)), 0)
+ to (plus:SI (subreg:SI (x:DI) 0) (subreg:SI (x:DI) 0)), where
+ the outer subreg is effectively a truncation to the original mode. */
+ if ((GET_CODE (op) == PLUS
+ || GET_CODE (op) == MINUS)
+ && SCALAR_INT_MODE_P (outermode)
+ && SCALAR_INT_MODE_P (innermode)
+ && GET_MODE_PRECISION (outermode) < GET_MODE_PRECISION (innermode)
+ && subreg_lsb_1 (outermode, innermode, byte) == 0)
+ return simplify_gen_binary (GET_CODE (op), outermode,
+ simplify_gen_subreg (outermode, XEXP (op, 0),
+ innermode, 0),
+ simplify_gen_subreg (outermode, XEXP (op, 1),
+ innermode, 0));
+
/* Simplify (subreg:QI (lshiftrt:SI (sign_extend:SI (x:QI)) C), 0) into
to (ashiftrt:QI (x:QI) C), where C is a suitable small constant and
the outer subreg is effectively a truncation to the original mode. */
next prev parent reply other threads:[~2012-09-27 13:04 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-25 8:04 Uros Bizjak
2012-09-26 18:17 ` Richard Sandiford
2012-09-26 21:38 ` Eric Botcazou
2012-09-27 14:25 ` Uros Bizjak [this message]
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
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='CAFULd4aSLiau+Qa9vC_eUsPrRKwvAqYt=uXxGi5Sj5GphCYMmA@mail.gmail.com' \
--to=ubizjak@gmail.com \
--cc=ebotcazou@adacore.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=rdsandiford@googlemail.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).