From patchwork Sat Sep 28 19:36:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Iain Sandoe X-Patchwork-Id: 1168920 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-509780-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=sandoe.co.uk Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="OaDhSWGl"; 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 46gf7D6SNsz9sN1 for ; Sun, 29 Sep 2019 05:36:54 +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 :content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; q=dns; s= default; b=JfBQXe3nFWFb2uY85ZQGAquIq3S6jKQBpoyC0vKueuiCBWIXQP6GW Q9WBLrzpXG24kbl+3+4uZ1FX+FTv9BUvqI7h1iIm3CCFLBeKqiPgGiEjqTTj1mAr DG7uTTHy8ZcrDHzkbKks0AWN/B7D1oDjejSXAD0b8vVx5CIbBACdtY= 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 :content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; s=default; bh=Ane9aDTFF7C+O0rvnzptxkwzOcQ=; b=OaDhSWGlUY4ib183rE9UTCN3Ex+R uMth2nzNXtmJl0/kV9tXrqlG1qFNTTMzfyorRWYAgrzdDfOw42iIh0hdWpaQZS3j rvz3+OlzbqumyzHl5P2o654MR7JDbx0WWnS68gncQFmQfWWrg8WKP9xkhDKwm+Uq Af+ppLZsrP7Ju/c= Received: (qmail 125715 invoked by alias); 28 Sep 2019 19:36:45 -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 125697 invoked by uid 89); 28 Sep 2019 19:36:45 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_COUK, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=machine_mode, sk:ATTRIBU, sk:attribu, HX-Spam-Relays-External:ESMTPA X-HELO: smtp1.wavenetuk.net Received: from smtp.wavenetuk.net (HELO smtp1.wavenetuk.net) (195.26.36.10) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 28 Sep 2019 19:36:42 +0000 Received: from [192.168.1.212] (host81-138-1-83.in-addr.btopenworld.com [81.138.1.83]) by smtp1.wavenetuk.net (Postfix) with ESMTPA id EAC7F12002E8; Sat, 28 Sep 2019 20:36:39 +0100 (BST) Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: [Darwin, PPC, Mode Iterators 4/n, committed] Update macho_high. From: Iain Sandoe In-Reply-To: Date: Sat, 28 Sep 2019 20:36:32 +0100 Cc: Segher Boessenkool Message-Id: <76FB35DD-3258-46A5-8017-E56D3096C2FA@sandoe.co.uk> References: <20190924232333.GP9749@gate.crashing.org> To: GCC Patches (since Segher asked, ā€™nā€™ is approximately 8 - some of the patterns will be harder to convert) Drop the expander for macho_high and use a mode iterator on the define_insn for @macho_high_ instead. as usual, tested on powerpc-darwin9 and powerpc64-linux-gnu applied to mainline thanks Iain gcc/ChangeLog: 2019-09-28 Iain Sandoe * config/darwin.c (gen_macho_high): Amend to include the mode argument. (machopic_indirect_data_reference): Amend gen_macho_high call to include mode argument. (machopic_legitimize_pic_address): Likewise. * config/rs6000/rs6000.c (rs6000_legitimize_address): * config/rs6000/darwin.md (@macho_high_): New, replaces the macho_high expander and two define_insn entries. diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c index 3e4bbffc92..1f72c07ab7 100644 --- a/gcc/config/darwin.c +++ b/gcc/config/darwin.c @@ -47,6 +47,7 @@ along with GCC; see the file COPYING3. If not see #include "toplev.h" #include "lto-section-names.h" #include "intl.h" +#include "optabs.h" /* Darwin supports a feature called fix-and-continue, which is used for rapid turn around debugging. When code is compiled with the @@ -108,7 +109,7 @@ section * darwin_sections[NUM_DARWIN_SECTIONS]; /* While we transition to using in-tests instead of ifdef'd code. */ #if !HAVE_lo_sum -#define gen_macho_high(a,b) (a) +#define gen_macho_high(m,a,b) (a) #define gen_macho_low(a,b,c) (a) #endif @@ -654,7 +655,7 @@ machopic_indirect_data_reference (rtx orig, rtx reg) { /* Create a new register for CSE opportunities. */ rtx hi_reg = (!can_create_pseudo_p () ? reg : gen_reg_rtx (Pmode)); - emit_insn (gen_macho_high (hi_reg, orig)); + emit_insn (gen_macho_high (Pmode, hi_reg, orig)); emit_insn (gen_macho_low (reg, hi_reg, orig)); return reg; } @@ -858,7 +859,7 @@ machopic_legitimize_pic_address (rtx orig, machine_mode mode, rtx reg) rtx asym = XEXP (orig, 0); rtx mem; - emit_insn (gen_macho_high (temp_reg, asym)); + emit_insn (gen_macho_high (Pmode, temp_reg, asym)); mem = gen_const_mem (GET_MODE (orig), gen_rtx_LO_SUM (Pmode, temp_reg, copy_rtx (asym))); diff --git a/gcc/config/rs6000/darwin.md b/gcc/config/rs6000/darwin.md index b2a52d81b3..0c63a31755 100644 --- a/gcc/config/rs6000/darwin.md +++ b/gcc/config/rs6000/darwin.md @@ -150,31 +150,12 @@ You should have received a copy of the GNU General Public License stfd %0,lo16(%2)(%1)" [(set_attr "type" "store")]) -;; Mach-O PIC trickery. -(define_expand "macho_high" - [(set (match_operand 0 "") - (high (match_operand 1 "")))] - "TARGET_MACHO" -{ - if (TARGET_64BIT) - emit_insn (gen_macho_high_di (operands[0], operands[1])); - else - emit_insn (gen_macho_high_si (operands[0], operands[1])); +;; Mach-O PIC. - DONE; -}) - -(define_insn "macho_high_si" - [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r") - (high:SI (match_operand 1 "" "")))] - "TARGET_MACHO && ! TARGET_64BIT" - "lis %0,ha16(%1)") - - -(define_insn "macho_high_di" - [(set (match_operand:DI 0 "gpc_reg_operand" "=b*r") - (high:DI (match_operand 1 "" "")))] - "TARGET_MACHO && TARGET_64BIT" +(define_insn "@macho_high_" + [(set (match_operand:P 0 "gpc_reg_operand" "=b*r") + (high:P (match_operand 1 "" "")))] + "TARGET_MACHO && (DEFAULT_ABI == ABI_DARWIN)" "lis %0,ha16(%1)") (define_expand "macho_low" diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 81aec9c54a..f136dcbf8c 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -7978,7 +7978,7 @@ rs6000_legitimize_address (rtx x, rtx oldx ATTRIBUTE_UNUSED, if (TARGET_ELF) emit_insn (gen_elf_high (reg, x)); else - emit_insn (gen_macho_high (reg, x)); + emit_insn (gen_macho_high (Pmode, reg, x)); return gen_rtx_LO_SUM (Pmode, reg, x); } else if (TARGET_TOC @@ -9691,7 +9691,7 @@ rs6000_emit_move (rtx dest, rtx source, machine_mode mode) return; } #endif - emit_insn (gen_macho_high (target, operands[1])); + emit_insn (gen_macho_high (Pmode, target, operands[1])); emit_insn (gen_macho_low (operands[0], target, operands[1])); return; }