Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
middle-end: Simplify subtract where both arguments are being bitwise …
…inverted. This adds a match.pd rule that drops the bitwwise nots when both arguments to a subtract is inverted. i.e. for: float g(float a, float b) { return ~(int)a - ~(int)b; } we instead generate float g(float a, float b) { return (int)b - (int)a; } We already do a limited version of this from the fold_binary fold functions but this makes a more general version in match.pd that applies more often. gcc/ChangeLog: * match.pd: New bit_not rule. gcc/testsuite/ChangeLog: * gcc.dg/subnot.c: New test.
- Loading branch information