From: Jiufu Guo <guojiufu@linux.ibm.com>
To: gcc-patches@gcc.gnu.org
Cc: segher@kernel.crashing.org, dje.gcc@gmail.com, linkw@gcc.gnu.org,
guojiufu@linux.ibm.com
Subject: [PATCH 3/3]rs6000: NFC no need copy_rtx in rs6000_emit_set_long_const and rs6000_emit_set_const
Date: Thu, 1 Dec 2022 09:36:19 +0800 [thread overview]
Message-ID: <20221201013619.196004-3-guojiufu@linux.ibm.com> (raw)
In-Reply-To: <20221201013619.196004-1-guojiufu@linux.ibm.com>
Hi,
Function rs6000_emit_set_const/rs6000_emit_set_long_const are only invoked from
two "define_split"s where the target operand is limited to gpc_reg_operand or
int_reg_operand, then the operand must be REG_P.
And in rs6000_emit_set_const/rs6000_emit_set_long_const, to create temp rtx,
it is using code like "gen_reg_rtx({S|D}Imode)", it must also be REG_P.
So, copy_rtx is not needed for temp and dest.
This patch removes those "copy_rtx" for rs6000_emit_set_const and
rs6000_emit_set_long_const.
Bootstrap & regtest pass on ppc64{,le}.
Is this ok for trunk?
BR,
Jeff (Jiufu)
gcc/ChangeLog:
* config/rs6000/rs6000.cc (rs6000_emit_set_const): Remove copy_rtx.
(rs6000_emit_set_long_const): Likewise.
---
gcc/config/rs6000/rs6000.cc | 58 +++++++++++++------------------------
1 file changed, 20 insertions(+), 38 deletions(-)
diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
index 718072cc9a1..1a51b79ebfe 100644
--- a/gcc/config/rs6000/rs6000.cc
+++ b/gcc/config/rs6000/rs6000.cc
@@ -10186,10 +10186,9 @@ rs6000_emit_set_const (rtx dest, rtx source)
case E_SImode:
temp = !can_create_pseudo_p () ? dest : gen_reg_rtx (SImode);
- emit_insn (gen_rtx_SET (copy_rtx (temp),
- GEN_INT (c & ~(HOST_WIDE_INT) 0xffff)));
+ emit_insn (gen_rtx_SET (temp, GEN_INT (c & ~(HOST_WIDE_INT) 0xffff)));
emit_insn (gen_rtx_SET (dest,
- gen_rtx_IOR (SImode, copy_rtx (temp),
+ gen_rtx_IOR (SImode, temp,
GEN_INT (c & 0xffff))));
break;
@@ -10198,10 +10197,8 @@ rs6000_emit_set_const (rtx dest, rtx source)
{
rtx hi, lo;
- hi = operand_subword_force (copy_rtx (dest), WORDS_BIG_ENDIAN == 0,
- DImode);
- lo = operand_subword_force (dest, WORDS_BIG_ENDIAN != 0,
- DImode);
+ hi = operand_subword_force (dest, WORDS_BIG_ENDIAN == 0, DImode);
+ lo = operand_subword_force (dest, WORDS_BIG_ENDIAN != 0, DImode);
emit_move_insn (hi, GEN_INT (c >> 32));
c = sext_hwi (c, 32);
emit_move_insn (lo, GEN_INT (c));
@@ -10249,23 +10246,19 @@ rs6000_emit_set_long_const (rtx dest, HOST_WIDE_INT c)
{
temp = !can_create_pseudo_p () ? dest : gen_reg_rtx (DImode);
- emit_move_insn (ud1 != 0 ? copy_rtx (temp) : dest,
+ emit_move_insn (ud1 != 0 ? temp : dest,
GEN_INT (sext_hwi (ud2 << 16, 32)));
if (ud1 != 0)
- emit_move_insn (dest,
- gen_rtx_IOR (DImode, copy_rtx (temp),
- GEN_INT (ud1)));
+ emit_move_insn (dest, gen_rtx_IOR (DImode, temp, GEN_INT (ud1)));
}
else if (ud3 == 0 && ud4 == 0)
{
temp = !can_create_pseudo_p () ? dest : gen_reg_rtx (DImode);
gcc_assert (ud2 & 0x8000);
- emit_move_insn (copy_rtx (temp), GEN_INT (sext_hwi (ud2 << 16, 32)));
+ emit_move_insn (temp, GEN_INT (sext_hwi (ud2 << 16, 32)));
if (ud1 != 0)
- emit_move_insn (copy_rtx (temp),
- gen_rtx_IOR (DImode, copy_rtx (temp),
- GEN_INT (ud1)));
+ emit_move_insn (temp, gen_rtx_IOR (DImode, temp, GEN_INT (ud1)));
emit_move_insn (dest, gen_rtx_AND (DImode, temp, GEN_INT (0xffffffff)));
}
else if (ud1 == ud3 && ud2 == ud4)
@@ -10282,18 +10275,13 @@ rs6000_emit_set_long_const (rtx dest, HOST_WIDE_INT c)
{
temp = !can_create_pseudo_p () ? dest : gen_reg_rtx (DImode);
- emit_move_insn (copy_rtx (temp), GEN_INT (sext_hwi (ud3 << 16, 32)));
+ emit_move_insn (temp, GEN_INT (sext_hwi (ud3 << 16, 32)));
if (ud2 != 0)
- emit_move_insn (copy_rtx (temp),
- gen_rtx_IOR (DImode, copy_rtx (temp),
- GEN_INT (ud2)));
- emit_move_insn (ud1 != 0 ? copy_rtx (temp) : dest,
- gen_rtx_ASHIFT (DImode, copy_rtx (temp),
- GEN_INT (16)));
+ emit_move_insn (temp, gen_rtx_IOR (DImode, temp, GEN_INT (ud2)));
+ emit_move_insn (ud1 != 0 ? temp : dest,
+ gen_rtx_ASHIFT (DImode, temp, GEN_INT (16)));
if (ud1 != 0)
- emit_move_insn (dest,
- gen_rtx_IOR (DImode, copy_rtx (temp),
- GEN_INT (ud1)));
+ emit_move_insn (dest, gen_rtx_IOR (DImode, temp, GEN_INT (ud1)));
}
else if (TARGET_PREFIXED)
{
@@ -10334,23 +10322,17 @@ rs6000_emit_set_long_const (rtx dest, HOST_WIDE_INT c)
{
temp = !can_create_pseudo_p () ? dest : gen_reg_rtx (DImode);
- emit_move_insn (copy_rtx (temp), GEN_INT (sext_hwi (ud4 << 16, 32)));
+ emit_move_insn (temp, GEN_INT (sext_hwi (ud4 << 16, 32)));
if (ud3 != 0)
- emit_move_insn (copy_rtx (temp),
- gen_rtx_IOR (DImode, copy_rtx (temp),
- GEN_INT (ud3)));
+ emit_move_insn (temp, gen_rtx_IOR (DImode, temp, GEN_INT (ud3)));
- emit_move_insn (ud2 != 0 || ud1 != 0 ? copy_rtx (temp) : dest,
- gen_rtx_ASHIFT (DImode, copy_rtx (temp),
- GEN_INT (32)));
+ emit_move_insn (ud2 != 0 || ud1 != 0 ? temp : dest,
+ gen_rtx_ASHIFT (DImode, temp, GEN_INT (32)));
if (ud2 != 0)
- emit_move_insn (ud1 != 0 ? copy_rtx (temp) : dest,
- gen_rtx_IOR (DImode, copy_rtx (temp),
- GEN_INT (ud2 << 16)));
+ emit_move_insn (ud1 != 0 ? temp : dest,
+ gen_rtx_IOR (DImode, temp, GEN_INT (ud2 << 16)));
if (ud1 != 0)
- emit_move_insn (dest,
- gen_rtx_IOR (DImode, copy_rtx (temp),
- GEN_INT (ud1)));
+ emit_move_insn (dest, gen_rtx_IOR (DImode, temp, GEN_INT (ud1)));
}
}
--
2.17.1
next prev parent reply other threads:[~2022-12-01 1:36 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-01 1:36 [PATCH 1/3]rs6000: NFC use more readable pattern to clean high 32 bits Jiufu Guo
2022-12-01 1:36 ` [PATCH 2/3]rs6000: NFC use sext_hwi to replace ((v&0xf..f)^0x80..0) - 0x80..0 Jiufu Guo
2022-12-01 5:17 ` Kewen.Lin
2022-12-01 5:30 ` Kewen.Lin
2022-12-01 6:32 ` Jiufu Guo
2022-12-01 5:35 ` Jiufu Guo
2022-12-01 6:11 ` Kewen.Lin
2022-12-01 7:10 ` Jiufu Guo
2022-12-01 12:16 ` guojiufu
2022-12-02 8:56 ` Kewen.Lin
2022-12-05 6:11 ` Jiufu Guo
2022-12-09 1:51 ` Jiufu Guo
2022-12-01 1:36 ` Jiufu Guo [this message]
2022-12-01 3:31 ` [PATCH 3/3]rs6000: NFC no need copy_rtx in rs6000_emit_set_long_const and rs6000_emit_set_const Kewen.Lin
2022-12-01 4:52 ` Jiufu Guo
2022-12-09 12:25 ` Jiufu Guo
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=20221201013619.196004-3-guojiufu@linux.ibm.com \
--to=guojiufu@linux.ibm.com \
--cc=dje.gcc@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=linkw@gcc.gnu.org \
--cc=segher@kernel.crashing.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).