From patchwork Tue Nov 3 18:18:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 1393284 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=swNrQ/fW; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CQdMw16mQz9s0b for ; Wed, 4 Nov 2020 05:19:06 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E28DD386102D; Tue, 3 Nov 2020 18:19:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E28DD386102D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1604427543; bh=UgXLWY7HuJx5+cRZz9E25VJTQVyQefF4PKTdygWtIkE=; h=Date:Subject:To:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=swNrQ/fWuS8F1HlpZBeU1ju1vMlIckC9noD49wIoOKAdcS3kvrndKSbmhjfyzi1ua zZ/+MyfThWsupaRvrsjGRlB0VXM12OlAyTtBxNtir6LLcOcNSYALFpKtpuyXSS+Ffk 7OcZw9r9gJzBc82e5lylMmkAw5akrdUWVEBI6OkM= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-qv1-xf2f.google.com (mail-qv1-xf2f.google.com [IPv6:2607:f8b0:4864:20::f2f]) by sourceware.org (Postfix) with ESMTPS id 6A2CC3858001 for ; Tue, 3 Nov 2020 18:19:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 6A2CC3858001 Received: by mail-qv1-xf2f.google.com with SMTP id d1so7650296qvl.6 for ; Tue, 03 Nov 2020 10:19:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=UgXLWY7HuJx5+cRZz9E25VJTQVyQefF4PKTdygWtIkE=; b=BZiwAnrxsTlrVG0NLyjdZCtoNegGTBIHxlSssWX0308JZFUvrUsAuT1M+jLEvbx4rs Xd4qAVAxJErYl+hG0Wm75JIkw/2sHKxMtdsEItuQCga4wJ0WQPyHH8oInMUYgrSQT6IK RdfuOJjk0NjV+SL7OtyHfGDAy2TyOW9NKQBMuJvZwWmv9B8V5JTAlk5X29LbSvKi7/1x DxiV30LNQlHFjx+dPR1bmBIip6Jwa94f9ZqlA8aLxPC5D5hw6PsnsAUpVE86ZdTkCcJu sKwu43JUVDjbaF+6icSwwAD9gL1ly2La0y4XyBIV6PWLhuy7EDKoANFn9hBgVPIl4jaM kUrA== X-Gm-Message-State: AOAM532oTC8sozR4T1FPpRN1ht3kablcxXk0KW29PnNe8H39XncGulxj AFM6rX3c7fFfh1XICBXHgLkpdIl98QJyYu3PXk2Sm5ppSoiM2A== X-Google-Smtp-Source: ABdhPJycpvH1NLLA4xp7A/HnPoFLBVhwlYrUQb0bhVTCV5h1pJsFtEWEK9Vn4/u16tL04Pa6+7wkE3Tek2Q8sDu0Cbg= X-Received: by 2002:ad4:4142:: with SMTP id z2mr28855039qvp.20.1604427540803; Tue, 03 Nov 2020 10:19:00 -0800 (PST) MIME-Version: 1.0 Date: Tue, 3 Nov 2020 19:18:49 +0100 Message-ID: Subject: [PATCH] i386: Fix ix86_function_arg_regno_p to return correct SSE regno for 32bit TARGET_MACHO To: "gcc-patches@gcc.gnu.org" X-Spam-Status: No, score=-9.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Uros Bizjak via Gcc-patches From: Uros Bizjak Reply-To: Uros Bizjak Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" 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 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. 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) /* Specify the machine mode that this machine uses for the index in the tablejump instruction. */