]> git.ipfire.org Git - thirdparty/gcc.git/commit
xtensa: Fix B[GE/LT]UI instructions with immediate values of 32768 or 65536 not being...
authorTakayuki 'January June' Suwa <jjsuwa_sys3175@yahoo.co.jp>
Mon, 7 Jul 2025 14:40:17 +0000 (23:40 +0900)
committerMax Filippov <jcmvbkbc@gmail.com>
Tue, 8 Jul 2025 17:28:48 +0000 (10:28 -0700)
commit57da36bed1004d2b78057568176b76cb0a50d149
treef46adc04bc942cdff32caf2849c22280447c0afd
parent1f3bf202355f16d6ec0a9b37cb6a71be5f76b77f
xtensa: Fix B[GE/LT]UI instructions with immediate values of 32768 or 65536 not being emitted

This is because in canonicalize_comparison() in gcc/expmed.cc, the COMPARE
rtx_cost() for the immediate values in the title does not change between
the old and new versions.  This patch fixes that.

(note: Currently, this patch only works if some constant propagation
optimizations are enabled (-O2 or higher) or if bare large constant
assignments are possible (-mconst16 or -mauto-litpools).  In the future
I hope to make it work at -O1...)

gcc/ChangeLog:

* config/xtensa/xtensa.cc (xtensa_b4const_or_zero):
Remove.
(xtensa_b4const): Add a case where the value is 0, and rename
to xtensa_b4const_or_zero.
(xtensa_rtx_costs): Fix to also consider the result of
xtensa_b4constu().

gcc/testsuite/ChangeLog:

* gcc.target/xtensa/BGEUI-BLTUI-32k-64k.c: New.
gcc/config/xtensa/xtensa.cc
gcc/testsuite/gcc.target/xtensa/BGEUI-BLTUI-32k-64k.c [new file with mode: 0644]