From: Uros Bizjak <ubizjak@gmail.com>
To: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: [PATCH] i386: Fix ix86_function_arg_regno_p to return correct SSE regno for 32bit TARGET_MACHO
Date: Tue, 3 Nov 2020 19:18:49 +0100 [thread overview]
Message-ID: <CAFULd4ZaHyCE4X4_fVFdg+XtJSA8VrnSaiKJOPxuuj6yvQXE_A@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 603 bytes --]
Use up to SSE_REGPARM_MAX registers to pass function parameters
for 32bit Mach-O targets. Also, define X86_32_MMX_REGPARM_MAX
to return 0 for 32bit Mach-O targets.
2020-11-03 Uroš Bizjak <ubizjak@gmail.com>
gcc/
* config/i386/i386.c (ix86_function_arg_regno_p): Use up to
SSE_REGPARM_MAX registers to pass function parameters
for 32bit Mach-O targets.
* config/i386/i386.h (X86_32_MMX_REGPARM_MAX): New macro.
(MMX_REGPARM_MAX): Use it.
Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.
Pushed to the mainline under the obvious rule.
Uros.
[-- Attachment #2: p.diff.txt --]
[-- Type: text/plain, Size: 1781 bytes --]
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index caa9b9d5ac1..992e9a20254 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -1423,23 +1423,15 @@ ix86_function_arg_regno_p (int regno)
enum calling_abi call_abi;
const int *parm_regs;
- if (!TARGET_64BIT)
- {
- if (TARGET_MACHO)
- return (regno < REGPARM_MAX
- || (TARGET_SSE && SSE_REGNO_P (regno) && !fixed_regs[regno]));
- else
- return (regno < REGPARM_MAX
- || (TARGET_MMX && MMX_REGNO_P (regno)
- && (regno < FIRST_MMX_REG + MMX_REGPARM_MAX))
- || (TARGET_SSE && SSE_REGNO_P (regno)
- && (regno < FIRST_SSE_REG + SSE_REGPARM_MAX)));
- }
-
if (TARGET_SSE && SSE_REGNO_P (regno)
- && (regno < FIRST_SSE_REG + SSE_REGPARM_MAX))
+ && regno < FIRST_SSE_REG + SSE_REGPARM_MAX)
return true;
+ if (!TARGET_64BIT)
+ return (regno < REGPARM_MAX
+ || (TARGET_MMX && MMX_REGNO_P (regno)
+ && regno < FIRST_MMX_REG + MMX_REGPARM_MAX));
+
/* TODO: The function should depend on current function ABI but
builtins.c would need updating then. Therefore we use the
default ABI. */
diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index 760c60fb54f..d0c157a9970 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -1950,7 +1950,9 @@ typedef struct ix86_args {
: X86_64_SSE_REGPARM_MAX) \
: X86_32_SSE_REGPARM_MAX)
-#define MMX_REGPARM_MAX (TARGET_64BIT ? 0 : (TARGET_MMX ? 3 : 0))
+#define X86_32_MMX_REGPARM_MAX (TARGET_MMX ? (TARGET_MACHO ? 0 : 3) : 0)
+
+#define MMX_REGPARM_MAX (TARGET_64BIT ? 0 : X86_32_MMX_REGPARM_MAX)
\f
/* Specify the machine mode that this machine uses
for the index in the tablejump instruction. */
reply other threads:[~2020-11-03 18:19 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAFULd4ZaHyCE4X4_fVFdg+XtJSA8VrnSaiKJOPxuuj6yvQXE_A@mail.gmail.com \
--to=ubizjak@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).