From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 54668 invoked by alias); 12 Aug 2019 17:25:08 -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 54656 invoked by uid 89); 12 Aug 2019 17:25:08 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-9.2 required=5.0 tests=AWL,BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=no version=3.3.1 spammy=fwa, dumps X-HELO: mail-ed1-f51.google.com Received: from mail-ed1-f51.google.com (HELO mail-ed1-f51.google.com) (209.85.208.51) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 12 Aug 2019 17:25:06 +0000 Received: by mail-ed1-f51.google.com with SMTP id e16so11189378edv.6 for ; Mon, 12 Aug 2019 10:25:06 -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=TX0crlFfYav0z3/HBsnaOfz0On9IOEsC2MR/N6juGYM=; b=SoNr+7iXM7gD1iU2P8vce5zxsihR4RLu9G/03bzZaNMAJ+wp0katpAVIFgYYO6NN34 QdrH3X11fkrRhcMSOIvfdfnuiBwHsopEh51eRA0u2DmUhyOqoAlCjc8FsRdx7IkEqi5A k4ApPeNJsi2Z/mdLMMSle+TUqmklufNDs7KhYmgNeiPUnaM+SZzjQZBsKaxYKzYSY+Vm 4f/SWw0BJLEV3Ugsej9jvERFd8gYbIhSls4WsA7AEkqHeWxkuqzfxMP+eBam8YH5fHy+ /5wEhhq5XvPQCxPpWX1Mk67qkECraV1SYWX2ul2ccSU8JyBfNWyw1jihY63G6Qj22f7I xycg== MIME-Version: 1.0 References: <87sgqnx4i6.fsf@oldenburg2.str.redhat.com> <20190731144722.GS31406@gate.crashing.org> <20190808200514.GL31406@gate.crashing.org> <20190811165916.GX31406@gate.crashing.org> In-Reply-To: <20190811165916.GX31406@gate.crashing.org> From: Tejas Joshi Date: Mon, 12 Aug 2019 17:25: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: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2019-08/txt/msg00095.txt.bz2 Hi, I have the following code in my rs6000.md (I haven't used new TARGET_* yet) : (define_expand "add_truncdfsf3" [(set (match_operand:SF 0 "gpc_reg_operand") (float_truncate:SF (plus:DF (match_operand:DF 1 "gpc_reg_operand") (match_operand:DF 2 "gpc_reg_operand"))))] "TARGET_HARD_FLOAT" "") (define_insn "*add_truncdfsf3_fpr" [(set (match_operand:SF 0 "gpc_reg_operand" "=f,wa") (float_truncate:SF (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%d,wa") (match_operand:DF 2 "gpc_reg_operand" "d,wa"))))] "TARGET_HARD_FLOAT" "@ fadds %0,%1,%2 xsaddsp %x0,%x1,%x2" [(set_attr "type" "fp")]) with following optab in optabs.def : OPTAB_CD(fadd_optab, "add_trunc$b$a3") (what is the difference between $b$a and $a$b?) I have also tried adding fadd, add_truncdfsf3 in rs6000-builtin.def, examined rtl dumps multiple times but couldn't get fadd to be exapanded. What am I missing here? Thanks, Tejas On Sun, 11 Aug 2019 at 22:29, Segher Boessenkool wrote: > > Hi Tejas, > > On Sat, Aug 10, 2019 at 04:00:53PM +0530, Tejas Joshi wrote: > > +(define_expand "add_truncdfsf3" > > + [(set (float_extend:DF (match_operand:SF 0 "gpc_reg_operand")) > > + (plus:DF (match_operand:DF 1 "gpc_reg_operand") > > + (match_operand:DF 2 "gpc_reg_operand")))] > > + "TARGET_HARD_FLOAT" > > + "") > > float_extend on the LHS is never correct. I think the following should > work, never mind that it looks like it does double rounding, because it > doesn't (famous last words ;-) ): > > (define_expand "add_truncdfsf3" > [(set (match_operand:SF 0 "gpc_reg_operand") > (float_truncate:SF > (plus:DF (match_operand:DF 1 "gpc_reg_operand") > (match_operand:DF 2 "gpc_reg_operand"))))] > "TARGET_HARD_FLOAT" > "") > > > +(define_insn "*add_truncdfsf3_fpr" > > + [(set (float_extend:DF (match_operand:SF 0 "gpc_reg_operand" "=")) > > + (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%") > > + (match_operand:DF 2 "gpc_reg_operand" "")))] > > + "TARGET_HARD_FLOAT" > > + "fadd %0,%1,%2" > > + [(set_attr "type" "fp")]) > > The constraints should be "f", "%d", "d", respectively. says to > display something for the mode in a mode iterator. There is no mode > iterator here. (In what you copied this from, there was SFDF). > > You want to output "fadds", not "fadd". > > Maybe it is easier to immediately write the VSX scalar version for this > as well? That's xsaddsp. Oh, and you need to restrict all of this to > more recent CPUs, we'll have to do some new TARGET_* flag for that I > think. > > Finally: please send patches to gcc-patches@ (not gcc@). > > Thanks, > > > Segher