Applied to master. Thanks! --Philipp. On Fri, 18 Nov 2022 at 21:11, Jeff Law wrote: > > On 11/8/22 17:06, Philipp Tomsich wrote: > > Optimize the common case of a SImode min/max against a constant > > that is safe both for sign- and zero-extension. > > E.g., consider the case > > int f(unsigned int* a) > > { > > const int C = 1000; > > return *a * 3 > C ? C : *a * 3; > > } > > where the constant C will yield the same result in DImode whether > > sign- or zero-extended. > > > > This should eventually go away once the lowering to RTL smartens up > > and considers the precision/signedness and the value-ranges of the > > operands to MIN_EXPR nad MAX_EXPR. > > > > gcc/ChangeLog: > > > > * config/riscv/bitmanip.md (*minmax): Additional pattern for > > min/max against constants that are extension-invariant. > > * config/riscv/iterators.md (minmax_optab): Add an iterator > > that has only min and max rtl. > > > > gcc/testsuite/ChangeLog: > > > > * gcc.target/riscv/zbb-min-max-02.c: New test. > > Ok > > jeff > > >