From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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-Archive: List-Post: List-Help: Sender: gcc-patches-owner@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 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable 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 15:31:00 -0000 To: GCC patches X-SW-Source: 2018-10/txt/msg00666.txt.bz2 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 t= hat 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 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- doc/md.texi (revision 265042) +++ doc/md.texi (working copy) @@ -7619,7 +7619,23 @@ simplified) from the PDP-11 target: =20 @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]) !=3D 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)))] - "" -=20=20 + (const_int -1))) + (clobber (reg:CC CC_REGNUM))] + "TARGET_40_PLUS && reload_completed" + "* @{ + rtx lb[1]; +=20=20=20 if (which_alternative =3D=3D 0) - return "sob %0,%l1"; + return \"sob\t%0,%l1\"; +=20=20=20 + /* emulate sob */ + lb[0] =3D gen_label_rtx (); + output_asm_insn (\"dec\t%0\", operands); + output_asm_insn (\"beq\t%l0\", lb); + output_asm_insn (\"jmp\t%l1\", operands); +=20=20=20=20 + output_asm_label (lb[0]); + fputs (\":\\n\", asm_out_file); +=20=20=20 + return \"\"; + @}") =20 - /* emulate sob */ - output_asm_insn ("dec %0", operands); - return "bne %l1"; - @}) @end group @end smallexample =20 @@ -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. =20 +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