public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r10-9755] arm: Fix PCS for SFmode -> SImode libcalls [PR99748]
@ 2021-04-23 11:40 Alex Coplan
  0 siblings, 0 replies; only message in thread
From: Alex Coplan @ 2021-04-23 11:40 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:283367662c25057fd7c9c98257cca858f85b75fc

commit r10-9755-g283367662c25057fd7c9c98257cca858f85b75fc
Author: Alex Coplan <alex.coplan@arm.com>
Date:   Tue Apr 6 09:06:27 2021 +0100

    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, #8
        add     r7, sp, #0
        mov     r3, #1065353216
        str     r3, [r7, #4]    @ float
        vldr.32 s0, [r7, #4]
        bl      __aeabi_f2iz
        mov     r3, r0
        cmp     r3, #1
        [...]
    
    This becomes:
    
    main:
        push    {r7, lr}
        sub     sp, sp, #8
        add     r7, sp, #0
        mov     r3, #1065353216
        str     r3, [r7, #4]    @ float
        ldr     r0, [r7, #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 16ea7f57891d3fe885ee55b2917208695e184714)

Diff:
---
 gcc/config/arm/arm.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index db37e2b8e71..132ecc5d7e3 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -5786,6 +5786,10 @@ arm_libcall_uses_aapcs_base (const_rtx libcall)
 		   convert_optab_libfunc (sfix_optab, DImode, SFmode));
       add_libcall (libcall_htab,
 		   convert_optab_libfunc (ufix_optab, DImode, SFmode));
+      add_libcall (libcall_htab,
+		   convert_optab_libfunc (sfix_optab, SImode, SFmode));
+      add_libcall (libcall_htab,
+		   convert_optab_libfunc (ufix_optab, SImode, SFmode));
 
       /* Values from double-precision helper functions are returned in core
 	 registers if the selected core only supports single-precision


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-04-23 11:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-23 11:40 [gcc r10-9755] arm: Fix PCS for SFmode -> SImode libcalls [PR99748] Alex Coplan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).