public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/36884] ifcvt poor optimization
       [not found] <bug-36884-4@http.gcc.gnu.org/bugzilla/>
@ 2011-06-29 19:13 ` gjl at gcc dot gnu.org
  2011-07-05 13:21 ` gjl at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: gjl at gcc dot gnu.org @ 2011-06-29 19:13 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36884

Georg-Johann Lay <gjl at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |missed-optimization
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011.06.29 19:13:14
                 CC|                            |gjl at gcc dot gnu.org
          Component|middle-end                  |rtl-optimization
     Ever Confirmed|0                           |1
      Known to fail|                            |4.6.1

--- Comment #3 from Georg-Johann Lay <gjl at gcc dot gnu.org> 2011-06-29 19:13:14 UTC ---
I see same output like Andy in 4.6.1 and trunk.

Also played around with avr_rtx_costs in trunk, but that does not help; only
fix is -fno-if-conversion.


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

* [Bug rtl-optimization/36884] ifcvt poor optimization
       [not found] <bug-36884-4@http.gcc.gnu.org/bugzilla/>
  2011-06-29 19:13 ` [Bug rtl-optimization/36884] ifcvt poor optimization gjl at gcc dot gnu.org
@ 2011-07-05 13:21 ` gjl at gcc dot gnu.org
  2011-07-05 13:24 ` gjl at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: gjl at gcc dot gnu.org @ 2011-07-05 13:21 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36884

--- Comment #4 from Georg-Johann Lay <gjl at gcc dot gnu.org> 2011-07-05 13:20:15 UTC ---
Created attachment 24691
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24691
C Testcase pr36884.c

This testcase shows the dis-optimization in 4.7. trunk

======================================================
Compiled with -O2 -S:

swap:
    mov r18,r25
    rol r18
    clr r18
    rol r18
    ldi r19,lo8(0)
    clr __tmp_reg__
    lsr r19
    ror r18
    ror __tmp_reg__
    lsr r19
    ror r18
    ror __tmp_reg__
    mov r19,r18
    mov r18,__tmp_reg__
    sbrc r25,6
    ori r19,hi8(8192)
.L3:
    sbrc r25,5
    ori r19,hi8(16384)
.L4:
    sbrc r25,4
    ori r19,hi8(-32768)
.L5:
    mov r24,r18
    mov r25,r19
    ret

======================================================
Compiled with -O2 -S -fno-if-conversion:

swap:
    sbrc r25,7
    rjmp .L6
    ldi r18,lo8(0)
    ldi r19,hi8(0)
.L2:
    sbrc r25,6
    ori r19,hi8(8192)
.L3:
    sbrc r25,5
    ori r19,hi8(16384)
.L4:
    sbrc r25,4
    ori r19,hi8(-32768)
.L5:
    mov r24,r18
    mov r25,r19
    ret
.L6:
    ldi r18,lo8(64)
    ldi r19,hi8(64)
    rjmp .L2

======================================================

The compiler does a lengthy extract and reuse of the MSB.


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

* [Bug rtl-optimization/36884] ifcvt poor optimization
       [not found] <bug-36884-4@http.gcc.gnu.org/bugzilla/>
  2011-06-29 19:13 ` [Bug rtl-optimization/36884] ifcvt poor optimization gjl at gcc dot gnu.org
  2011-07-05 13:21 ` gjl at gcc dot gnu.org
@ 2011-07-05 13:24 ` gjl at gcc dot gnu.org
  2012-03-22  8:52 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: gjl at gcc dot gnu.org @ 2011-07-05 13:24 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36884

Georg-Johann Lay <gjl at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.7.0

--- Comment #5 from Georg-Johann Lay <gjl at gcc dot gnu.org> 2011-07-05 13:22:53 UTC ---
I had a look in ifcvt.c.

Obviously, noce_try_sign_mask does it's work unconditionally and does not take
into account costs.  It appears that it assumes that cheap barrel shifter is
available as on most 32-bit machines.


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

* [Bug rtl-optimization/36884] ifcvt poor optimization
       [not found] <bug-36884-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2011-07-05 13:24 ` gjl at gcc dot gnu.org
@ 2012-03-22  8:52 ` rguenth at gcc dot gnu.org
  2012-07-02 13:04 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-03-22  8:52 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36884

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.7.0                       |4.7.1

--- Comment #6 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-03-22 08:26:19 UTC ---
GCC 4.7.0 is being released, adjusting target milestone.


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

* [Bug rtl-optimization/36884] ifcvt poor optimization
       [not found] <bug-36884-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2012-03-22  8:52 ` rguenth at gcc dot gnu.org
@ 2012-07-02 13:04 ` rguenth at gcc dot gnu.org
  2012-10-15  7:47 ` steven at gcc dot gnu.org
  2023-05-26  1:18 ` pinskia at gcc dot gnu.org
  6 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-07-02 13:04 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36884

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.7.1                       |---


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

* [Bug rtl-optimization/36884] ifcvt poor optimization
       [not found] <bug-36884-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2012-07-02 13:04 ` rguenth at gcc dot gnu.org
@ 2012-10-15  7:47 ` steven at gcc dot gnu.org
  2023-05-26  1:18 ` pinskia at gcc dot gnu.org
  6 siblings, 0 replies; 7+ messages in thread
From: steven at gcc dot gnu.org @ 2012-10-15  7:47 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36884

--- Comment #7 from Steven Bosscher <steven at gcc dot gnu.org> 2012-10-15 07:47:27 UTC ---
(In reply to comment #5)
> Obviously, noce_try_sign_mask does it's work unconditionally and does
> not take into account costs.  It appears that it assumes that cheap 
> barrel shifter is available as on most 32-bit machines.

This can probably be fixed using lshift_cheap_p.  You should move 
lshift_cheap_p to optabs.c and use it in ifcvt.c to see if lshifts
are cheap.


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

* [Bug rtl-optimization/36884] ifcvt poor optimization
       [not found] <bug-36884-4@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2012-10-15  7:47 ` steven at gcc dot gnu.org
@ 2023-05-26  1:18 ` pinskia at gcc dot gnu.org
  6 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-26  1:18 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=109907

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I think the biggest issue now is:
```
;; _6 = _2 >= 0;

(insn 10 7 11 (set (reg:HI 48)
        (not:HI (reg:HI 44 [ _2 ]))) "/app/example.cpp":6:3 -1
     (nil))

(insn 11 10 12 (set (reg:HI 49)
        (lshiftrt:HI (reg:HI 48)
            (const_int 15 [0xf]))) "/app/example.cpp":6:3 -1
     (nil))

(insn 12 11 0 (set (reg:QI 45 [ _6 ])
        (subreg:QI (reg:HI 49) 0)) "/app/example.cpp":6:3 -1
     (nil))

```

If this was expanded instead using the bit select. 
I had noticed a similar thing in PR 109907 too.

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

end of thread, other threads:[~2023-05-26  1:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-36884-4@http.gcc.gnu.org/bugzilla/>
2011-06-29 19:13 ` [Bug rtl-optimization/36884] ifcvt poor optimization gjl at gcc dot gnu.org
2011-07-05 13:21 ` gjl at gcc dot gnu.org
2011-07-05 13:24 ` gjl at gcc dot gnu.org
2012-03-22  8:52 ` rguenth at gcc dot gnu.org
2012-07-02 13:04 ` rguenth at gcc dot gnu.org
2012-10-15  7:47 ` steven at gcc dot gnu.org
2023-05-26  1:18 ` pinskia 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).