On 2/27/2026 4:42 PM, H.J. Lu wrote:
On Sat, Feb 28, 2026 at 7:32 AM Jeffrey Law
<[email protected]> wrote:


On 2/25/2026 5:52 PM, H.J. Lu wrote:

On Thu, Feb 26, 2026 at 8:39 AM H.J. Lu <[email protected]> wrote:

TARGET_PROMOTE_PROTOTYPES is an optimization, not an ABI requirement.
TARGET_PROMOTE_FUNCTION_MODE should be used for ABI requirement.  Like
xtensa, mcore ABI requires sign extension of signed 8/16-bit integer
arguments to 32 bits and zero extension of unsigned integer 8/16-bit
arguments to 32 bits:

1. Rename xtensa_promote_function_mode to
default_promote_function_mode_sign_extend to sign-extend signed 8/16-bit
integer arguments to 32 bits and zero-extend of unsigned 8/16-bit
integer arguments to 32 bits.
2. Replace xtensa_promote_function_mode with
default_promote_function_mode_sign_extend.
3. Remove TARGET_PROMOTE_PROTOTYPES for mcore and define
TARGET_PROMOTE_FUNCTION_MODE with
default_promote_function_mode_sign_extend to properly extend 8/16-bit
arguments to 32 bits.

Targets with the same ABI requirement should define
TARGET_PROMOTE_FUNCTION_MODE with
default_promote_function_mode_sign_extend.

gcc/

PR target/119979
PR target/120888
* targhooks.cc (default_promote_function_mode_sign_extend): New.
* targhooks.h (default_promote_function_mode_sign_extend):
Likewise.
* config/mcore/mcore.cc (TARGET_PROMOTE_FUNCTION_MODE): Use
default_promote_function_mode_sign_extend.
(TARGET_PROMOTE_PROTOTYPES): Removed.
* config/xtensa/xtensa.cc (xtensa_promote_function_mode): Removed.
(TARGET_PROMOTE_FUNCTION_MODE): Use
default_promote_function_mode_sign_extend.

gcc/testsuite/

PR target/119979
PR target/120888
* gcc.target/xtensa/pr120888-1.c: Removed to ...
* gcc.dg/zero-extend.c: This.  Enable for mcore and xtensa.
* gcc.target/xtensa/pr120888-2.c: Removed to ...
* gcc.dg/sign-extend.c: This.  Enable for mcore and xtensa.


--
H.J.

Add the missing patch.

Note you broke mcore-elf in new and interesting ways.

Tests that now fail, but worked before (2 tests):

mcore-sim: gcc: gcc.dg/tree-ssa/pr84436-5.c execution test
mcore-sim: gcc: gcc.dg/tree-ssa/pr84436-5.c execution test
How does it fail?

Dunno other than it was clearly your patch.   If I had more information, I'd pass it along.



And you broke iq2000-elf: Tests that now fail, but worked before (99 tests):

iq2000-sim: gcc: c-c++-common/pr111309-1.c  -Wc++-compat  execution test
[ ... ]
This patch doesn't change iq2000.
Well, it worked before your change and not afterwards, so even though it's not directly changing iq2000, it did change something indirectly it seems.

Jeff

Reply via email to