[Bug tree-optimization/96691] Failure to optimize bitwise not+or+xor with constants to and+xor with bitwise not-ed constants
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96691 Andrew Pinski changed: What|Removed |Added Target Milestone|--- |11.0
[Bug tree-optimization/96691] Failure to optimize bitwise not+or+xor with constants to and+xor with bitwise not-ed constants
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96691 Jakub Jelinek changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org --- Comment #4 from Jakub Jelinek --- Fixed.
[Bug tree-optimization/96691] Failure to optimize bitwise not+or+xor with constants to and+xor with bitwise not-ed constants
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96691 --- Comment #3 from CVS Commits --- The master branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:8fc183ccd0628465205b8a88c29ab69bfe74a08a commit r11-6651-g8fc183ccd0628465205b8a88c29ab69bfe74a08a Author: Jakub Jelinek Date: Wed Jan 13 19:54:49 2021 +0100 match.pd: Fold (~X | C) ^ D into (X | C) ^ (~D ^ C) if (~D ^ C) can be simplified [PR96691] These simplifications are only simplifications if the (~D ^ C) or (D ^ C) expressions fold into gimple vals, but in that case they decrease number of operations by 1. 2021-01-13 Jakub Jelinek PR tree-optimization/96691 * match.pd ((~X | C) ^ D -> (X | C) ^ (~D ^ C), (~X & C) ^ D -> (X & C) ^ (D ^ C)): New simplifications if (~D ^ C) or (D ^ C) can be simplified. * gcc.dg/tree-ssa/pr96691.c: New test.
[Bug tree-optimization/96691] Failure to optimize bitwise not+or+xor with constants to and+xor with bitwise not-ed constants
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96691 Jakub Jelinek changed: What|Removed |Added CC||jakub at gcc dot gnu.org --- Comment #2 from Jakub Jelinek --- (~x | 123) ^ 321 can't be replaced by (x | 123) ^ ~321, that is not equivalent. I think the equivalencies this is based on are that for any X, C, D ((~X | C) ^ D) == ((X | C) ^ (~D ^ C)) and ((~X & C) ^ D) == ((X & C) ^ (D ^ C)) so if C and D are integral constants (scalar or vector), we should simplify it that way, and furthermore I'd say we should simplify (X | Y) ^ (~Z ^ Y) into (~X | Y) ^ Z as the latter has fewer operations.
[Bug tree-optimization/96691] Failure to optimize bitwise not+or+xor with constants to and+xor with bitwise not-ed constants
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96691 Richard Biener changed: What|Removed |Added Last reconfirmed||2020-08-25 Status|UNCONFIRMED |NEW Ever confirmed|0 |1
[Bug tree-optimization/96691] Failure to optimize bitwise not+or+xor with constants to and+xor with bitwise not-ed constants
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96691 --- Comment #1 from Gabriel Ravier --- int f(int x) { return (~x & 123) ^ 321; } A very similar transformation can be done with this code, transforming it to `return (x & 123) ^ 314;` (according to LLVM), and a similar transformation should be possible with other constants, though I can't identify myself the exact transformation you'd need to generalise this to all constants.