aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorVineet Gupta <vineetg@rivosinc.com>2023-11-01 14:46:33 -0700
committerVineet Gupta <vineetg@rivosinc.com>2023-11-01 14:49:34 -0700
commit7560f2b4e387ef43ef45ee9fb06efbad6ca0fedf (patch)
treef6af445dcab2ba3b556885e96c12d9107445029c /gcc
parentd880e093d92084f55b10626610ef059fd9194a6a (diff)
downloadgcc-7560f2b4e387ef43ef45ee9fb06efbad6ca0fedf.zip
gcc-7560f2b4e387ef43ef45ee9fb06efbad6ca0fedf.tar.gz
gcc-7560f2b4e387ef43ef45ee9fb06efbad6ca0fedf.tar.bz2
RISC-V: fix TARGET_PROMOTE_FUNCTION_MODE hook for libcalls
Fixes: 3496ca4e6566 ("RISC-V: Add runtime invariant support") riscv_promote_function_mode doesn't promote a SI to DI for libcalls case. It intends to do that however the code is broken (regression). 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. gcc/ChangeLog: * config/riscv/riscv.cc (riscv_promote_function_mode): Fix mode returned for libcall case. Tested-by: Patrick O'Neill <patrick@rivosinc.com> # pre-commit-CI #526 Signed-off-by: Vineet Gupta <vineetg@rivosinc.com>
Diffstat (limited to 'gcc')
-rw-r--r--gcc/config/riscv/riscv.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
index 0148a4f..895a098 100644
--- a/gcc/config/riscv/riscv.cc
+++ b/gcc/config/riscv/riscv.cc
@@ -8630,9 +8630,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. */