public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/26190] combine misses some distributivity
       [not found] <bug-26190-4@http.gcc.gnu.org/bugzilla/>
@ 2015-04-24 21:12 ` wilson at gcc dot gnu.org
  2015-04-24 21:13 ` wilson at gcc dot gnu.org
  2023-10-12  3:33 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 6+ messages in thread
From: wilson at gcc dot gnu.org @ 2015-04-24 21:12 UTC (permalink / raw)
  To: gcc-bugs

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

Jim Wilson <wilson at gcc dot gnu.org> changed:

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

--- Comment #2 from Jim Wilson <wilson at gcc dot gnu.org> ---
Created attachment 35398
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35398&action=edit
prototype patches for ior/shift/xor optimization


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

* [Bug rtl-optimization/26190] combine misses some distributivity
       [not found] <bug-26190-4@http.gcc.gnu.org/bugzilla/>
  2015-04-24 21:12 ` [Bug rtl-optimization/26190] combine misses some distributivity wilson at gcc dot gnu.org
@ 2015-04-24 21:13 ` wilson at gcc dot gnu.org
  2023-10-12  3:33 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 6+ messages in thread
From: wilson at gcc dot gnu.org @ 2015-04-24 21:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jim Wilson <wilson at gcc dot gnu.org> ---
This ior/shift/xor optimization be done during combine with a simplify-rtx.c
patch.  I wrote a prototype and tested it.  Combine canonicalizes shift/logical
as logical/shift, so we actually have to look for ior/xor/shift.  I see that
the optimization does not happen on arm and aarch64 because the 0x4002 value
does not fit into the immediate range for logical ops, gets loaded into a
register, pulled out of the loop, and hence is not available to combine.  We
would have to perform the optimization earlier for it to work for arm/aarch64. 
I tried MIPS, and see that because MIPS promotes HImode to SImode we don't have
enough info to prove that the opt is safe.  We need type info to make this
work.  This prototype does work for the x86 target which has both 16-bit
immediates and HImode instructions.

Next I wrote a prototype for match-and-simplify.  This one works for all 4
targets.  We have to handle ior/shift/xor as match-and-simplify does not
canonicalize logical/shift.  I noticed that if I change the xor to an ior, then
it gets optimized in combine because of the canonicalization for mips and x86,
but not for arm/aarch64 again because the constant was pulled out of the loop. 
So it seems that match-and-simplify should canonicalize shift/logical to
logical/shift too.  That would also reduce the number of patterns we need to
match when performing this ior/shift/xor optimization.

These are prototype patches that need a bit more work to handle more cases, and
to prove that they test all conditions necessary to make them safe.  This is my
first attempt to use the wi:: functions, so there might be a better way to do
this.


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

* [Bug rtl-optimization/26190] combine misses some distributivity
       [not found] <bug-26190-4@http.gcc.gnu.org/bugzilla/>
  2015-04-24 21:12 ` [Bug rtl-optimization/26190] combine misses some distributivity wilson at gcc dot gnu.org
  2015-04-24 21:13 ` wilson at gcc dot gnu.org
@ 2023-10-12  3:33 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-12  3:33 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
      Known to work|                            |10.1.0
         Resolution|---                         |FIXED
   Target Milestone|---                         |10.0

--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed in GCC 10.1.0.

Part of it was fixed with r6-3841-g84ff66b884e9 . The other part which fixed
this was improving EVRP.

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

* [Bug rtl-optimization/26190] combine misses some distributivity
  2006-02-09  9:06 [Bug rtl-optimization/26190] New: " bonzini at gnu dot org
  2006-02-09  9:07 ` [Bug rtl-optimization/26190] " bonzini at gnu dot org
  2006-02-09 13:31 ` pinskia at gcc dot gnu dot org
@ 2006-02-25 19:49 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-02-25 19:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-02-25 19:40 -------
Confirmed.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-02-25 19:40:32
               date|                            |


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


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

* [Bug rtl-optimization/26190] combine misses some distributivity
  2006-02-09  9:06 [Bug rtl-optimization/26190] New: " bonzini at gnu dot org
  2006-02-09  9:07 ` [Bug rtl-optimization/26190] " bonzini at gnu dot org
@ 2006-02-09 13:31 ` pinskia at gcc dot gnu dot org
  2006-02-25 19:49 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-02-09 13:31 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |missed-optimization
           Priority|P1                          |P5


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


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

* [Bug rtl-optimization/26190] combine misses some distributivity
  2006-02-09  9:06 [Bug rtl-optimization/26190] New: " bonzini at gnu dot org
@ 2006-02-09  9:07 ` bonzini at gnu dot org
  2006-02-09 13:31 ` pinskia at gcc dot gnu dot org
  2006-02-25 19:49 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 6+ messages in thread
From: bonzini at gnu dot org @ 2006-02-09  9:07 UTC (permalink / raw)
  To: gcc-bugs



-- 

bonzini at gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  BugsThisDependsOn|                            |16798, 18395
           Severity|normal                      |enhancement
           Priority|P3                          |P1


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


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

end of thread, other threads:[~2023-10-12  3:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-26190-4@http.gcc.gnu.org/bugzilla/>
2015-04-24 21:12 ` [Bug rtl-optimization/26190] combine misses some distributivity wilson at gcc dot gnu.org
2015-04-24 21:13 ` wilson at gcc dot gnu.org
2023-10-12  3:33 ` pinskia at gcc dot gnu.org
2006-02-09  9:06 [Bug rtl-optimization/26190] New: " bonzini at gnu dot org
2006-02-09  9:07 ` [Bug rtl-optimization/26190] " bonzini at gnu dot org
2006-02-09 13:31 ` pinskia at gcc dot gnu dot org
2006-02-25 19:49 ` pinskia at gcc dot gnu dot 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).