[Bug tree-optimization/96226] Failure to optimize shift+not to rotate

2020-12-04 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96226

--- Comment #5 from CVS Commits  ---
The master branch has been updated by Jakub Jelinek :

https://gcc.gnu.org/g:625e002396f7d0108f845bfba6a6f4f4fcadad05

commit r11-5756-g625e002396f7d0108f845bfba6a6f4f4fcadad05
Author: Jakub Jelinek 
Date:   Sat Dec 5 01:31:08 2020 +0100

i386: Combine splitters followup [PR96226]

Here is the patch to simplify the newly added combine splitters,
when we split into 2 insns anyway, no reason to split into the masking
define_insn_and_split we'd be splitting shortly after.

2020-12-05  Jakub Jelinek  

PR target/96226
* config/i386/i386.md (splitter after *3_mask,
splitter after *3_mask_1): Drop the masking from
the patterns to split into.

[Bug tree-optimization/96226] Failure to optimize shift+not to rotate

2020-12-04 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96226

Jakub Jelinek  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|UNCONFIRMED |RESOLVED

--- Comment #4 from Jakub Jelinek  ---
Fixed for GCC 11+.

[Bug tree-optimization/96226] Failure to optimize shift+not to rotate

2020-12-04 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96226

--- Comment #3 from CVS Commits  ---
The master branch has been updated by Jakub Jelinek :

https://gcc.gnu.org/g:ac2a6962b91128e700ee52db686dcdb2bab93790

commit r11-5747-gac2a6962b91128e700ee52db686dcdb2bab93790
Author: Jakub Jelinek 
Date:   Fri Dec 4 18:44:31 2020 +0100

i386: Add combine splitters to allow combining multiple insns into reg1 =
const; reg2 = rotate (reg1, reg3 & cst) [PR96226]

As mentioned in the PR, we can combine ~(1 << x) into -2 r<< x, but we give
up in the ~(1 << (x & 31)) cases, as *3_mask* don't
allow
immediate operand 1 and find_split_point prefers to split (x & 31) instead
of the constant.

With these combine splitters we help combine decide how to split those
insns.

2020-12-04  Jakub Jelinek  

PR target/96226
* config/i386/i386.md (splitter after *3_mask,
splitter after *3_mask_1): New combine
splitters.

* gcc.target/i386/pr96226.c: New test.

[Bug tree-optimization/96226] Failure to optimize shift+not to rotate

2020-12-04 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96226

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek  ---
Created attachment 49683
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49683&action=edit
gcc11-pr96226.patch

Untested fix.

[Bug tree-optimization/96226] Failure to optimize shift+not to rotate

2020-07-17 Thread ubizjak at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96226

--- Comment #1 from Uroš Bizjak  ---
The combine produces:

Trying 7, 8 -> 9:
7: r89:SI=0x1
8: {r88:SI=r89:SI<3_mask"
  [(set (match_operand:SWI48 0 "nonimmediate_operand")
(any_rotate:SWI48
  (match_operand:SWI48 1 "nonimmediate_operand")
  (subreg:QI
(and:SI
  (match_operand:SI 2 "register_operand" "c")
  (match_operand:SI 3 "const_int_operand")) 0)))
   (clobber (reg:CC FLAGS_REG))]
  "ix86_binary_operator_ok (, mode, operands)
   && (INTVAL (operands[3]) & (GET_MODE_BITSIZE (mode)-1))
  == GET_MODE_BITSIZE (mode)-1

However, the above pattern doesn't allow immediate operand.