From patchwork Fri Sep 20 09:45:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 1165129 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-509346-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="vhfMYNzF"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46ZTPM0gdFz9sCJ for ; Fri, 20 Sep 2019 19:46:12 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=dAGNgOt6OXIzseIP NWe2PYJY+R5kK36Y9zfroYiJ1qsE5NXkl0PvjktYewtZVYqB148AfP6MgNneaf4R of7f+i7YSE4t93Xlr2TY6QzvzgWUURfDy8uK+kH14n4Mz1Le8yO0v8UeXZ9dNYpR i2gz++g8h3GcO+a3tVFWUZeRXiE= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=K2x67PKkn7yjjjEr459Anf fvz8s=; b=vhfMYNzFVphG2xoDrcvjV5+DABR3y0BhWA5xzZkmDSATuU24LgXhYz V3Hl1YxK49T/3FHo05ENm4NHGck2ui7bkWB9fL3UZ+YOftAZw0jDUErM2gA3NSQx 2NAcAhnsUfMhWgDsIXyFViA6bxi+BxwvXVHETYEKoTvIroY8odIJw= Received: (qmail 77696 invoked by alias); 20 Sep 2019 09:46:02 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 77671 invoked by uid 89); 20 Sep 2019 09:46:00 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.4 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=contrary, weakness, trofimovich, regno X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 20 Sep 2019 09:45:59 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id CD44281398 for ; Fri, 20 Sep 2019 11:45:53 +0200 (CEST) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mYhVjgHYXhpl for ; Fri, 20 Sep 2019 11:45:53 +0200 (CEST) Received: from polaris.localnet (unknown [IPv6:2a01:e35:8a16:3850:1a03:73ff:fe45:373a]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id A635B81393 for ; Fri, 20 Sep 2019 11:45:53 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [SPARC] Fix PR target/91269 Date: Fri, 20 Sep 2019 11:45:52 +0200 Message-ID: <2489709.bk7ymy2vyL@polaris> MIME-Version: 1.0 This is a regression present on the mainline and 9 branch: the compiler (LRA) generates an instruction using unaligned double FP registers. This has been a known weakness since the switch to LRA because there is no longer an explicit constraint for aligned double FP registers. Bootstrapped/regtested on SPARC/Solaris and SPARC64/Linux, applied on the mainline and 9 branch. 2019-09-20 Eric Botcazou PR target/91269 * config/sparc/sparc.h (HARD_REGNO_CALLER_SAVE_MODE): Define. 2019-09-20 Eric Botcazou * gcc.dg/pr91269.c: New test. Index: config/sparc/sparc.h =================================================================== --- config/sparc/sparc.h (revision 275746) +++ config/sparc/sparc.h (working copy) @@ -711,6 +711,13 @@ along with GCC; see the file COPYING3. register window instruction in the prologue. */ #define HARD_REGNO_RENAME_OK(FROM, TO) ((FROM) != 1) +/* Select a register mode required for caller save of hard regno REGNO. + Contrary to what is documented, the default is not the smallest suitable + mode but the largest suitable mode for the given (REGNO, NREGS) pair and + it quickly creates paradoxical subregs that can be problematic. */ +#define HARD_REGNO_CALLER_SAVE_MODE(REGNO, NREGS, MODE) \ + ((MODE) == VOIDmode ? choose_hard_reg_mode (REGNO, NREGS, false) : (MODE)) + /* Specify the registers used for certain standard purposes. The values of these macros are register numbers. */