From patchwork Fri Jun 29 18:43:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Law X-Patchwork-Id: 937103 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-480785-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="chFNWf+r"; 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 41HQXD0GNYz9ry1 for ; Sat, 30 Jun 2018 04:43:38 +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 :subject:to:message-id:date:mime-version:content-type; q=dns; s= default; b=ntVziflyClm08J+USPOX8AqEuYXF0q1yEIgfL8esyPhU6zHMlem/Z NbsAIcAo/frIR5q7GaiY+9EUUi8a6ixZKojUadDKM1kgLRO+mZkKJM/NWfNrIWjj UN9sGqDuBQ6WInO9cdFpJPzOoGIBYYHd/RAmR1df4JfClr66xiJL7s= 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 :subject:to:message-id:date:mime-version:content-type; s= default; bh=qM0J9YP5mtYbwD1fQmOICAdyCZg=; b=chFNWf+r+MW/C43NRsA8 AGRW4LPBzOpJGNh35nv5ytGsumOTPc40dBB4JLIaFYLVT40+foP7enNwgqlKWRsA oTr8Gpw+u3Eha2mszeVBDOYJ+t5UVy0qWlYJBPWjtTpNHBh9QRpfsi1fcs+0lcIm GI8EW29bbudvXj1//BR29H8= Received: (qmail 120905 invoked by alias); 29 Jun 2018 18:43:30 -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 120896 invoked by uid 89); 29 Jun 2018 18:43:30 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, KAM_LAZY_DOMAIN_SECURITY, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=standpoint X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 29 Jun 2018 18:43:28 +0000 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 62142D3C17 for ; Fri, 29 Jun 2018 18:43:27 +0000 (UTC) Received: from localhost.localdomain (ovpn-112-5.rdu2.redhat.com [10.10.112.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id A5EA12016A82 for ; Fri, 29 Jun 2018 18:43:26 +0000 (UTC) From: Jeff Law Subject: [committed] Convert v850 to LRA Openpgp: preference=signencrypt To: gcc-patches Message-ID: <566f837a-231d-8dd8-33b3-66454152d3ef@redhat.com> Date: Fri, 29 Jun 2018 12:43:25 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 X-IsSubscribed: yes So this patch converts the v850 port to use LRA. From a code generation standpoint it looks like the old bare v850 gets slightly worse code. However, we get slightly better code in general on the newer parts like v850e3v5. The only really interesting part of the conversion is the removal of several patterns that never should have existed in the first place. A later variant of the v850 introduced loads/stores with larger displacement values then the original v850 supported. Those loads/stores were implemented with distinct patterns that only matched those large displacement loads/stores. The better solution is to fix GO_IF_LEGITIMATE_ADDRESS to allow the larger displacements. Once that's done the existing movxx patterns as well as the zero/sign extending loads can use the bigger displacements as-is. That also avoids a bit of a wart in the LRA implementation related to re-recognizing insns during register elimination. I'm actually rather surprised reload didn't complain as well as we've long required a single movXX pattern to implement all the loads/stores for a particular mode for similar reasons. From a testing standpoint we get 100% identical results with LRA as we were getting without LRA. Installed on the trunk. Jeff diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a0da66e6932..c486d6d2172 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2018-06-29 Jeff Law + + * config/v850/v850.c (v850_legitimate_address_p): Handle large + displacements for TARGET_V850E2V3 and newer. + (TARGET_LRA_P): Remove. Defaults to LRA now. + * config/v850/v850.md (sign23byte_load): Remove. + (unsign23byte_load, sign23hword_load, unsign23hword_load): Likewise. + (23word_load, 23byte_store, 23hword_store, 23word_store): Likewise. + 2018-06-29 Martin Liska PR lto/85759 diff --git a/gcc/config/v850/v850.c b/gcc/config/v850/v850.c index cb2debf46f1..8936c732307 100644 --- a/gcc/config/v850/v850.c +++ b/gcc/config/v850/v850.c @@ -3079,7 +3079,10 @@ v850_legitimate_address_p (machine_mode mode, rtx x, bool strict_p, return true; if (GET_CODE (x) == PLUS && v850_rtx_ok_for_base_p (XEXP (x, 0), strict_p) - && constraint_satisfied_p (XEXP (x,1), CONSTRAINT_K) + && (constraint_satisfied_p (XEXP (x, 1), CONSTRAINT_K) + || (TARGET_V850E2V3_UP + && (mode == SImode || mode == HImode || mode == QImode) + && constraint_satisfied_p (XEXP (x, 1), CONSTRAINT_W))) && ((mode == QImode || INTVAL (XEXP (x, 1)) % 2 == 0) && CONST_OK_FOR_K (INTVAL (XEXP (x, 1)) + (GET_MODE_NUNITS (mode) * UNITS_PER_WORD)))) @@ -3309,9 +3312,6 @@ v850_modes_tieable_p (machine_mode mode1, machine_mode mode2) #undef TARGET_LEGITIMATE_CONSTANT_P #define TARGET_LEGITIMATE_CONSTANT_P v850_legitimate_constant_p -#undef TARGET_LRA_P -#define TARGET_LRA_P hook_bool_void_false - #undef TARGET_ADDR_SPACE_LEGITIMATE_ADDRESS_P #define TARGET_ADDR_SPACE_LEGITIMATE_ADDRESS_P v850_legitimate_address_p diff --git a/gcc/config/v850/v850.md b/gcc/config/v850/v850.md index b8f098b9363..6530778c8f6 100644 --- a/gcc/config/v850/v850.md +++ b/gcc/config/v850/v850.md @@ -138,74 +138,6 @@ ;; ---------------------------------------------------------------------- ;; MOVE INSTRUCTIONS ;; ---------------------------------------------------------------------- -(define_insn "sign23byte_load" - [(set (match_operand:SI 0 "register_operand" "=r") - (sign_extend:SI - (mem:QI (plus:SI (match_operand:SI 1 "register_operand" "r") - (match_operand 2 "disp23_operand" "W")))))] - "TARGET_V850E2V3_UP" - "ld.b %2[%1],%0" - [(set_attr "length" "4")]) - -(define_insn "unsign23byte_load" - [(set (match_operand:SI 0 "register_operand" "=r") - (zero_extend:SI - (mem:QI (plus:SI (match_operand:SI 1 "register_operand" "r") - (match_operand 2 "disp23_operand" "W")))))] - "TARGET_V850E2V3_UP" - "ld.bu %2[%1],%0" - [(set_attr "length" "4")]) - -(define_insn "sign23hword_load" - [(set (match_operand:SI 0 "register_operand" "=r") - (sign_extend:SI - (mem:HI (plus:SI (match_operand:SI 1 "register_operand" "r") - (match_operand 2 "disp23_operand" "W")))))] - "TARGET_V850E2V3_UP" - "ld.h %2[%1],%0" - [(set_attr "length" "4")]) - -(define_insn "unsign23hword_load" - [(set (match_operand:SI 0 "register_operand" "=r") - (zero_extend:SI - (mem:HI (plus:SI (match_operand:SI 1 "register_operand" "r") - (match_operand 2 "disp23_operand" "W")))))] - "TARGET_V850E2V3_UP" - "ld.hu %2[%1],%0" - [(set_attr "length" "4")]) - -(define_insn "23word_load" - [(set (match_operand:SI 0 "register_operand" "=r") - (mem:SI (plus:SI (match_operand:SI 1 "register_operand" "r") - (match_operand 2 "disp23_operand" "W"))))] - "TARGET_V850E2V3_UP" - "ld.w %2[%1],%0" - [(set_attr "length" "4")]) - -(define_insn "23byte_store" - [(set (mem:QI (plus:SI (match_operand:SI 0 "register_operand" "r") - (match_operand 1 "disp23_operand" "W"))) - (match_operand:QI 2 "register_operand" "r"))] - "TARGET_V850E2V3_UP" - "st.b %2,%1[%0]" - [(set_attr "length" "4")]) - -(define_insn "23hword_store" - [(set (mem:HI (plus:SI (match_operand:SI 0 "register_operand" "r") - (match_operand 1 "disp23_operand" "W"))) - (match_operand:HI 2 "register_operand" "r"))] - "TARGET_V850E2V3_UP" - "st.h %2,%1[%0]" - [(set_attr "length" "4")]) - -(define_insn "23word_store" - [(set (mem:SI (plus:SI (match_operand:SI 0 "register_operand" "r") - (match_operand 1 "disp23_operand" "W"))) - (match_operand:SI 2 "register_operand" "r"))] - "TARGET_V850E2V3_UP" - "st.w %2,%1[%0]" - [(set_attr "length" "4")]) - ;; movdi (define_expand "movdi"