From patchwork Wed Dec 23 16:57:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Sidwell X-Patchwork-Id: 560641 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 B4A5C140C0A for ; Thu, 24 Dec 2015 03:57:16 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=jxBwbcRD; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=ZODmw1gReAvqYFCxYmj7LvogkLsB6pYigNWw5P9fdnl9+8ASCT /dFr3PJ5pMwdTIfgzSKtYS/EKtUXsGF2xKtgDM1OS2LgxN19Kd5ZCjp7Ijtclz/K tfhOB9rbu07mS6EOleUgYc3DhQWTqdep884M/kl89blLBzzMQlmVbbVVc= 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:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=CoAXuwn7BdiIDkk/rzE9h2rYkxo=; b=jxBwbcRD7bahQ3Uc9N9M MDGv3qW4QdggtcArHszhR19qKcURHRhte0/iWN3Hnpi3mLC93T6hIQFIqRDcR8uk JA/D44Ycbtv1ojOh1l2XVCb/Vm8b5xhhpBQex1lFQ9yRdFQQ7ISH9MHtATN2zNgX fv1q/z2IZnCyNgv3ifBvbhI= Received: (qmail 29365 invoked by alias); 23 Dec 2015 16:57:09 -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 29348 invoked by uid 89); 23 Dec 2015 16:57:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.6 required=5.0 tests=BAYES_20, FREEMAIL_FROM, KAM_ASCII_DIVIDERS, KAM_STOCKGEN, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=no version=3.3.2 spammy=Hard, dst, 836, 83, 6 X-HELO: mail-qg0-f53.google.com Received: from mail-qg0-f53.google.com (HELO mail-qg0-f53.google.com) (209.85.192.53) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 23 Dec 2015 16:57:07 +0000 Received: by mail-qg0-f53.google.com with SMTP id k90so157616482qge.0 for ; Wed, 23 Dec 2015 08:57:06 -0800 (PST) X-Received: by 10.140.144.10 with SMTP id 10mr27484734qhq.38.1450889824871; Wed, 23 Dec 2015 08:57:04 -0800 (PST) Received: from ?IPv6:2601:181:c000:c497:a2a8:cdff:fe3e:b48? ([2601:181:c000:c497:a2a8:cdff:fe3e:b48]) by smtp.googlemail.com with ESMTPSA id 81sm18325895qhx.15.2015.12.23.08.57.04 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 23 Dec 2015 08:57:04 -0800 (PST) To: GCC Patches From: Nathan Sidwell Subject: [PTX] remove some predicates Message-ID: <567AD25F.1040205@acm.org> Date: Wed, 23 Dec 2015 11:57:03 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 This patch removes some now unused predicates, removes the inspection of a mov insn's source operand along with explict address conversion instruction. the noting of use of a function address is done at emission time. nathan 2015-12-23 Nathan Sidwell * config/nvptx/nvptx-protos.h (nvptx_maybe_convert_symbolic_operand): Delete prototype. * config/nvptx/nvptx.c (nvptx_maybe_convert_symbolic_operand): Delete. (nvptx_output_mov_insn): Record fnsym here. (nvptx_wpropagate): Don't create UNSPEC_TO_GENERIC unspec. * config/nvptx/nvptx.md (UNSPEC_TO_GENERIC): Delete. (symbolic_operand): Delete predicate. (nvptx_nonimmediate_operand): Delete predicate. (mov): Hard regs are perfectly ok here. (convaddr_): Delete. Index: config/nvptx/nvptx-protos.h =================================================================== --- config/nvptx/nvptx-protos.h (revision 231927) +++ config/nvptx/nvptx-protos.h (working copy) @@ -41,6 +41,5 @@ extern const char *nvptx_ptx_type_from_m extern const char *nvptx_output_mov_insn (rtx, rtx); extern const char *nvptx_output_call_insn (rtx_insn *, rtx, rtx); extern const char *nvptx_output_return (void); -extern rtx nvptx_maybe_convert_symbolic_operand (rtx); #endif #endif Index: config/nvptx/nvptx.c =================================================================== --- config/nvptx/nvptx.c (revision 231927) +++ config/nvptx/nvptx.c (working copy) @@ -1413,31 +1413,6 @@ nvptx_gen_wcast (rtx reg, propagate_mask } return res; } - -/* When loading an operand ORIG_OP, verify whether an address space - conversion to generic is required, and if so, perform it. Check - for SYMBOL_REFs and record them if needed. Return either the - original operand, or the converted one. */ - -rtx -nvptx_maybe_convert_symbolic_operand (rtx op) -{ - if (GET_MODE (op) != Pmode) - return op; - - rtx sym = op; - if (GET_CODE (sym) == CONST) - sym = XEXP (sym, 0); - if (GET_CODE (sym) == PLUS) - sym = XEXP (sym, 0); - - if (GET_CODE (sym) != SYMBOL_REF) - return op; - - nvptx_maybe_record_fnsym (sym); - - return op; -} /* Returns true if X is a valid address for use in a memory reference. */ @@ -1767,9 +1742,12 @@ nvptx_output_mov_insn (rtx dst, rtx src) rtx sym = src; if (GET_CODE (sym) == CONST) sym = XEXP (XEXP (sym, 0), 0); - if (SYMBOL_REF_P (sym) - && SYMBOL_DATA_AREA (sym) != DATA_AREA_GENERIC) - return "%.\tcvta%D1%t0\t%0, %1;"; + if (SYMBOL_REF_P (sym)) + { + if (SYMBOL_DATA_AREA (sym) != DATA_AREA_GENERIC) + return "%.\tcvta%D1%t0\t%0, %1;"; + nvptx_maybe_record_fnsym (sym); + } if (src_inner == dst_inner) return "%.\tmov%t0\t%0, %1;"; @@ -3359,9 +3337,7 @@ nvptx_wpropagate (bool pre_p, basic_bloc if (data.offset) { /* Stuff was emitted, initialize the base pointer now. */ - rtx init = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, worker_bcast_sym), - UNSPEC_TO_GENERIC); - init = gen_rtx_SET (data.base, init); + rtx init = gen_rtx_SET (data.base, worker_bcast_sym); emit_insn_after (init, insn); if (worker_bcast_size < data.offset) Index: config/nvptx/nvptx.md =================================================================== --- config/nvptx/nvptx.md (revision 231927) +++ config/nvptx/nvptx.md (working copy) @@ -20,7 +20,6 @@ (define_c_enum "unspec" [ UNSPEC_ARG_REG - UNSPEC_TO_GENERIC UNSPEC_COPYSIGN UNSPEC_LOG2 @@ -61,6 +60,9 @@ (define_attr "subregs_ok" "false,true" (const_string "false")) +;; The nvptx operand predicates, in general, don't permit subregs and +;; only literal constants, which differ from the generic ones, which +;; permit subregs and symbolc constants (as appropriate) (define_predicate "nvptx_register_operand" (match_code "reg") { @@ -74,12 +76,6 @@ : memory_operand (op, mode)); }) -;; Allow symbolic constants. -(define_predicate "symbolic_operand" - (match_code "symbol_ref,const")) - -;; Registers or constants for normal instructions. Does not allow symbolic -;; constants. (define_predicate "nvptx_nonmemory_operand" (match_code "reg,const_int,const_double") { @@ -87,16 +83,6 @@ : immediate_operand (op, mode)); }) -(define_predicate "nvptx_nonimmediate_operand" - (match_code "reg,subreg,mem") -{ - if (REG_P (op)) - return (op != frame_pointer_rtx - && op != arg_pointer_rtx - && op != stack_pointer_rtx); - return nonimmediate_operand (op, mode); -}) - (define_predicate "const0_operand" (and (match_code "const_int") (match_test "op == const0_rtx"))) @@ -240,13 +226,7 @@ (match_operand:QHSDISDFM 1 "general_operand" ""))] "" { - operands[1] = nvptx_maybe_convert_symbolic_operand (operands[1]); - - /* Hard registers are often actually symbolic operands on this target. - Don't allow them when storing to memory. */ - if (MEM_P (operands[0]) - && (!REG_P (operands[1]) - || REGNO (operands[1]) <= LAST_VIRTUAL_REGISTER)) + if (MEM_P (operands[0]) && !REG_P (operands[1])) { rtx tmp = gen_reg_rtx (mode); emit_move_insn (tmp, operands[1]); @@ -327,14 +307,6 @@ %.\\tst%A0.u%T0\\t%0, %1;" [(set_attr "subregs_ok" "true")]) -;; Pointer address space conversion -(define_insn "convaddr_" - [(set (match_operand:P 0 "nvptx_register_operand" "=R") - (unspec:P [(match_operand:P 1 "symbolic_operand" "s")] - UNSPEC_TO_GENERIC))] - "" - "%.\\tcvta%D1%t0\\t%0, %1;") - ;; Integer arithmetic (define_insn "add3"