From patchwork Thu Oct 11 15:20:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Koning X-Patchwork-Id: 982549 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-487362-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=comcast.net Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="qa8LWNAS"; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=comcast.net header.i=@comcast.net header.b="XHOY++A9"; 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 42WF5p6HCDz9sC2 for ; Fri, 12 Oct 2018 02:20:28 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :content-type:content-transfer-encoding:mime-version:subject :message-id:date:to; q=dns; s=default; b=mDWAydZ4+smHUYocz6t4YxU AsuP1Fe8TMR64s1x7ZFk0xLzoD52joN6XV5PTEHS2X+wKCxn8sHucbmDBgjlO28a TT5/ZHDI0N8uBNWuwoy2uZkmTBdL7yjGYJZDHtQ8eMIZh2qhjUCeBj+EIq/HQS3M Sw5s2uH87lOqGJ3zEph0= 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 :content-type:content-transfer-encoding:mime-version:subject :message-id:date:to; s=default; bh=G6lN+grenOOswVzhoUUkhJYyKCs=; b= qa8LWNASTK9ADktlUj+T3YE4UKayU5xQZiZSMOX1auKAF34HHBucxwZQb26xegLu 0XtXFxwdHyRRpH57GPIs4UBJ3XYcZxSATpO3p7V5rabGe7xsJkblEtf5DcDEc6LL ji9BLugWJKN+VLOyT5yqhJPYGokM+AX7iAUG0Cc9Kjk= Received: (qmail 76582 invoked by alias); 11 Oct 2018 15:20:21 -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 76568 invoked by uid 89); 11 Oct 2018 15:20:20 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.8 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=emulate X-HELO: resqmta-po-04v.sys.comcast.net Received: from resqmta-po-04v.sys.comcast.net (HELO resqmta-po-04v.sys.comcast.net) (96.114.154.163) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 11 Oct 2018 15:20:19 +0000 Received: from resomta-po-02v.sys.comcast.net ([96.114.154.226]) by resqmta-po-04v.sys.comcast.net with ESMTP id AcBBgqlpIAOBJAcl7gCwrP; Thu, 11 Oct 2018 15:20:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20161114; t=1539271217; bh=TOedOqiaVPC0Et/dNBLN8FCZTz4Hh3Qw88AMRf6GB/c=; h=Received:Received:From:Content-Type:Mime-Version:Subject: Message-Id:Date:To; b=XHOY++A9qzzHYnwZ9gNH1S3A8NfSanTWA5/uaeafJCjAEMlm4XGkHTsS6SRtk4+F3 ErK1HdrqoIaOR++VP5dYMvN9u9ocIkrUSM8l3633RsB3c9G+8WxiLOZXGL4FLlSiP0 BlYhRUIQ4D2L5zi7go0LoFv23lylDRUN3j+yr4vzs3eaee3FkFVZYJNubMb7jwQpQR FiSwWZTnPr9hLxfOdAC4Sr1ksKSUO++QMJ9C3ZXOw+Yof+nV6/uu98uWaK0C8VJaxk hXvfOjwU77hVQVtCjaueQVXcl3oX/DfLzfBZ0gekLcZZ3++yDjS+/8I6/4aojfzi44 Qf39Y5O0MqD9w== Received: from [192.168.10.125] ([73.60.223.101]) by resomta-po-02v.sys.comcast.net with ESMTPSA id Acl6gT2AR1cYZAcl7gOxdt; Thu, 11 Oct 2018 15:20:17 +0000 From: Paul Koning Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\)) Subject: [PATCH, doc] describe mode checking for doloop_end pattern Message-Id: Date: Thu, 11 Oct 2018 11:20:16 -0400 To: GCC patches Since the code that uses the doloop_end pattern does not check the operand mode as given in the pattern, the pattern itself may need to do this, and that was not documented. This patch adds that information. It also updates the example to reflect this. Ok for trunk? paul ChangeLog: 2018-10-11 Paul Koning * doc/md.texi (doloop_end): Document that the pattern code may need to check operand mode. Index: doc/md.texi =================================================================== --- doc/md.texi (revision 265042) +++ doc/md.texi (working copy) @@ -7619,7 +7619,23 @@ simplified) from the PDP-11 target: @smallexample @group -(define_insn "doloop_end" +(define_expand "doloop_end" + [(parallel [(set (pc) + (if_then_else + (ne (match_operand:HI 0 "nonimmediate_operand" "+r,!m") + (const_int 1)) + (label_ref (match_operand 1 "" "")) + (pc))) + (set (match_dup 0) + (plus:HI (match_dup 0) + (const_int -1)))])] + "TARGET_40_PLUS" + "@{ + if (GET_MODE (operands[0]) != HImode) + FAIL; + @}") + +(define_insn "doloop_end_nocc" [(set (pc) (if_then_else (ne (match_operand:HI 0 "nonimmediate_operand" "+r,!m") @@ -7628,17 +7644,28 @@ simplified) from the PDP-11 target: (pc))) (set (match_dup 0) (plus:HI (match_dup 0) - (const_int -1)))] - "" - + (const_int -1))) + (clobber (reg:CC CC_REGNUM))] + "TARGET_40_PLUS && reload_completed" + "* @{ + rtx lb[1]; + if (which_alternative == 0) - return "sob %0,%l1"; + return \"sob\t%0,%l1\"; + + /* emulate sob */ + lb[0] = gen_label_rtx (); + output_asm_insn (\"dec\t%0\", operands); + output_asm_insn (\"beq\t%l0\", lb); + output_asm_insn (\"jmp\t%l1\", operands); + + output_asm_label (lb[0]); + fputs (\":\\n\", asm_out_file); + + return \"\"; + @}") - /* emulate sob */ - output_asm_insn ("dec %0", operands); - return "bne %l1"; - @}) @end group @end smallexample @@ -7662,10 +7689,18 @@ will be non-negative. Since the @code{doloop_end} insn is a jump insn that also has an output, the reload pass does not handle the output operand. Therefore, the constraint must allow for that operand to be in memory rather than a -register. In the example shown above, that is handled by using a loop -instruction sequence that can handle memory operands when the memory -alternative appears. +register. In the example shown above, that is handled (in the +@code{doloop_end_nocc} pattern) by using a loop instruction sequence +that can handle memory operands when the memory alternative appears. +GCC does not check the mode of the loop register operand when generating +the @code{doloop_end} pattern. If the pattern is only valid for some +modes but not others, the pattern should be a @code{define_expand} +pattern that checks the operand mode in the preparation code, and issues +@code{FAIL} if an unsupported mode is found. The example above does +this, since the machine instruction to be used only exists for +@code{HImode}. + @end ifset @ifset INTERNALS @node Insn Canonicalizations