aboutsummaryrefslogtreecommitdiff
path: root/libjava/javax
diff options
context:
space:
mode:
authorRoger Sayle <roger@nextmovesoftware.com>2022-08-15 17:32:26 +0100
committerRoger Sayle <roger@nextmovesoftware.com>2022-08-15 17:32:26 +0100
commit03acd8b6429e22068330dce5abf129291d3f26de (patch)
tree13582c7a6f978a641fa653a6b108f86f41b9b47f /libjava/javax
parentd2d189985d1f9fa09802c4a14856d442786f4bf8 (diff)
downloadgcc-03acd8b6429e22068330dce5abf129291d3f26de.zip
gcc-03acd8b6429e22068330dce5abf129291d3f26de.tar.gz
gcc-03acd8b6429e22068330dce5abf129291d3f26de.tar.bz2
PR tree-optimization/71343: Optimize (X<<C)&(Y<<C) as (X&Y)<<C.
This patch is the first part of a solution to PR tree-optimization/71343, a missed-optimization enhancement request where GCC fails to see that (a<<2)+(b<<2) == a*4+b*4. This piece is that (X<<C) op (Y<<C) can be simplified to (X op Y) << C, for many binary operators, including AND, IOR, XOR, and (if overflow isn't an issue) PLUS and MINUS. Likewise, the right shifts (both logical and arithmetic) and bit-wise logical operators can be simplified in a similar fashion. These all reduce the number of GIMPLE binary operations from 3 to 2, by combining/eliminating a shift operation. 2022-08-15 Roger Sayle <roger@nextmovesoftware.com> Richard Biener <rguenther@suse.de> gcc/ChangeLog PR tree-optimization/71343 * match.pd (op (lshift @0 @1) (lshift @2 @1)): Optimize the expression (X<<C) + (Y<<C) to (X+Y)<<C for multiple operators. (op (rshift @0 @1) (rshift @2 @1)): Likewise, simplify (X>>C)^(Y>>C) to (X^Y)>>C for binary logical operators, AND, IOR and XOR. gcc/testsuite/ChangeLog PR tree-optimization/71343 * gcc.dg/pr71343-1.c: New test case.
Diffstat (limited to 'libjava/javax')
0 files changed, 0 insertions, 0 deletions