public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/103124] New: PPC: "mr" instruction is unnecessary when extending DI to V1TI
@ 2021-11-08 3:20 guihaoc at gcc dot gnu.org
2021-11-08 3:24 ` [Bug target/103124] " pinskia at gcc dot gnu.org
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: guihaoc at gcc dot gnu.org @ 2021-11-08 3:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103124
Bug ID: 103124
Summary: PPC: "mr" instruction is unnecessary when extending DI
to V1TI
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: guihaoc at gcc dot gnu.org
Target Milestone: ---
//test.c
vector __int128 init (long long a)
{
vector __int128 b;
b = (vector __int128) {a};
return b;
}
gcc -O2 -s test.c -mcpu=power9
//p9 assembly
mr 10,3
sradi 11,3,63
mtvsrdd 34,11,10
The first mr is unnecessary if the last one is changed to "mtvsrdd 34,11,3".
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug target/103124] PPC: "mr" instruction is unnecessary when extending DI to V1TI
2021-11-08 3:20 [Bug target/103124] New: PPC: "mr" instruction is unnecessary when extending DI to V1TI guihaoc at gcc dot gnu.org
@ 2021-11-08 3:24 ` pinskia at gcc dot gnu.org
2021-11-08 3:29 ` guihaoc at gcc dot gnu.org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-08 3:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103124
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug target/103124] PPC: "mr" instruction is unnecessary when extending DI to V1TI
2021-11-08 3:20 [Bug target/103124] New: PPC: "mr" instruction is unnecessary when extending DI to V1TI guihaoc at gcc dot gnu.org
2021-11-08 3:24 ` [Bug target/103124] " pinskia at gcc dot gnu.org
@ 2021-11-08 3:29 ` guihaoc at gcc dot gnu.org
2021-11-09 2:34 ` guihaoc at gcc dot gnu.org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: guihaoc at gcc dot gnu.org @ 2021-11-08 3:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103124
--- Comment #1 from HaoChen Gui <guihaoc at gcc dot gnu.org> ---
Build command gcc -O2 -S test.c -mcpu=power9
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug target/103124] PPC: "mr" instruction is unnecessary when extending DI to V1TI
2021-11-08 3:20 [Bug target/103124] New: PPC: "mr" instruction is unnecessary when extending DI to V1TI guihaoc at gcc dot gnu.org
2021-11-08 3:24 ` [Bug target/103124] " pinskia at gcc dot gnu.org
2021-11-08 3:29 ` guihaoc at gcc dot gnu.org
@ 2021-11-09 2:34 ` guihaoc at gcc dot gnu.org
2021-11-09 2:39 ` guihaoc at gcc dot gnu.org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: guihaoc at gcc dot gnu.org @ 2021-11-09 2:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103124
--- Comment #2 from HaoChen Gui <guihaoc at gcc dot gnu.org> ---
//lower-subreg.c
/* If this is a cast from one mode to another, where the modes
have the same size, and they are not tieable, then mark this
register as non-decomposable. If we decompose it we are
likely to mess up whatever the backend is trying to do. */
if (outer_words > 1
&& outer_size == inner_size
&& !targetm.modes_tieable_p (GET_MODE (x), GET_MODE (inner)))
{
bitmap_set_bit (non_decomposable_context, regno);
bitmap_set_bit (subreg_context, regno);
iter.skip_subrtxes ();
continue;
}
As TI and V1TI is not tieable on powerpc, TI register 122 in the following insn
can't be decomposed.
(insn 12 11 13 2 (set (reg:V1TI 121 [ b ])
(subreg:V1TI (reg:TI 122) 0)) "test2.c":4:5 1167 {vsx_movv1ti_64bit}
(nil))
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug target/103124] PPC: "mr" instruction is unnecessary when extending DI to V1TI
2021-11-08 3:20 [Bug target/103124] New: PPC: "mr" instruction is unnecessary when extending DI to V1TI guihaoc at gcc dot gnu.org
` (2 preceding siblings ...)
2021-11-09 2:34 ` guihaoc at gcc dot gnu.org
@ 2021-11-09 2:39 ` guihaoc at gcc dot gnu.org
2021-11-10 5:19 ` segher at gcc dot gnu.org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: guihaoc at gcc dot gnu.org @ 2021-11-09 2:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103124
--- Comment #3 from HaoChen Gui <guihaoc at gcc dot gnu.org> ---
My solution is to split the move (from TI to V1TI) into one vsx_concat_v2di and
one V2DI to V1TI move. Thus, TI register 122 can be decomposed.
(insn 12 11 17 2 (set (reg:V1TI 121 [ b ])
(subreg:V1TI (reg:TI 122 [ a ]) 0)) "test2.c":4:5 1167
{vsx_movv1ti_64bit}
(expr_list:REG_DEAD (reg:TI 122 [ a ])
(nil)))
//after split pass
(insn 23 11 24 2 (set (reg:V2DI 125)
(vec_concat:V2DI (subreg:DI (reg:TI 122 [ a ]) 0)
(subreg:DI (reg:TI 122 [ a ]) 8))) "test2.c":4:5 -1
(nil))
(insn 24 23 17 2 (set (reg:V1TI 121 [ b ])
(subreg:V1TI (reg:V2DI 125) 0)) "test2.c":4:5 -1
(nil))
//after subreg pass
(insn 23 11 24 2 (set (reg:V2DI 125)
(vec_concat:V2DI (reg:DI 126 [ a ])
(reg:DI 127 [ a+8 ]))) "test2.c":4:5 1346 {vsx_concat_v2di}
(nil))
(insn 24 23 17 2 (set (reg:V1TI 121 [ b ])
(subreg:V1TI (reg:V2DI 125) 0)) "test2.c":4:5 1167 {vsx_movv1ti_64bit}
(nil))
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug target/103124] PPC: "mr" instruction is unnecessary when extending DI to V1TI
2021-11-08 3:20 [Bug target/103124] New: PPC: "mr" instruction is unnecessary when extending DI to V1TI guihaoc at gcc dot gnu.org
` (3 preceding siblings ...)
2021-11-09 2:39 ` guihaoc at gcc dot gnu.org
@ 2021-11-10 5:19 ` segher at gcc dot gnu.org
2021-12-01 8:33 ` guihaoc at gcc dot gnu.org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: segher at gcc dot gnu.org @ 2021-11-10 5:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103124
Segher Boessenkool <segher at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2021-11-10
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
--- Comment #4 from Segher Boessenkool <segher at gcc dot gnu.org> ---
Skipping mode TI for zero_extend lowering.
Splitting mode TI for ashift lowering with shift amounts =
Splitting mode TI for lshiftrt lowering with shift amounts =
Splitting mode TI for ashiftrt lowering with shift amounts =
All these should be fixed. But it is a red herring here, since the shift we
have is in DImode already anyway, not TImode.
Confirmed btw.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug target/103124] PPC: "mr" instruction is unnecessary when extending DI to V1TI
2021-11-08 3:20 [Bug target/103124] New: PPC: "mr" instruction is unnecessary when extending DI to V1TI guihaoc at gcc dot gnu.org
` (4 preceding siblings ...)
2021-11-10 5:19 ` segher at gcc dot gnu.org
@ 2021-12-01 8:33 ` guihaoc at gcc dot gnu.org
2022-01-17 5:29 ` cvs-commit at gcc dot gnu.org
2022-01-18 1:15 ` guihaoc at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: guihaoc at gcc dot gnu.org @ 2021-12-01 8:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103124
--- Comment #5 from HaoChen Gui <guihaoc at gcc dot gnu.org> ---
(In reply to Segher Boessenkool from comment #4)
> Skipping mode TI for zero_extend lowering.
> Splitting mode TI for ashift lowering with shift amounts =
> Splitting mode TI for lshiftrt lowering with shift amounts =
> Splitting mode TI for ashiftrt lowering with shift amounts =
>
> All these should be fixed. But it is a red herring here, since the shift we
> have is in DImode already anyway, not TImode.
>
> Confirmed btw.
I not sure if splitting TI for zero_extend or shift is necessary. Do we
generate zero_extend:TI rtx or ashift:TI rtx? During expand, these operations
already expand to some operations on DI mode. They will be split latter if TI
copy splitting is allowed.
zero_extend
b = (unsigned __int128) a;
(insn 7 6 8 2 (set (subreg:DI (reg:TI 119) 8)
(const_int 0 [0])) "split1.c":5:10 -1
(nil))
ashift
b = a << 3;
(insn 6 3 7 2 (set (reg:DI 122)
(lshiftrt:DI (subreg:DI (reg/v:TI 119 [ a ]) 0)
(const_int 61 [0x3d]))) "split.c":4:9 -1
(nil))
(insn 7 6 8 2 (set (subreg:DI (reg:TI 121) 8)
(ashift:DI (subreg:DI (reg/v:TI 119 [ a ]) 8)
(const_int 3 [0x3]))) "split.c":4:9 -1
(nil))
(insn 8 7 9 2 (set (subreg:DI (reg:TI 121) 8)
(ior:DI (reg:DI 122)
(subreg:DI (reg:TI 121) 8))) "split.c":4:9 -1
(nil))
(insn 9 8 10 2 (set (subreg:DI (reg:TI 121) 0)
(ashift:DI (subreg:DI (reg/v:TI 119 [ a ]) 0)
(const_int 3 [0x3]))) "split.c":4:9 -1
(nil))
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug target/103124] PPC: "mr" instruction is unnecessary when extending DI to V1TI
2021-11-08 3:20 [Bug target/103124] New: PPC: "mr" instruction is unnecessary when extending DI to V1TI guihaoc at gcc dot gnu.org
` (5 preceding siblings ...)
2021-12-01 8:33 ` guihaoc at gcc dot gnu.org
@ 2022-01-17 5:29 ` cvs-commit at gcc dot gnu.org
2022-01-18 1:15 ` guihaoc at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-01-17 5:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103124
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by HaoChen Gui <guihaoc@gcc.gnu.org>:
https://gcc.gnu.org/g:240dd6c063b481c092c9ec406b69b400f6f033f1
commit r12-6620-g240dd6c063b481c092c9ec406b69b400f6f033f1
Author: Haochen Gui <guihaoc@gcc.gnu.org>
Date: Mon Jan 17 11:24:20 2022 +0800
rs6000: Split pattern for TI to V1TI move [PR103124]
This patch defines a new split pattern for TI to V1TI move. The pattern
concatenates two subreg:DI of a TI to a V2DI. With the pattern, the subreg
pass can do register split for TI when there is a TI to V1TI move.
gcc/
PR target/103124
* config/rs6000/vsx.md (split pattern for TI to V1TI move):
Defined.
gcc/testsuite/
PR target/103124
* gcc.target/powerpc/pr103124.c: New testcase.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug target/103124] PPC: "mr" instruction is unnecessary when extending DI to V1TI
2021-11-08 3:20 [Bug target/103124] New: PPC: "mr" instruction is unnecessary when extending DI to V1TI guihaoc at gcc dot gnu.org
` (6 preceding siblings ...)
2022-01-17 5:29 ` cvs-commit at gcc dot gnu.org
@ 2022-01-18 1:15 ` guihaoc at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: guihaoc at gcc dot gnu.org @ 2022-01-18 1:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103124
HaoChen Gui <guihaoc at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #7 from HaoChen Gui <guihaoc at gcc dot gnu.org> ---
fixed by r12-6620
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2022-01-18 1:15 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-08 3:20 [Bug target/103124] New: PPC: "mr" instruction is unnecessary when extending DI to V1TI guihaoc at gcc dot gnu.org
2021-11-08 3:24 ` [Bug target/103124] " pinskia at gcc dot gnu.org
2021-11-08 3:29 ` guihaoc at gcc dot gnu.org
2021-11-09 2:34 ` guihaoc at gcc dot gnu.org
2021-11-09 2:39 ` guihaoc at gcc dot gnu.org
2021-11-10 5:19 ` segher at gcc dot gnu.org
2021-12-01 8:33 ` guihaoc at gcc dot gnu.org
2022-01-17 5:29 ` cvs-commit at gcc dot gnu.org
2022-01-18 1:15 ` guihaoc at gcc dot gnu.org
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).