public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/64180] New: PowerPC carry bit improvements
@ 2014-12-04  2:23 segher at gcc dot gnu.org
  2014-12-04 18:38 ` [Bug target/64180] " dje at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: segher at gcc dot gnu.org @ 2014-12-04  2:23 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64180

            Bug ID: 64180
           Summary: PowerPC carry bit improvements
           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: powerpc*-*-*

In current mainline, every RTL instruction that uses XER[CA] (the
carry bit) will have to set it in the same instruction, because
other instructions clobber it at will.  Those RTL insns then are
output as multiple machine insns.  This is bad for multiple
reasons:

1) It leads to code explosion: we have patterns like and_neg_geu.
   None of those are necessary if we can just express the machine
   insns as separate RTL insns directly.
2) There are so many possible combinations that some are missed,
   or deemed not worth the effort (and cost) to implement as RTL
   insns.  This is especially true of the multi-precision add/sub
   patterns.  As a consequence we get not very well optimised
   code.
3) The resulting insns are not scheduled well.

So, let's improve this.


THE PLAN
========
First, we need to let GCC know about the CA bit.  This is done.
GCC thinks the register is SImode or DImode, which is a) fine,
because it will never allocate anything to it itself, and we
write only 0 or 1 to it; and b) handy, because we have to do
arithmetic with it in those modes all the time.

Secondly, we need to change all the patterns that clobber CA
so that either: a) they don't clobber it anymore; or b) the
clobber is explicit.  This is partly done.  Remaining are two
classes of insns: 1) those that should be split into separate
insns; and 2) those that slightly regress code quality if
changed (mostly those use "addic" so they can use GPR0 as
well as all other GPRs).

The insns in 1) are the multi-precision add/sub/neg, and all
the various eq/ne/ltu/gtu/leu/geu things.  These all have to
be done at the same time, using...

Thirdly, we need to add patterns for the actual machine insns.
For things like "addic" we need multiple patterns, one each
per kind of immediate op (pos/neg/0/-1), since canonical RTL
for those is different.

We also should make all asm() clobber CA implicitly, because
quite a lot of code in the field clobbers it without telling
the compiler.

Finally, as a further improvement, we should put some extra
attributes on the "C" and "E" insns so that the scheduling
descriptions can be made more accurate; and those scheduling
descriptions then should be updated.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/64180] PowerPC carry bit improvements
  2014-12-04  2:23 [Bug ada/64180] New: PowerPC carry bit improvements segher at gcc dot gnu.org
@ 2014-12-04 18:38 ` dje at gcc dot gnu.org
  2014-12-10 18:29 ` segher at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: dje at gcc dot gnu.org @ 2014-12-04 18:38 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64180

David Edelsohn <dje at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-12-04
                 CC|                            |dje at gcc dot gnu.org
     Ever confirmed|0                           |1
           Severity|normal                      |enhancement

--- Comment #1 from David Edelsohn <dje at gcc dot gnu.org> ---
Confirmed.  Very nice enhancement.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/64180] PowerPC carry bit improvements
  2014-12-04  2:23 [Bug ada/64180] New: PowerPC carry bit improvements segher at gcc dot gnu.org
  2014-12-04 18:38 ` [Bug target/64180] " dje at gcc dot gnu.org
@ 2014-12-10 18:29 ` segher at gcc dot gnu.org
  2014-12-10 18:31 ` segher at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: segher at gcc dot gnu.org @ 2014-12-10 18:29 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64180

--- Comment #2 from Segher Boessenkool <segher at gcc dot gnu.org> ---
Author: segher
Date: Wed Dec 10 18:28:57 2014
New Revision: 218589

URL: https://gcc.gnu.org/viewcvs?rev=218589&root=gcc&view=rev
Log:
    PR target/64180
    * config/rs6000/rs6000.c (TARGET_MD_ASM_CLOBBERS): Define.
    (rs6000_md_asm_clobbers): New function.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/rs6000/rs6000.c


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/64180] PowerPC carry bit improvements
  2014-12-04  2:23 [Bug ada/64180] New: PowerPC carry bit improvements segher at gcc dot gnu.org
  2014-12-04 18:38 ` [Bug target/64180] " dje at gcc dot gnu.org
  2014-12-10 18:29 ` segher at gcc dot gnu.org
@ 2014-12-10 18:31 ` segher at gcc dot gnu.org
  2014-12-10 18:31 ` segher at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: segher at gcc dot gnu.org @ 2014-12-10 18:31 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64180

--- Comment #3 from Segher Boessenkool <segher at gcc dot gnu.org> ---
Author: segher
Date: Wed Dec 10 18:30:07 2014
New Revision: 218590

URL: https://gcc.gnu.org/viewcvs?rev=218590&root=gcc&view=rev
Log:
    PR target/64180
    * config/rs6000/darwin.md (macho_low_si): Remove "r" alternative.
    (macho_low_di): Ditto.
    * config/rs6000/rs6000.md (*largetoc_low): Ditto.
    (tocref<mode>): Ditto.
    (elf_low): Ditto.
    * config/rs6000/spe.md (mov_si<mode>_e500_subreg0_elf_low_be): Ditto.
    (mov_si<mode>_e500_subreg0_elf_low_le): Ditto.
    (mov_si<mode>_e500_subreg4_elf_low_be): Ditto.  Reformat condition.
    (mov_si<mode>_e500_subreg4_elf_low_le): Ditto.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/rs6000/darwin.md
    trunk/gcc/config/rs6000/rs6000.md
    trunk/gcc/config/rs6000/spe.md


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/64180] PowerPC carry bit improvements
  2014-12-04  2:23 [Bug ada/64180] New: PowerPC carry bit improvements segher at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2014-12-10 18:31 ` segher at gcc dot gnu.org
@ 2014-12-10 18:31 ` segher at gcc dot gnu.org
  2014-12-10 18:32 ` segher at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: segher at gcc dot gnu.org @ 2014-12-10 18:31 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64180

--- Comment #4 from Segher Boessenkool <segher at gcc dot gnu.org> ---
Author: segher
Date: Wed Dec 10 18:31:15 2014
New Revision: 218591

URL: https://gcc.gnu.org/viewcvs?rev=218591&root=gcc&view=rev
Log:
    PR target/64180
    * config/rs6000/rs6000.md (*ctr<mode>_internal1, *ctr<mode>_internal2,
    *ctr<mode>_internal5, *ctr<mode>_internal6): Change "r" alternatives
    to "b".  Increase length.
    (splitters for these): Split to cmp+addi instead of addic.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/rs6000/rs6000.md


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/64180] PowerPC carry bit improvements
  2014-12-04  2:23 [Bug ada/64180] New: PowerPC carry bit improvements segher at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2014-12-10 18:31 ` segher at gcc dot gnu.org
@ 2014-12-10 18:32 ` segher at gcc dot gnu.org
  2014-12-10 18:34 ` segher at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: segher at gcc dot gnu.org @ 2014-12-10 18:32 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64180

--- Comment #5 from Segher Boessenkool <segher at gcc dot gnu.org> ---
Author: segher
Date: Wed Dec 10 18:32:15 2014
New Revision: 218592

URL: https://gcc.gnu.org/viewcvs?rev=218592&root=gcc&view=rev
Log:
    PR target/64180
    * config/rs6000/rs6000.md (*add<mode>3_internal1): Remove addic
    alternative.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/rs6000/rs6000.md


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/64180] PowerPC carry bit improvements
  2014-12-04  2:23 [Bug ada/64180] New: PowerPC carry bit improvements segher at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2014-12-10 18:32 ` segher at gcc dot gnu.org
@ 2014-12-10 18:34 ` segher at gcc dot gnu.org
  2014-12-10 18:36 ` segher at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: segher at gcc dot gnu.org @ 2014-12-10 18:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64180

--- Comment #6 from Segher Boessenkool <segher at gcc dot gnu.org> ---
Author: segher
Date: Wed Dec 10 18:33:26 2014
New Revision: 218593

URL: https://gcc.gnu.org/viewcvs?rev=218593&root=gcc&view=rev
Log:
    PR target/64180
    * config/rs6000/rs6000.md (*add<mode>3_internal1): Rename to
    "*add<mode>3".
    (*add<mode>3_internal2, *add<mode>3_internal3, and (their splitters):
    Delete.
    (*add<mode>3_dot, *add<mode>3_dot2): New.
    (*add<mode>3_imm_dot, *add<mode>3_imm_dot2): New.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/rs6000/rs6000.md


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/64180] PowerPC carry bit improvements
  2014-12-04  2:23 [Bug ada/64180] New: PowerPC carry bit improvements segher at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2014-12-10 18:34 ` segher at gcc dot gnu.org
@ 2014-12-10 18:36 ` segher at gcc dot gnu.org
  2014-12-10 18:38 ` segher at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: segher at gcc dot gnu.org @ 2014-12-10 18:36 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64180

--- Comment #7 from Segher Boessenkool <segher at gcc dot gnu.org> ---
Author: segher
Date: Wed Dec 10 18:36:18 2014
New Revision: 218594

URL: https://gcc.gnu.org/viewcvs?rev=218594&root=gcc&view=rev
Log:
    PR target/64180
    * config/rs6000/predicates.md (adde_operand): New.
    * config/rs6000/rs6000.md (add<mode>3_carry): New.
    (*add<mode>3_imm_carry_pos): New.
    (*add<mode>3_imm_carry_0): New.
    (*add<mode>3_imm_carry_m1): New.
    (*add<mode>3_imm_carry_neg): New.
    (add<mode>3_carry_in): New.
    (*add<mode>3_carry_in_internal): New.
    (add<mode>3_carry_in_0): New.
    (add<mode>3_carry_in_m1): New.
    (subf<mode>3_carry): New.
    (*subf<mode>3_imm_carry_0): New.
    (*subf<mode>3_imm_carry_m1): New.
    (subf<mode>3_carry_in): New.
    (*subf<mode>3_carry_in_internal): New.
    (subf<mode>3_carry_in_0): New.
    (subf<mode>3_carry_in_m1): New.
    (subf<mode>3_carry_in_xx): New.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/rs6000/predicates.md
    trunk/gcc/config/rs6000/rs6000.md


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/64180] PowerPC carry bit improvements
  2014-12-04  2:23 [Bug ada/64180] New: PowerPC carry bit improvements segher at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2014-12-10 18:36 ` segher at gcc dot gnu.org
@ 2014-12-10 18:38 ` segher at gcc dot gnu.org
  2014-12-12 21:20 ` pthaugen at gcc dot gnu.org
  2015-01-02  2:16 ` segher at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: segher at gcc dot gnu.org @ 2014-12-10 18:38 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64180

--- Comment #8 from Segher Boessenkool <segher at gcc dot gnu.org> ---
Author: segher
Date: Wed Dec 10 18:37:58 2014
New Revision: 218595

URL: https://gcc.gnu.org/viewcvs?rev=218595&root=gcc&view=rev
Log:
    PR target/64180
    * config/rs6000/predicates.md (unsigned_comparison_operator): New.
    (signed_comparison_operator): New.
    * config/rs6000/rs6000-protos.h (rs6000_emit_eqne): Declare.
    * config/rs6000/rs6000.c (rs6000_emit_eqne): New function.
    (rs6000_emit_sCOND): Remove ISEL test (move it to the expander).
    * config/rs6000/rs6000.md (add<mode>3 for SDI): Expand DImode
    add to addc,adde directly, if !TARGET_POWERPC64.
    (sub<mode>3 for SDI): Expand DImode sub to subfc,subfe directly,
    if !TARGET_POWERPC64.
    (neg<mode>2): Delete expander.
    (*neg<mode>2): Rename to "neg<mode>2".
    (addti3, subti3): Delete.
    (addti3, subti3): New expanders.
    (*adddi3_noppc64, *subdi3_noppc64, *negdi2_noppc64): Delete.
    (cstore<mode>4_unsigned): New expander.
    (cstore<mode>4): Allow GPR as output (not just SI).  Rewrite.
    (cstore<mode>4 for FP): Remove superfluous quotes.
    (*eq<mode>, *eq<mode>_compare, *plus_eqsi and splitter,
    *compare_plus_eqsi and splitter, *plus_eqsi_compare and splitter,
    *neg_eq0<mode>, *neg_eq<mode>, *ne0_<mode>, plus_ne0_<mode>,
    compare_plus_ne0_<mode> and splitter, *compare_plus_ne0_<mode>_1 and
    splitter, *plus_ne0_<mode>_compare and splitter, *leu<mode>,
    *leu<mode>_compare and splitter, *plus_leu<mode>, *neg_leu<mode>,
    *and_neg_leu<mode>, *ltu<mode>, *ltu<mode>_compare, *plus_ltu<mode>,
    *plus_ltu<mode>_1, *plus_ltu<mode>compare, *neg_ltu<mode>, *geu<mode>,
    *geu<mode>_compare and splitter, *plus_geu<mode>, *neg_geu<mode>,
    *and_neg_geu<mode>, *plus_gt0<mode>, *gtu<mode>, *gtu<mode>_compare,
    *plus_gtu<mode>, *plus_gtu<mode>_1, *plus_gtu<mode>_compare,
    *neg_gtu<mode>, 12 anonymous insns, and 12 anonymous splitters):
    Delete.
    (eq<mode>3, ne<mode>3): New.
    (*neg_eq_<mode>, *neg_ne_<mode>): New.
    (*plus_eq_<mode>, *plus_ne_<mode>): New.
    (*minus_eq_<mode>, *minus_ne_<mode>): New.

Modified:
    trunk/gcc/ChangeLog
    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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/64180] PowerPC carry bit improvements
  2014-12-04  2:23 [Bug ada/64180] New: PowerPC carry bit improvements segher at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2014-12-10 18:38 ` segher at gcc dot gnu.org
@ 2014-12-12 21:20 ` pthaugen at gcc dot gnu.org
  2015-01-02  2:16 ` segher at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: pthaugen at gcc dot gnu.org @ 2014-12-12 21:20 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64180

Pat Haugen <pthaugen at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pthaugen at gcc dot gnu.org

--- Comment #9 from Pat Haugen <pthaugen at gcc dot gnu.org> ---
(In reply to Segher Boessenkool from comment #8)
> Author: segher
> Date: Wed Dec 10 18:37:58 2014
> New Revision: 218595
> 

This revision causes CPU2000 benchmark 186.crafty to loop when compiled with
-m32.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/64180] PowerPC carry bit improvements
  2014-12-04  2:23 [Bug ada/64180] New: PowerPC carry bit improvements segher at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2014-12-12 21:20 ` pthaugen at gcc dot gnu.org
@ 2015-01-02  2:16 ` segher at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: segher at gcc dot gnu.org @ 2015-01-02  2:16 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64180

Segher Boessenkool <segher at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #10 from Segher Boessenkool <segher at gcc dot gnu.org> ---
All done.


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2015-01-02  2:16 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-04  2:23 [Bug ada/64180] New: PowerPC carry bit improvements segher at gcc dot gnu.org
2014-12-04 18:38 ` [Bug target/64180] " dje at gcc dot gnu.org
2014-12-10 18:29 ` segher at gcc dot gnu.org
2014-12-10 18:31 ` segher at gcc dot gnu.org
2014-12-10 18:31 ` segher at gcc dot gnu.org
2014-12-10 18:32 ` segher at gcc dot gnu.org
2014-12-10 18:34 ` segher at gcc dot gnu.org
2014-12-10 18:36 ` segher at gcc dot gnu.org
2014-12-10 18:38 ` segher at gcc dot gnu.org
2014-12-12 21:20 ` pthaugen at gcc dot gnu.org
2015-01-02  2:16 ` 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).