https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114087
--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jeff Law <l...@gcc.gnu.org>: https://gcc.gnu.org/g:d17b09c07a1da0e3950718aabc2cbdb90cae402b commit r15-6307-gd17b09c07a1da0e3950718aabc2cbdb90cae402b Author: Oliver Kozul <oliver.ko...@rt-rk.com> Date: Tue Dec 17 07:44:33 2024 -0700 [PATCH] RISC-V: optimization on checking certain bits set ((x & mask) == val) The patch optimizes code generation for comparisons of the form X & C1 == C2 by converting them to (X | ~C1) == (C2 | ~C1). C1 is a constant that requires li and addi to be loaded, while ~C1 requires a single lui instruction. As the values of C1 and C2 are not visible within the equality expression, a plus pattern is matched instead. ââââââPR target/114087 gcc/ChangeLog: * config/riscv/riscv.md (*lui_constraint<ANYI:mode>_and_to_or): New pattern gcc/testsuite/ChangeLog: * gcc.target/riscv/pr114087-1.c: New test.