From patchwork Fri Nov 20 10:12:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 546870 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 5ABD6140D92 for ; Fri, 20 Nov 2015 21:12:35 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=xGX43ZCz; 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:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=sGkBolSwtFbkZGyQ KR4Ce0eV9xU+7lwMjB4iJnc17/mYMHuFagHVkvGITadBbKJWIO4iKgRriKYr91+F vN600jF6X37zXp5N0hznANc17z+mViZcpIaz3ssj/swL5fW0NVfCY5JbiXtVEMqB 5yX6AVOD/Lg4ZTwWKa2w8OdkM/E= 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 :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=n/27AiMw+ZANyAuj/J60GS 4WuAI=; b=xGX43ZCz56icbHmscVR6tBFAfUBuVASQS2lJakebu4+kageVsABIwG qydnJe/hQohk/oAUvLZiuRS20Gll92WanHJtF9N4F66RwoUL5E7CI1IZNBDngBYO KEiqggQ+nE5vETPBAlp24DB2xt+KMg6oPND9bd0ohT1kvWi4vvhJQ= Received: (qmail 105090 invoked by alias); 20 Nov 2015 10:12:28 -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 105062 invoked by uid 89); 20 Nov 2015 10:12:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL, BAYES_05, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 20 Nov 2015 10:12:25 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id E3267331EA31 for ; Fri, 20 Nov 2015 11:12:21 +0100 (CET) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lxIo_KTIHaOH for ; Fri, 20 Nov 2015 11:12:21 +0100 (CET) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id BD1FD331EA2F for ; Fri, 20 Nov 2015 11:12:21 +0100 (CET) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [patch] Document new overflow arithmetics patterns Date: Fri, 20 Nov 2015 11:12:06 +0100 Message-ID: <1557052.Jl1FD73nyu@polaris> User-Agent: KMail/4.14.9 (Linux/3.16.7-29-desktop; KDE/4.14.9; x86_64; ; ) MIME-Version: 1.0 Hi, this documents the new overflow arithmetics patterns added recently (addv4, subv4, mulv4, umulv4, negv3) and only them, i.e. the old ones are still not. This also fixes the description of the cbranch and jump patterns, which were referring to a label_ref instead of a code_label. Tested with 'make doc' on x86-64/Linux, OK for mainline and 5 branch? 2015-11-20 Eric Botcazou * doc/md.texi (Standard Names): Move entry for addptr3 around, add entries for addv4, subv4, mulv4, umulv4 and negv3, fixes glitch in entries for cbranch4 and jump. Index: doc/md.texi =================================================================== --- doc/md.texi (revision 230589) +++ doc/md.texi (working copy) @@ -4872,17 +4872,6 @@ Add operand 2 and operand 1, storing the must have mode @var{m}. This can be used even on two-address machines, by means of constraints requiring operands 1 and 0 to be the same location. -@cindex @code{addptr@var{m}3} instruction pattern -@item @samp{addptr@var{m}3} -Like @code{add@var{m}3} but is guaranteed to only be used for address -calculations. The expanded code is not allowed to clobber the -condition code. It only needs to be defined if @code{add@var{m}3} -sets the condition code. If adds used for address calculations and -normal adds are not compatible it is required to expand a distinct -pattern (e.g. using an unspec). The pattern is used by LRA to emit -address calculations. @code{add@var{m}3} is used if -@code{addptr@var{m}3} is not defined. - @cindex @code{ssadd@var{m}3} instruction pattern @cindex @code{usadd@var{m}3} instruction pattern @cindex @code{sub@var{m}3} instruction pattern @@ -4912,6 +4901,35 @@ address calculations. @code{add@var{m}3 @itemx @samp{and@var{m}3}, @samp{ior@var{m}3}, @samp{xor@var{m}3} Similar, for other arithmetic operations. +@cindex @code{addv@var{m}4} instruction pattern +@item @samp{addv@var{m}4} +Like @code{add@var{m}3} but takes a @code{code_label} as operand 3 and +emits code to jump to it if signed overflow occurs during the addition. +This pattern is used to implement the built-in functions performing +signed integer addition with overflow checking. + +@cindex @code{subv@var{m}4} instruction pattern +@cindex @code{mulv@var{m}4} instruction pattern +@item @samp{subv@var{m}4}, @samp{mulv@var{m}4} +Similar, for other signed arithmetic operations. + +@cindex @code{umulv@var{m}4} instruction pattern +@item @samp{umulv@var{m}4} +Like @code{mulv@var{m}4} but for unsigned multiplication. That is to +say, the operation is the same as signed multiplication but the jump +is taken only on unsigned overflow. + +@cindex @code{addptr@var{m}3} instruction pattern +@item @samp{addptr@var{m}3} +Like @code{add@var{m}3} but is guaranteed to only be used for address +calculations. The expanded code is not allowed to clobber the +condition code. It only needs to be defined if @code{add@var{m}3} +sets the condition code. If adds used for address calculations and +normal adds are not compatible it is required to expand a distinct +pattern (e.g. using an unspec). The pattern is used by LRA to emit +address calculations. @code{add@var{m}3} is used if +@code{addptr@var{m}3} is not defined. + @cindex @code{fma@var{m}4} instruction pattern @item @samp{fma@var{m}4} Multiply operand 2 and operand 1, then add operand 3, storing the @@ -5277,6 +5295,11 @@ Reverse the order of bytes of operand 1 @item @samp{neg@var{m}2}, @samp{ssneg@var{m}2}, @samp{usneg@var{m}2} Negate operand 1 and store the result in operand 0. +@cindex @code{negv@var{m}3} instruction pattern +@item @samp{negv@var{m}3} +Like @code{neg@var{m}2} but takes a @code{code_label} as operand 2 and +emits code to jump to it if signed overflow occurs during the negation. + @cindex @code{abs@var{m}2} instruction pattern @item @samp{abs@var{m}2} Store the absolute value of operand 1 into operand 0. @@ -5926,13 +5949,13 @@ from the machine description. Conditional branch instruction combined with a compare instruction. Operand 0 is a comparison operator. Operand 1 and operand 2 are the first and second operands of the comparison, respectively. Operand 3 -is a @code{label_ref} that refers to the label to jump to. +is the @code{code_label} to jump to. @cindex @code{jump} instruction pattern @item @samp{jump} A jump inside a function; an unconditional branch. Operand 0 is the -@code{label_ref} of the label to jump to. This pattern name is mandatory -on all machines. +@code{code_label} to jump to. This pattern name is mandatory on all +machines. @cindex @code{call} instruction pattern @item @samp{call}