aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.cc
diff options
context:
space:
mode:
authorRoger Sayle <roger@nextmovesoftware.com>2023-06-07 00:32:51 +0100
committerRoger Sayle <roger@nextmovesoftware.com>2023-06-07 00:32:51 +0100
commit6160572f8d243cb613ee0290fdc8580f1761d805 (patch)
tree4478298c304dfbedd605995d0af2d84f356af9a1 /gcc/expr.cc
parent585c660f041c57694a61b3e65085af5a54431be4 (diff)
downloadgcc-6160572f8d243cb613ee0290fdc8580f1761d805.zip
gcc-6160572f8d243cb613ee0290fdc8580f1761d805.tar.gz
gcc-6160572f8d243cb613ee0290fdc8580f1761d805.tar.bz2
Add RTX codes for BITREVERSE and COPYSIGN.
An analysis of backend UNSPECs reveals that two of the most common UNSPECs across target backends are for copysign and bit reversal. This patch adds RTX codes for these expressions to allow their representation to be standardized, and them to optimized by the middle-end RTL optimizers. 2023-06-07 Roger Sayle <roger@nextmovesoftware.com> gcc/ChangeLog * doc/rtl.texi (bitreverse, copysign): Document new RTX codes. * rtl.def (BITREVERSE, COPYSIGN): Define new RTX codes. * simplify-rtx.cc (simplify_unary_operation_1): Optimize NOT (BITREVERSE x) as BITREVERSE (NOT x). Optimize POPCOUNT (BITREVERSE x) as POPCOUNT x. Optimize PARITY (BITREVERSE x) as PARITY x. Optimize BITREVERSE (BITREVERSE x) as x. (simplify_const_unary_operation) <case BITREVERSE>: Evaluate BITREVERSE of a constant integer at compile-time. (simplify_binary_operation_1) <case COPYSIGN>: Optimize COPY_SIGN (x, x) as x. Optimize COPYSIGN (x, C) as ABS x or NEG (ABS x) for constant C. Optimize COPYSIGN (ABS x, y) and COPYSIGN (NEG x, y) as COPYSIGN (x, y). Optimize COPYSIGN (x, ABS y) as ABS x. Optimize COPYSIGN (COPYSIGN (x, y), z) as COPYSIGN (x, z). Optimize COPYSIGN (x, COPYSIGN (y, z)) as COPYSIGN (x, z). (simplify_const_binary_operation): Evaluate COPYSIGN of constant arguments at compile-time.
Diffstat (limited to 'gcc/expr.cc')
0 files changed, 0 insertions, 0 deletions