On Sun, Feb 26, 2023 at 9:27 AM Takayuki 'January June' Suwa <jjsuwa_sys3...@yahoo.co.jp> wrote: > > This patch introduces the use of CLAMPS instruction when the instruction > is configured. > > /* example */ > int test(int a) { > if (a < -512) > return -512; > if (a > 511) > return 511; > return a; > } > > ;; prereq: TARGET_CLAMPS > test: > clamps a2, a2, 9 > ret.n > > gcc/ChangeLog: > > * config/xtensa/xtensa-protos.h (xtensa_match_CLAMPS_imms_p): > New prototype. > * config/xtensa/xtensa.cc (xtensa_match_CLAMPS_imms_p): > New function. > * config/xtensa/xtensa.h (TARGET_CLAMPS): New macro definition. > * config/xtensa/xtensa.md (*xtensa_clamps): New insn pattern. > --- > gcc/config/xtensa/xtensa-protos.h | 1 + > gcc/config/xtensa/xtensa.cc | 13 +++++++++++ > gcc/config/xtensa/xtensa.h | 1 + > gcc/config/xtensa/xtensa.md | 37 +++++++++++++++++++++++++++++++ > 4 files changed, 52 insertions(+)
Regtested for target=xtensa-linux-uclibc, no new regressions. Committed to master. -- Thanks. -- Max