On Thu, Mar 21, 2024 at 4:36 PM Takayuki 'January June' Suwa <jjsuwa_sys3...@yahoo.co.jp> wrote: > > int test(int a) { > return a * 4 + 30000; > } > > In the example above, since Xtensa has instructions to add register value > scaled by 2, 4 or 8 (and corresponding define_insns), we would expect them > to be used but not, because it is transformed before reaching the RTL > generation pass as below: > > int test(int a) { > return (a + 7500) * 4; > } > > Fortunately, the RTL combination pass tries a splitting pattern that matches > the first example, so it is easy to solve by defining that pattern. > > gcc/ChangeLog: > > * config/xtensa/xtensa.md: Add new split pattern described above. > --- > gcc/config/xtensa/xtensa.md | 14 ++++++++++++++ > 1 file changed, 14 insertions(+)
Regtested for target=xtensa-linux-uclibc, no new regressions. Committed to master. -- Thanks. -- Max