From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 91868 invoked by alias); 11 Aug 2019 16:59:26 -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 91857 invoked by uid 89); 11 Aug 2019 16:59:25 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=famous, respectively X-HELO: gate.crashing.org Received: from gate.crashing.org (HELO gate.crashing.org) (63.228.1.57) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 11 Aug 2019 16:59:23 +0000 Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id x7BGxIrE005392; Sun, 11 Aug 2019 11:59:19 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id x7BGxHb6005388; Sun, 11 Aug 2019 11:59:17 -0500 Date: Sun, 11 Aug 2019 16:59:00 -0000 From: Segher Boessenkool To: Tejas Joshi Cc: gcc@gcc.gnu.org, Martin Jambor , hubicka@ucw.cz, joseph@codesourcery.com Subject: Re: Expansion of narrowing math built-ins into power instructions Message-ID: <20190811165916.GX31406@gate.crashing.org> References: <87sgqnx4i6.fsf@oldenburg2.str.redhat.com> <20190731144722.GS31406@gate.crashing.org> <20190808200514.GL31406@gate.crashing.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-IsSubscribed: yes X-SW-Source: 2019-08/txt/msg00088.txt.bz2 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