From patchwork Fri Sep 27 19:29:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iain Sandoe X-Patchwork-Id: 1168695 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-509730-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="cwuWejWf"; 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 46g21P6vmpz9sDB for ; Sat, 28 Sep 2019 05:29:43 +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=fIobFXKkckE6EOWpCaMkOIE5x60nFX/AfTdyrXZk7MBr2AYm6L/sG tetxwJFuCT/hy24gXfMd3khEG1dgWtTDCJYbDbRopuoMC79H/+BnnRwcO6oWqIpE WAkY/SB7M9EKUrk2AxW6MH+CXv4M8VnKTDoioQfEnyrt60S9OskyYI= 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=pGlO27eHpk8nm5/uDWGZpRC/oG4=; b=cwuWejWfPViuE1/R6rdL14zXNh/s nEw7Con/eid744V87NglmpSVr+rFVBZKIKdGABiSRNYoK3kTLnc9vu/+ATHmN1h8 KSTRRFIxEqY34yYvCW1Gao56NbGjm5ZjnIsvff0vef9CVU8/46VnsWA+dzy7J+cv bVSeaWMRnkrRx1E= Received: (qmail 108827 invoked by alias); 27 Sep 2019 19:29:36 -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 108818 invoked by uid 89); 27 Sep 2019 19:29:36 -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=PIC, HX-Spam-Relays-External:ESMTPA X-HELO: smtp2.wavenetuk.net Received: from smtp.wavenetuk.net (HELO smtp2.wavenetuk.net) (195.26.37.10) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 27 Sep 2019 19:29:34 +0000 Received: from [192.168.1.212] (host81-138-1-83.in-addr.btopenworld.com [81.138.1.83]) by smtp2.wavenetuk.net (Postfix) with ESMTPA id 34851600279; Fri, 27 Sep 2019 20:29:31 +0100 (BST) Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: [Darwin, PPC, Mode Iterators 3/n, committed] Update macho_correct_pic. From: Iain Sandoe In-Reply-To: Date: Fri, 27 Sep 2019 20:29:28 +0100 Cc: Segher Boessenkool Message-Id: References: <20190924232333.GP9749@gate.crashing.org> To: GCC Patches Drop the expander and use a mode expander on the define_insn for macho_correct_pic instead. Update callers. tested on powerpc-darwin9, powerpc64-linux-gnu applied to mainline, thanks Iain gcc/ChangeLog: 2019-09-27 Iain Sandoe * config/rs6000/darwin.md (@macho_correct_pic_): New, replaces the expander and two define_insn entries. (@reload_macho_picbase_): Update gen_macho_correct_pic call. * config/rs6000/rs6000.md (builtin_setjmp_receiver): Likewise. diff --git a/gcc/config/rs6000/darwin.md b/gcc/config/rs6000/darwin.md index a5c5a3af39..b2a52d81b3 100644 --- a/gcc/config/rs6000/darwin.md +++ b/gcc/config/rs6000/darwin.md @@ -216,6 +216,16 @@ You should have received a copy of the GNU General Public License (match_dup 2))] "") +(define_insn "@macho_correct_pic_" + [(set (match_operand:P 0 "gpc_reg_operand" "=r") + (plus:P (match_operand:P 1 "gpc_reg_operand" "r") + (unspec:P [(match_operand:P 2 "immediate_operand" "s") + (match_operand:P 3 "immediate_operand" "s")] + UNSPEC_MPIC_CORRECT)))] + "DEFAULT_ABI == ABI_DARWIN" + "addis %0,%1,ha16(%2-%3)\n\taddi %0,%0,lo16(%2-%3)" + [(set_attr "length" "8")]) + (define_insn "@load_macho_picbase_" [(set (reg:P LR_REGNO) (unspec:P [(match_operand:P 0 "immediate_operand" "s") @@ -232,44 +242,6 @@ You should have received a copy of the GNU General Public License [(set_attr "type" "branch") (set_attr "cannot_copy" "yes")]) -(define_expand "macho_correct_pic" - [(set (match_operand 0 "") - (plus (match_operand 1 "") - (unspec [(match_operand 2 "") - (match_operand 3 "")] - UNSPEC_MPIC_CORRECT)))] - "DEFAULT_ABI == ABI_DARWIN" -{ - if (TARGET_32BIT) - emit_insn (gen_macho_correct_pic_si (operands[0], operands[1], operands[2], - operands[3])); - else - emit_insn (gen_macho_correct_pic_di (operands[0], operands[1], operands[2], - operands[3])); - - DONE; -}) - -(define_insn "macho_correct_pic_si" - [(set (match_operand:SI 0 "gpc_reg_operand" "=r") - (plus:SI (match_operand:SI 1 "gpc_reg_operand" "r") - (unspec:SI [(match_operand:SI 2 "immediate_operand" "s") - (match_operand:SI 3 "immediate_operand" "s")] - UNSPEC_MPIC_CORRECT)))] - "DEFAULT_ABI == ABI_DARWIN" - "addis %0,%1,ha16(%2-%3)\n\taddi %0,%0,lo16(%2-%3)" - [(set_attr "length" "8")]) - -(define_insn "macho_correct_pic_di" - [(set (match_operand:DI 0 "gpc_reg_operand" "=r") - (plus:DI (match_operand:DI 1 "gpc_reg_operand" "r") - (unspec:DI [(match_operand:DI 2 "immediate_operand" "s") - (match_operand:DI 3 "immediate_operand" "s")] - 16)))] - "DEFAULT_ABI == ABI_DARWIN && TARGET_64BIT" - "addis %0,%1,ha16(%2-%3)\n\taddi %0,%0,lo16(%2-%3)" - [(set_attr "length" "8")]) - (define_insn "@reload_macho_picbase_" [(set (reg:P LR_REGNO) (unspec:P [(match_operand:P 0 "immediate_operand" "s") @@ -316,7 +288,8 @@ You should have received a copy of the GNU General Public License emit_insn (gen_reload_macho_picbase (Pmode, tmplrtx)); emit_move_insn (picreg, gen_rtx_REG (Pmode, LR_REGNO)); - emit_insn (gen_macho_correct_pic (picreg, picreg, picrtx, tmplrtx)); + emit_insn (gen_macho_correct_pic (Pmode, picreg, picreg, + picrtx, tmplrtx)); } else /* Not using PIC reg, no reload needed. */ diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index c5443bab9e..46167e5f20 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -10055,7 +10055,8 @@ emit_insn (gen_load_macho_picbase (Pmode, tmplabrtx)); emit_move_insn (picreg, gen_rtx_REG (Pmode, LR_REGNO)); - emit_insn (gen_macho_correct_pic (picreg, picreg, picrtx, tmplabrtx)); + emit_insn (gen_macho_correct_pic (Pmode, picreg, picreg, + picrtx, tmplabrtx)); } else #endif