On Fri, Jan 26, 2024 at 7:26 PM Roger Sayle <ro...@nextmovesoftware.com> wrote: > > > This patch addresses a missed optimization opportunity in the RTL > optimization passes. The function simplify_const_binary_operation > will constant fold binary operators with two CONST_INT operands, > and those with two CONST_VECTOR operands, but is missing compile-time > evaluation of binary operators with a CONST_VECTOR and a CONST_INT, > such as vector shifts and rotates. > > My first version of this patch didn't contain a switch statement to > explicitly check for valid binary opcodes, which bootstrapped and > regression tested fine, but by paranoia has got the better of me, > so this version now checks that VEC_SELECT or some funky (future) > rtx_code doesn't cause problems. > > This patch has been tested on x86_64-pc-linux-gnu with make bootstrap > and make -k check, both with and without --target_board=unix{-m32} > with no new failures. Ok for mainline (in stage 1)?
OK. Thanks, Richard. > > 2024-01-26 Roger Sayle <ro...@nextmovesoftware.com> > > gcc/ChangeLog > * simplify-rtx.cc (simplify_const_binary_operation): Constant > fold binary operations where the LHS is CONST_VECTOR and the > RHS is CONST_INT (or CONST_DOUBLE) such as vector shifts. > > > Thanks in advance, > Roger > -- >