From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 66818 invoked by alias); 10 Aug 2019 10:24:51 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 66768 invoked by uid 89); 10 Aug 2019 10:24:51 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.9 required=5.0 tests=AWL,BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=rs6000md, rs6000.md, UD:rs6000.md, tfmode X-HELO: mail-ed1-f54.google.com Received: from mail-ed1-f54.google.com (HELO mail-ed1-f54.google.com) (209.85.208.54) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 10 Aug 2019 10:24:49 +0000 Received: by mail-ed1-f54.google.com with SMTP id k21so98204319edq.3 for ; Sat, 10 Aug 2019 03:24:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=F9ljH6mwPccqjCahIXU+NjWsrFzAerhvZnFSDi+MK1w=; b=S/2QD/yfTOleCjP0bNu0gVnJ3braixKoInsPrXi/YExGIyXaC/YieGmDfhwJ33lK8O p6lVczfgcjcXE0o7e2K8kXozduRfECCluhrRu42+aw0FOvJI7bgvo4fZ1gZpOQ+9IPLJ czOYM9r9SER7BjjDuG+zUFvC/SerJtm4+b7J2Fx7LVs5Y/9fC3uQ4N4Qt3ULix6IKhow cipIQ85CcDNaQqtHctuWtPlPOSHKgI5UpmyfLl8FgcJdi92kw2rtUVaKbH9c7weNHno+ X+mjVgINq1z5V/kTn7vOI+HWqhCiVzHjfV1mrBjI8ruAQgpO8UahoL2pLSMIj8BhmOfQ KFsg== MIME-Version: 1.0 References: <87sgqnx4i6.fsf@oldenburg2.str.redhat.com> <20190731144722.GS31406@gate.crashing.org> <20190808200514.GL31406@gate.crashing.org> In-Reply-To: From: Tejas Joshi Date: Sat, 10 Aug 2019 10:24:00 -0000 Message-ID: Subject: Re: Expansion of narrowing math built-ins into power instructions To: gcc@gcc.gnu.org Cc: Martin Jambor , hubicka@ucw.cz, segher@kernel.crashing.org, joseph@codesourcery.com Content-Type: multipart/mixed; boundary="0000000000003d3f4f058fc0b3f0" X-IsSubscribed: yes X-SW-Source: 2019-08/txt/msg00078.txt.bz2 --0000000000003d3f4f058fc0b3f0 Content-Type: text/plain; charset="UTF-8" Content-length: 2109 Hello. I have been trying to write a basic pattern taking all the suggestions you both have mentioned. The same patch is attached here, but I cannot see call to : float foo (double x, double y) { return __builtin_fadd (x, y); } being expanded to any instruction, at least a simple one, using -fno-builtin-fadd (and also -mhard-float?). It always stays "bl fadd". What am I missing here? > (POWER8 and later) on. (The result if OE=1 or UE=1 is undefined). (See > 4.3.5.1 in the ISA). 4.3.5.1 in the ISA says that single precision arithmetic instructions perform operation in double format and coerces the result in single format. Can fadd be considered as this type of instruction or do I need to perform add in DFmode and then use "instruction provided to explicitly convert double format operand in FPR to single format."? Thanks, Tejas On Fri, 9 Aug 2019 at 04:39, Joseph Myers wrote: > > On Thu, 8 Aug 2019, Segher Boessenkool wrote: > > > These current patterns all take the same mode for all inputs and outputs > > (that's what 3 indicates, say, fadddf3). You will need to define > > something that takes two SFs in and produces a DF. That cannot really > > For example, md.texi describes standard patterns such as mulhisi3 that > multiply two HImode values and produce an SImode result (widening integer > multiply). > > Using a similar naming pattern, you might have a pattern adddfsf3 that > multiplies two DFmode values and produces an SFmode result (or you could > call it something like add_truncdfsf3 if you wish to emphasise the > truncation involved, for example). Similarly addtfsf3 that multiplies > TFmode and produces an SFmode result, and so on. Of course these names > need documenting (and you need corresponding RTL for them to generate that > distinguishes the fused add+truncate from the different RTL for separate > addition and truncation with double rounding). In cases where long double > and double have the same mode, the daddl function should use the existing > adddf3 pattern. > > -- > Joseph S. Myers > joseph@codesourcery.com --0000000000003d3f4f058fc0b3f0 Content-Type: text/x-patch; charset="US-ASCII"; name="fadd-md.diff" Content-Disposition: attachment; filename="fadd-md.diff" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_jz5eeu540 Content-length: 1871 ZGlmZiAtLWdpdCBhL2djYy9jb25maWcvcnM2MDAwL3JzNjAwMC5tZCBiL2dj Yy9jb25maWcvcnM2MDAwL3JzNjAwMC5tZAppbmRleCA0ZWYxOTkzLi5lNGJm YzRhIDEwMDY0NAotLS0gYS9nY2MvY29uZmlnL3JzNjAwMC9yczYwMDAubWQK KysrIGIvZ2NjL2NvbmZpZy9yczYwMDAvcnM2MDAwLm1kCkBAIC00NjUyLDYg KzQ2NTIsMjEgQEAKICAgWyhzZXRfYXR0ciAidHlwZSIgImZwIikKICAgIChz ZXRfYXR0ciAiaXNhIiAiKiw8RmlzYT4iKV0pCiAKKyhkZWZpbmVfZXhwYW5k ICJhZGRfdHJ1bmNkZnNmMyIKKyAgWyhzZXQgKGZsb2F0X2V4dGVuZDpERiAo bWF0Y2hfb3BlcmFuZDpTRiAwICJncGNfcmVnX29wZXJhbmQiKSkKKwkocGx1 czpERiAobWF0Y2hfb3BlcmFuZDpERiAxICJncGNfcmVnX29wZXJhbmQiKQor CQkgKG1hdGNoX29wZXJhbmQ6REYgMiAiZ3BjX3JlZ19vcGVyYW5kIikpKV0K KyAgIlRBUkdFVF9IQVJEX0ZMT0FUIgorICAiIikKKworKGRlZmluZV9pbnNu ICIqYWRkX3RydW5jZGZzZjNfZnByIgorICBbKHNldCAoZmxvYXRfZXh0ZW5k OkRGIChtYXRjaF9vcGVyYW5kOlNGIDAgImdwY19yZWdfb3BlcmFuZCIgIj08 RmY+IikpCisJKHBsdXM6REYgKG1hdGNoX29wZXJhbmQ6REYgMSAiZ3BjX3Jl Z19vcGV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