* [Bug middle-end/56552] conditional move can generate unnecessary conversion code
2013-03-06 18:19 [Bug middle-end/56552] New: conditional move can generate unnecessary conversion code sje at gcc dot gnu.org
@ 2013-03-07 10:06 ` rguenth at gcc dot gnu.org
2013-03-07 13:32 ` jakub at gcc dot gnu.org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-03-07 10:06 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56552
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |missed-optimization
Status|UNCONFIRMED |NEW
Last reconfirmed| |2013-03-07
Ever Confirmed|0 |1
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> 2013-03-07 10:05:50 UTC ---
Confirmed. known-zero-bits and friends should figure this out I think.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug middle-end/56552] conditional move can generate unnecessary conversion code
2013-03-06 18:19 [Bug middle-end/56552] New: conditional move can generate unnecessary conversion code sje at gcc dot gnu.org
2013-03-07 10:06 ` [Bug middle-end/56552] " rguenth at gcc dot gnu.org
@ 2013-03-07 13:32 ` jakub at gcc dot gnu.org
2013-03-07 14:53 ` pinskia at gcc dot gnu.org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-03-07 13:32 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56552
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-03-07 13:32:30 UTC ---
I had to use -O3 -march=loongson2f to trigger it.
During combine, it seems the combiner figures everything out, but mips.md lacks
needed conditional move patterns:
(insn 36 35 37 2 (set (reg:SI 298)
(if_then_else:SI (eq:SI (reg:SI 299)
(const_int 0 [0]))
(reg/v:SI 194 [ a2+-2 ])
(reg/v:SI 213 [ a2+-2 ]))) 602 {*movsi_on_si}
(expr_list:REG_DEAD (reg:SI 299)
(expr_list:REG_DEAD (reg/v:SI 213 [ a2+-2 ])
(expr_list:REG_DEAD (reg/v:SI 194 [ a2+-2 ])
(nil)))))
(insn 37 36 40 2 (set (reg/v:SI 214 [ a2+-2 ])
(zero_extend:SI (subreg:HI (reg:SI 298) 2))) 188 {*zero_extendhisi2}
(expr_list:REG_DEAD (reg:SI 298)
(nil)))
and combiner has:
Trying 36 -> 37:
Failed to match this instruction:
(set (reg/v:SI 214 [ a2+-2 ])
(if_then_else:SI (reg:SI 299)
(reg/v:SI 213 [ a2+-2 ])
(reg/v:SI 194 [ a2+-2 ])))
I.e. it figures that the masking isn't needed, but during
simplification/canonicalization transforms that (ne:SI (reg:SI 299) (const_int
0)) in first argument of IF_THEN_ELSE into (reg:SI 299).
If mips.md had patterns that accepted for movcc the first argument of
IF_THEN_ELSE being a register_operand of GPR mode as if it was (ne:GPR (that
register) (const_int 0)), the testcase would be fixed.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug middle-end/56552] conditional move can generate unnecessary conversion code
2013-03-06 18:19 [Bug middle-end/56552] New: conditional move can generate unnecessary conversion code sje at gcc dot gnu.org
2013-03-07 10:06 ` [Bug middle-end/56552] " rguenth at gcc dot gnu.org
2013-03-07 13:32 ` jakub at gcc dot gnu.org
@ 2013-03-07 14:53 ` pinskia at gcc dot gnu.org
2013-05-16 19:48 ` rsandifo at gcc dot gnu.org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-03-07 14:53 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56552
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
AssignedTo|unassigned at gcc dot |pinskia at gcc dot gnu.org
|gnu.org |
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> 2013-03-07 14:53:07 UTC ---
(In reply to comment #2)
> I had to use -O3 -march=loongson2f to trigger it.
> and combiner has:
> Trying 36 -> 37:
> Failed to match this instruction:
> (set (reg/v:SI 214 [ a2+-2 ])
> (if_then_else:SI (reg:SI 299)
> (reg/v:SI 213 [ a2+-2 ])
> (reg/v:SI 194 [ a2+-2 ])))
Then this is mine. I think Richard S. already approved this patch too.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug middle-end/56552] conditional move can generate unnecessary conversion code
2013-03-06 18:19 [Bug middle-end/56552] New: conditional move can generate unnecessary conversion code sje at gcc dot gnu.org
` (2 preceding siblings ...)
2013-03-07 14:53 ` pinskia at gcc dot gnu.org
@ 2013-05-16 19:48 ` rsandifo at gcc dot gnu.org
2013-05-16 19:51 ` rsandifo at gcc dot gnu.org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: rsandifo at gcc dot gnu.org @ 2013-05-16 19:48 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56552
rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rsandifo at gcc dot gnu.org
--- Comment #4 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> ---
I've probably missed the bigger picture here, but FWIW, I don't
see any problem with extending *mov<GPR:mode>_on_<MOVECC:mode>
to QI and HI. I suppose it would just be a case of replacing
GPR in that pattern with a new iterator.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug middle-end/56552] conditional move can generate unnecessary conversion code
2013-03-06 18:19 [Bug middle-end/56552] New: conditional move can generate unnecessary conversion code sje at gcc dot gnu.org
` (3 preceding siblings ...)
2013-05-16 19:48 ` rsandifo at gcc dot gnu.org
@ 2013-05-16 19:51 ` rsandifo at gcc dot gnu.org
2013-10-22 23:21 ` sje at gcc dot gnu.org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: rsandifo at gcc dot gnu.org @ 2013-05-16 19:51 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56552
--- Comment #5 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> ---
(In reply to rsandifo@gcc.gnu.org from comment #4)
> I've probably missed the bigger picture here, but FWIW, I don't
> see any problem with extending *mov<GPR:mode>_on_<MOVECC:mode>
> to QI and HI. I suppose it would just be a case of replacing
> GPR in that pattern with a new iterator.
Er, to be clear: I mean doing that on top of anything else that
might be needed. Andrew's patch still looks good too.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug middle-end/56552] conditional move can generate unnecessary conversion code
2013-03-06 18:19 [Bug middle-end/56552] New: conditional move can generate unnecessary conversion code sje at gcc dot gnu.org
` (4 preceding siblings ...)
2013-05-16 19:51 ` rsandifo at gcc dot gnu.org
@ 2013-10-22 23:21 ` sje at gcc dot gnu.org
2013-11-18 19:20 ` sje at gcc dot gnu.org
2014-11-22 22:00 ` pinskia at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: sje at gcc dot gnu.org @ 2013-10-22 23:21 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56552
--- Comment #6 from Steve Ellcey <sje at gcc dot gnu.org> ---
Created attachment 31076
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31076&action=edit
Proposed patch I tested
Andrew, is this still on your TODO list? I have attached a patch that I have
tested here.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug middle-end/56552] conditional move can generate unnecessary conversion code
2013-03-06 18:19 [Bug middle-end/56552] New: conditional move can generate unnecessary conversion code sje at gcc dot gnu.org
` (5 preceding siblings ...)
2013-10-22 23:21 ` sje at gcc dot gnu.org
@ 2013-11-18 19:20 ` sje at gcc dot gnu.org
2014-11-22 22:00 ` pinskia at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: sje at gcc dot gnu.org @ 2013-11-18 19:20 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56552
--- Comment #7 from Steve Ellcey <sje at gcc dot gnu.org> ---
Author: sje
Date: Mon Nov 18 19:20:12 2013
New Revision: 204979
URL: http://gcc.gnu.org/viewcvs?rev=204979&root=gcc&view=rev
Log:
2013-11-18 Andrew Pinski <apinski@cavium.com>
Steve Ellcey <sellcey@mips.com>
PR target/56552
* config/mips/mips.md (*mov<GPR:mode>_on_<MOVECC:mode>): Remove
type restriction from equality_operator on conditonal move.
(*mov<SCALARF:mode>_on_<MOVECC:mode>): Ditto.
(*mov<GPR:mode>_on_<GPR2:mode>_ne): New.
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/mips/mips.md
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug middle-end/56552] conditional move can generate unnecessary conversion code
2013-03-06 18:19 [Bug middle-end/56552] New: conditional move can generate unnecessary conversion code sje at gcc dot gnu.org
` (6 preceding siblings ...)
2013-11-18 19:20 ` sje at gcc dot gnu.org
@ 2014-11-22 22:00 ` pinskia at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-11-22 22:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56552
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 9+ messages in thread