public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/meissner/heads/work134-vsubreg)] Use simplify_gen_subreg instead of generating direct register number.
@ 2023-09-22 3:22 Michael Meissner
0 siblings, 0 replies; only message in thread
From: Michael Meissner @ 2023-09-22 3:22 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:73e25307d90eedb903c8018e0a81dcd121d27b04
commit 73e25307d90eedb903c8018e0a81dcd121d27b04
Author: Michael Meissner <meissner@linux.ibm.com>
Date: Thu Sep 21 23:22:10 2023 -0400
Use simplify_gen_subreg instead of generating direct register number.
2023-09-15 Michael Meissner <meissner@linux.ibm.com>
gcc/
* config/rs6000/rs6000.cc (split_unary_vector_pair): Use
simplify_gen_subreg instead of generating hard registers.
(split_binary_vector_pair): Likewise.
(split_fma_vector_pair): Likewise.
* config/rs6000/vector-pair.md (vpair_zero): Use simplify_gen_subreg
instead of generating hard registers.
(vpair_get_vector_<vp_pmode>): Likewise.
Diff:
---
gcc/config/rs6000/rs6000.cc | 81 ++++++++++++++++++++++------------------
gcc/config/rs6000/vector-pair.md | 15 ++++----
2 files changed, 53 insertions(+), 43 deletions(-)
diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
index 643da3cf8e7..ada133a6477 100644
--- a/gcc/config/rs6000/rs6000.cc
+++ b/gcc/config/rs6000/rs6000.cc
@@ -27195,15 +27195,18 @@ split_unary_vector_pair (machine_mode mode, /* vector mode. */
rtx operands[], /* dest, src. */
rtx (*func)(rtx, rtx)) /* create insn. */
{
- unsigned reg0 = reg_or_subregno (operands[0]);
- unsigned reg1 = reg_or_subregno (operands[1]);
-
- emit_insn (func (gen_rtx_REG (mode, reg0),
- gen_rtx_REG (mode, reg1)));
-
- emit_insn (func (gen_rtx_REG (mode, reg0 + 1),
- gen_rtx_REG (mode, reg1 + 1)));
-
+ rtx op0 = operands[0];
+ rtx op1 = operands[1];
+ unsigned offset_hi = (WORDS_BIG_ENDIAN) ? 0 : 16;
+ unsigned offset_lo = (WORDS_BIG_ENDIAN) ? 16 : 0;
+
+ rtx reg0_hi = simplify_gen_subreg (mode, op0, OOmode, offset_hi);
+ rtx reg0_lo = simplify_gen_subreg (mode, op0, OOmode, offset_lo);
+ rtx reg1_hi = simplify_gen_subreg (mode, op1, OOmode, offset_hi);
+ rtx reg1_lo = simplify_gen_subreg (mode, op1, OOmode, offset_lo);
+
+ emit_insn (func (reg0_hi, reg1_hi));
+ emit_insn (func (reg0_lo, reg1_lo));
return;
}
@@ -27214,18 +27217,21 @@ split_binary_vector_pair (machine_mode mode, /* vector mode. */
rtx operands[], /* dest, src. */
rtx (*func)(rtx, rtx, rtx)) /* create insn. */
{
- unsigned reg0 = reg_or_subregno (operands[0]);
- unsigned reg1 = reg_or_subregno (operands[1]);
- unsigned reg2 = reg_or_subregno (operands[2]);
-
- emit_insn (func (gen_rtx_REG (mode, reg0),
- gen_rtx_REG (mode, reg1),
- gen_rtx_REG (mode, reg2)));
-
- emit_insn (func (gen_rtx_REG (mode, reg0 + 1),
- gen_rtx_REG (mode, reg1 + 1),
- gen_rtx_REG (mode, reg2 + 1)));
-
+ rtx op0 = operands[0];
+ rtx op1 = operands[1];
+ rtx op2 = operands[2];
+ unsigned offset_hi = (WORDS_BIG_ENDIAN) ? 0 : 16;
+ unsigned offset_lo = (WORDS_BIG_ENDIAN) ? 16 : 0;
+
+ rtx reg0_hi = simplify_gen_subreg (mode, op0, OOmode, offset_hi);
+ rtx reg0_lo = simplify_gen_subreg (mode, op0, OOmode, offset_lo);
+ rtx reg1_hi = simplify_gen_subreg (mode, op1, OOmode, offset_hi);
+ rtx reg1_lo = simplify_gen_subreg (mode, op1, OOmode, offset_lo);
+ rtx reg2_hi = simplify_gen_subreg (mode, op2, OOmode, offset_hi);
+ rtx reg2_lo = simplify_gen_subreg (mode, op2, OOmode, offset_lo);
+
+ emit_insn (func (reg0_hi, reg1_hi, reg2_hi));
+ emit_insn (func (reg0_lo, reg1_lo, reg2_lo));
return;
}
@@ -27237,21 +27243,24 @@ split_fma_vector_pair (machine_mode mode, /* vector mode. */
rtx operands[], /* dest, src. */
rtx (*func)(rtx, rtx, rtx, rtx)) /* create insn. */
{
- unsigned reg0 = reg_or_subregno (operands[0]);
- unsigned reg1 = reg_or_subregno (operands[1]);
- unsigned reg2 = reg_or_subregno (operands[2]);
- unsigned reg3 = reg_or_subregno (operands[3]);
-
- emit_insn (func (gen_rtx_REG (mode, reg0),
- gen_rtx_REG (mode, reg1),
- gen_rtx_REG (mode, reg2),
- gen_rtx_REG (mode, reg3)));
-
- emit_insn (func (gen_rtx_REG (mode, reg0 + 1),
- gen_rtx_REG (mode, reg1 + 1),
- gen_rtx_REG (mode, reg2 + 1),
- gen_rtx_REG (mode, reg3 + 1)));
-
+ rtx op0 = operands[0];
+ rtx op1 = operands[1];
+ rtx op2 = operands[2];
+ rtx op3 = operands[2];
+ unsigned offset_hi = (WORDS_BIG_ENDIAN) ? 0 : 16;
+ unsigned offset_lo = (WORDS_BIG_ENDIAN) ? 16 : 0;
+
+ rtx reg0_hi = simplify_gen_subreg (mode, op0, OOmode, offset_hi);
+ rtx reg0_lo = simplify_gen_subreg (mode, op0, OOmode, offset_lo);
+ rtx reg1_hi = simplify_gen_subreg (mode, op1, OOmode, offset_hi);
+ rtx reg1_lo = simplify_gen_subreg (mode, op1, OOmode, offset_lo);
+ rtx reg2_hi = simplify_gen_subreg (mode, op2, OOmode, offset_hi);
+ rtx reg2_lo = simplify_gen_subreg (mode, op2, OOmode, offset_lo);
+ rtx reg3_hi = simplify_gen_subreg (mode, op3, OOmode, offset_hi);
+ rtx reg3_lo = simplify_gen_subreg (mode, op2, OOmode, offset_lo);
+
+ emit_insn (func (reg0_hi, reg1_hi, reg2_hi, reg3_hi));
+ emit_insn (func (reg0_lo, reg1_lo, reg2_lo, reg3_lo));
return;
}
diff --git a/gcc/config/rs6000/vector-pair.md b/gcc/config/rs6000/vector-pair.md
index ddb38df51af..4d422f5a697 100644
--- a/gcc/config/rs6000/vector-pair.md
+++ b/gcc/config/rs6000/vector-pair.md
@@ -166,12 +166,13 @@
[(set (match_dup 1) (match_dup 3))
(set (match_dup 2) (match_dup 3))]
{
- unsigned reg0 = reg_or_subregno (operands[0]);
- rtvec vec_zero = gen_rtvec (2, const0_rtx, const0_rtx);
+ rtx op0 = operands[0];
+ unsigned offset_hi = (WORDS_BIG_ENDIAN) ? 0 : 16;
+ unsigned offset_lo = (WORDS_BIG_ENDIAN) ? 16 : 0;
- operands[1] = gen_rtx_REG (V2DImode, reg0);
- operands[2] = gen_rtx_REG (V2DImode, reg0 + 1);
- operands[3] = gen_rtx_CONST_VECTOR (V2DImode, vec_zero);
+ operands[1] = simplify_gen_subreg (V2DImode, op0, OOmode, offset_hi);
+ operands[2] = simplify_gen_subreg (V2DImode, op0, OOmode, offset_lo);
+ operands[3] = CONST0_RTX (V2DImode);
}
[(set_attr "length" "8")])
@@ -213,12 +214,12 @@
"&& reload_completed"
[(set (match_dup 0) (match_dup 3))]
{
- unsigned reg1 = reg_or_subregno (operands[1]);
+ machine_mode vmode = <VP_VEC_MODE>mode;
unsigned reg_num = UINTVAL (operands[2]);
if (!WORDS_BIG_ENDIAN)
reg_num = 1 - reg_num;
- operands[3] = gen_rtx_REG (<VP_VEC_MODE>mode, reg1 + reg_num);
+ operands[3] = simplify_gen_subreg (vmode, operands[0], OOmode, reg_num * 16);
})
;; Optimize extracting an 128-bit vector from a vector pair in memory.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-09-22 3:22 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-22 3:22 [gcc(refs/users/meissner/heads/work134-vsubreg)] Use simplify_gen_subreg instead of generating direct register number Michael Meissner
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).