public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/66217] New: PowerPC rotate/shift/mask instructions not optimal
@ 2015-05-20 12:57 segher at gcc dot gnu.org
2015-05-20 15:06 ` [Bug ada/66217] " dje at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: segher at gcc dot gnu.org @ 2015-05-20 12:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66217
Bug ID: 66217
Summary: PowerPC rotate/shift/mask instructions not optimal
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: ada
Assignee: segher at gcc dot gnu.org
Reporter: segher at gcc dot gnu.org
Target Milestone: ---
Target: powerpc*-*-*
GCC does not generate optimal instruction sequences for rotate/shift/mask
sequences; it pretty often makes quite bad code, even, esp. when it
involves 64-bit instructions.
One part of the problem is that the masks we allow are less general
than what the hardware allows. Not a huge problem for the rlwinm
instructions, but we shouldn't need "mask_operand_wrap" there either.
Another big part of the problem is our rtx_cost function does not
handle rotate-and-mask correctly; it recurses to get the cost of
the mask, but then it looks at the mode of it, which is VOIDmode
(it is a const_int), and things go south.
It would be nice to not need that rtx_cost at all, certainly not
for combine (which has access to full insns always), but that is
a bigger project.
Another problem is with the insert insns. They are not as general
as they should be, as before. Also, we should be able to handle
things like (a << 16) | (b >> 16), which is an insert insn followed
by a "normal" rotate (or the other way around). This should also
make the bswap patterns a little bit simpler.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug ada/66217] PowerPC rotate/shift/mask instructions not optimal
2015-05-20 12:57 [Bug ada/66217] New: PowerPC rotate/shift/mask instructions not optimal segher at gcc dot gnu.org
@ 2015-05-20 15:06 ` dje at gcc dot gnu.org
2015-07-20 16:31 ` [Bug target/66217] " segher at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: dje at gcc dot gnu.org @ 2015-05-20 15:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66217
David Edelsohn <dje at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2015-05-20
CC| |dje at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #1 from David Edelsohn <dje at gcc dot gnu.org> ---
Confirmed.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/66217] PowerPC rotate/shift/mask instructions not optimal
2015-05-20 12:57 [Bug ada/66217] New: PowerPC rotate/shift/mask instructions not optimal segher at gcc dot gnu.org
2015-05-20 15:06 ` [Bug ada/66217] " dje at gcc dot gnu.org
@ 2015-07-20 16:31 ` segher at gcc dot gnu.org
2015-07-22 1:45 ` dje at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: segher at gcc dot gnu.org @ 2015-07-20 16:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66217
--- Comment #2 from Segher Boessenkool <segher at gcc dot gnu.org> ---
Author: segher
Date: Mon Jul 20 16:30:56 2015
New Revision: 226005
URL: https://gcc.gnu.org/viewcvs?rev=226005&root=gcc&view=rev
Log:
PR target/66217
* config/rs6000/constraints.md ("S", "T", "t"): Delete. Update
"available letters" comment.
* config/rs6000/predicates.md (mask_operand, mask_operand_wrap,
mask64_operand, mask64_2_operand, any_mask_operand, and64_2_operand,
and_2rld_operand): Delete.
(and_operand): Adjust.
(rotate_mask_operator): New.
* config/rs6000/rs6000-protos.h (build_mask64_2_operands,
includes_lshift_p, includes_rshift_p, includes_rldic_lshift_p,
includes_rldicr_lshift_p, insvdi_rshift_rlwimi_p, extract_MB,
extract_ME): Delete.
(rs6000_is_valid_mask, rs6000_is_valid_and_mask,
rs6000_is_valid_shift_mask, rs6000_is_valid_insert_mask,
rs6000_insn_for_and_mask, rs6000_insn_for_shift_mask,
rs6000_insn_for_insert_mask, rs6000_is_valid_2insn_and,
rs6000_emit_2insn_and): New.
* config/rs6000/rs6000.c (num_insns_constant): Adjust.
(build_mask64_2_operands, includes_lshift_p, includes_rshift_p,
includes_rldic_lshift_p, includes_rldicr_lshift_p,
insvdi_rshift_rlwimi_p, extract_MB, extract_ME): Delete.
(rs6000_is_valid_mask, rs6000_is_valid_and_mask,
rs6000_insn_for_and_mask, rs6000_is_valid_shift_mask,
s6000_insn_for_shift_mask, rs6000_is_valid_insert_mask,
rs6000_insn_for_insert_mask, rs6000_is_valid_2insn_and,
rs6000_emit_2insn_and): New.
(print_operand) <'b', 'B', 'm', 'M', 's', 'S', 'W'>: Delete.
(rs6000_rtx_costs) <CONST_INT>: Delete mask_operand and mask64_operand
handling.
<NOT>: Don't fall through to next case.
<AND>: Handle the various rotate-and-mask cases directly.
<IOR>: Always cost as one insn.
* config/rs6000/rs6000.md (splitter for bswap:SI): Adjust.
(and<mode>3): Adjust expander for the new patterns.
(and<mode>3_imm, and<mode>3_imm_dot, and<mode>3_imm_dot2,
and<mode>3_imm_mask_dot, and<mode>3_imm_mask_dot2): Adjust condition.
(*and<mode>3_imm_dot_shifted): New.
(*and<mode>3_mask): Delete, rewrite as ...
(and<mode>3_mask): ... New.
(*and<mode>3_mask_dot, *and<mode>3_mask_dot): Rewrite.
(andsi3_internal0_nomc): Delete.
(*andsi3_internal6): Delete.
(*and<mode>3_2insn): New.
(insv, insvsi_internal, *insvsi_internal1, *insvsi_internal2,
*insvsi_internal3, *insvsi_internal4, *insvsi_internal5,
*insvsi_internal6, insvdi_internal, *insvdi_internal2,
*insvdi_internal3): Delete.
(*rotl<mode>3_mask, *rotl<mode>3_mask_dot, *rotl<mode>3_mask_dot2,
*rotl<mode>3_insert, *rotl<mode>3_insert_2, *rotl<mode>3_insert_3,
*rotl<mode>3_insert_4, two splitters for multi-precision shifts,
*ior<mode>_mask): New.
(extzv, extzvdi_internal, *extzvdi_internal1, *extzvdi_internal2,
*rotlsi3_mask, *rotlsi3_mask_dot, *rotlsi3_mask_dot2,
*ashlsi3_imm_mask, *ashlsi3_imm_mask_dot, *ashlsi3_imm_mask_dot2,
*lshrsi3_imm_mask, *lshrsi3_imm_mask_dot, *lshrsi3_imm_mask_dot2):
Delete.
(ashr<mode>3): Delete expander.
(*ashr<mode>3): Rename to ...
(ashr<mode>3): ... This.
(ashrdi3_no_power, *ashrdisi3_noppc64be): Delete.
(*rotldi3_internal4, *rotldi3_internal5 and split,
*rotldi3_internal6 and split, *ashldi3_internal4, ashldi3_internal5
and split, *ashldi3_internal6 and split, *ashldi3_internal7,
ashldi3_internal8 and split, *ashldi3_internal9 and split): Delete.
(*anddi3_2rld, *anddi3_2rld_dot, *anddi3_2rld_dot2): Delete.
(splitter for loading a mask): Adjust.
* doc/md.texi (Machine Constraints): Remove q, S, T, t constraints.
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/rs6000/constraints.md
trunk/gcc/config/rs6000/predicates.md
trunk/gcc/config/rs6000/rs6000-protos.h
trunk/gcc/config/rs6000/rs6000.c
trunk/gcc/config/rs6000/rs6000.md
trunk/gcc/doc/md.texi
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/66217] PowerPC rotate/shift/mask instructions not optimal
2015-05-20 12:57 [Bug ada/66217] New: PowerPC rotate/shift/mask instructions not optimal segher at gcc dot gnu.org
2015-05-20 15:06 ` [Bug ada/66217] " dje at gcc dot gnu.org
2015-07-20 16:31 ` [Bug target/66217] " segher at gcc dot gnu.org
@ 2015-07-22 1:45 ` dje at gcc dot gnu.org
2015-07-23 14:38 ` segher at gcc dot gnu.org
2015-07-30 2:34 ` segher at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: dje at gcc dot gnu.org @ 2015-07-22 1:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66217
David Edelsohn <dje at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
Target Milestone|--- |6.0
--- Comment #3 from David Edelsohn <dje at gcc dot gnu.org> ---
Fixed!
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/66217] PowerPC rotate/shift/mask instructions not optimal
2015-05-20 12:57 [Bug ada/66217] New: PowerPC rotate/shift/mask instructions not optimal segher at gcc dot gnu.org
` (2 preceding siblings ...)
2015-07-22 1:45 ` dje at gcc dot gnu.org
@ 2015-07-23 14:38 ` segher at gcc dot gnu.org
2015-07-30 2:34 ` segher at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: segher at gcc dot gnu.org @ 2015-07-23 14:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66217
--- Comment #4 from Segher Boessenkool <segher at gcc dot gnu.org> ---
Author: segher
Date: Thu Jul 23 14:37:57 2015
New Revision: 226112
URL: https://gcc.gnu.org/viewcvs?rev=226112&root=gcc&view=rev
Log:
PR target/66217
* config/rs6000/rs6000-protos.h (rs6000_emit_2insn_and): Change
prototype.
* config/rs6000/rs6000.c (rs6000_emit_dot_insn): New function.
(rs6000_emit_2insn_and): Handle dot forms.
* config/rs6000/rs6000.md (and<mode>3): Adjust.
(*and<mode>3_2insn): Remove TODO. Adjust. Add "type" attr.
(*and<mode>3_2insn_dot, *and<mode>3_2insn_dot2): New.
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/rs6000/rs6000-protos.h
trunk/gcc/config/rs6000/rs6000.c
trunk/gcc/config/rs6000/rs6000.md
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/66217] PowerPC rotate/shift/mask instructions not optimal
2015-05-20 12:57 [Bug ada/66217] New: PowerPC rotate/shift/mask instructions not optimal segher at gcc dot gnu.org
` (3 preceding siblings ...)
2015-07-23 14:38 ` segher at gcc dot gnu.org
@ 2015-07-30 2:34 ` segher at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: segher at gcc dot gnu.org @ 2015-07-30 2:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66217
--- Comment #5 from Segher Boessenkool <segher at gcc dot gnu.org> ---
Author: segher
Date: Thu Jul 30 02:34:09 2015
New Revision: 226378
URL: https://gcc.gnu.org/viewcvs?rev=226378&root=gcc&view=rev
Log:
PR target/66217
PR target/67045
* config/rs6000/rs6000.md (and<mode>3): Put a CONST_INT_P check
around those cases that need one.
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/rs6000/rs6000.md
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-07-30 2:34 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-20 12:57 [Bug ada/66217] New: PowerPC rotate/shift/mask instructions not optimal segher at gcc dot gnu.org
2015-05-20 15:06 ` [Bug ada/66217] " dje at gcc dot gnu.org
2015-07-20 16:31 ` [Bug target/66217] " segher at gcc dot gnu.org
2015-07-22 1:45 ` dje at gcc dot gnu.org
2015-07-23 14:38 ` segher at gcc dot gnu.org
2015-07-30 2:34 ` segher 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).