Skip to content

Commit 2833676

Browse files
committed
arm: Fix PCS for SFmode -> SImode libcalls [PR99748]
This patch fixes PR99748 which shows us trying to pass the argument to __aeabi_f2iz in the VFP register s0 when the library function is expecting to use the GPR r0. It also fixes the __aeabi_f2uiz case which was broken in the same way. For the testcase in the PR, here is the code we generate before the patch (with -mfloat-abi=hard -march=armv8.1-m.main+mve -O0): main: push {r7, lr} sub sp, sp, gcc-mirror#8 add r7, sp, #0 mov r3, #1065353216 str r3, [r7, gcc-mirror#4] @ float vldr.32 s0, [r7, gcc-mirror#4] bl __aeabi_f2iz mov r3, r0 cmp r3, #1 [...] This becomes: main: push {r7, lr} sub sp, sp, gcc-mirror#8 add r7, sp, #0 mov r3, #1065353216 str r3, [r7, gcc-mirror#4] @ float ldr r0, [r7, gcc-mirror#4] @ float bl __aeabi_f2iz mov r3, r0 cmp r3, #1 [...] after the patch. We see a similar change for the same testcase with a cast to unsigned instead of int. gcc/ChangeLog: PR target/99748 * config/arm/arm.c (arm_libcall_uses_aapcs_base): Also use base PCS for [su]fix_optab. (cherry picked from commit 16ea7f5)
1 parent 690aa21 commit 2833676

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

gcc/config/arm/arm.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5786,6 +5786,10 @@ arm_libcall_uses_aapcs_base (const_rtx libcall)
57865786
convert_optab_libfunc (sfix_optab, DImode, SFmode));
57875787
add_libcall (libcall_htab,
57885788
convert_optab_libfunc (ufix_optab, DImode, SFmode));
5789+
add_libcall (libcall_htab,
5790+
convert_optab_libfunc (sfix_optab, SImode, SFmode));
5791+
add_libcall (libcall_htab,
5792+
convert_optab_libfunc (ufix_optab, SImode, SFmode));
57895793

57905794
/* Values from double-precision helper functions are returned in core
57915795
registers if the selected core only supports single-precision

0 commit comments

Comments
 (0)