Skip to content

Commit

Permalink
RISC-V: fix TARGET_PROMOTE_FUNCTION_MODE hook for libcalls
Browse files Browse the repository at this point in the history
riscv_promote_function_mode doesn't promote a SI to DI for libcalls
case.

The fix is what generic promote_mode () in explow.cc does. I really
don't understand why the old code didn't work, but stepping thru the
debugger shows old code didn't and fixed does.

This showed up when testing Ajit's REE ABI extension series which probes
the ABI (using a NULL tree type) and ends up hitting the libcall code path.

[Usual caveat, I'll wait for Pre-commit CI to run the tests and report]

gcc/ChangeLog:
	* config/riscv/riscv.cc (riscv_promote_function_mode): Fix mode
	  returned for libcall case.

Signed-off-by: Vineet Gupta <vineetg@rivosinc.com>
  • Loading branch information
Vineet Gupta authored and ouuleilei-bot committed Oct 31, 2023
1 parent c2d62cd commit 5ad0973
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions gcc/config/riscv/riscv.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6912,9 +6912,10 @@ riscv_promote_function_mode (const_tree type ATTRIBUTE_UNUSED,
return promote_mode (type, mode, punsignedp);

unsignedp = *punsignedp;
PROMOTE_MODE (as_a <scalar_mode> (mode), unsignedp, type);
scalar_mode smode = as_a <scalar_mode> (mode);
PROMOTE_MODE (smode, unsignedp, type);
*punsignedp = unsignedp;
return mode;
return smode;
}

/* Implement TARGET_MACHINE_DEPENDENT_REORG. */
Expand Down

0 comments on commit 5ad0973

Please sign in to comment.