From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by sourceware.org (Postfix) with ESMTPS id ABC323851C09 for ; Thu, 17 Sep 2020 03:42:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org ABC323851C09 Received: by mail-pl1-x634.google.com with SMTP id k13so397773plk.3 for ; Wed, 16 Sep 2020 20:42:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=5hYESb1j0EO1TC1u+5nYn2d1LOLhRosKLi2Vft7B2zA=; b=JH/rjgkgOks4G9H14Dz4b21Sh1e0yTquZnsVCmMOtxhbAWGAgfm1WfkIYgOs3Vf9cG CXjVGdmwPyjisej7x2TJhuvHC75i27U73uSMI1hu58RYgylGKVw+copS3KX80++O4UB6 0Brp9jfm0RTunGCFycbCaeMf6XcYEd4//uuF9jei0v2ePX5inbpZw6gHYqXJOmHhDl5g 81pUVhSJrUMJ+uEqrP5A54pBJyGODpDFVkBDAZVFDsJUk18zs/CUAd+cM3tbKi1C6bBA o+VZmCWIVODalyrj/u1yQcvssdxhWIjvG96Z21P3jsIdsmGID+utFXTY8MJsI5mMqUet 9miw== X-Gm-Message-State: AOAM533Shfa9b2Asa0D4jiYSjUJGV655a+JT02+G37ubp3GPBAt/Yb/H 9CvjstKqVEXocPXNXgEzl+mFyqIMg4g= X-Google-Smtp-Source: ABdhPJy72wwx+Fq6uXqPBEWnsMOu0wZ5ALiensnEZH4qBz+TkZdCuXW+o3NuaeVFMkpAPGoDpP/j0g== X-Received: by 2002:a17:90a:d3d5:: with SMTP id d21mr6440903pjw.168.1600314143848; Wed, 16 Sep 2020 20:42:23 -0700 (PDT) Received: from bubble.grove.modra.org ([2406:3400:51d:8cc0:5025:437c:e257:6bef]) by smtp.gmail.com with ESMTPSA id i187sm15807864pgd.82.2020.09.16.20.42.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 20:42:22 -0700 (PDT) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id 473D0863B0; Thu, 17 Sep 2020 13:12:19 +0930 (ACST) Date: Thu, 17 Sep 2020 13:12:19 +0930 From: Alan Modra To: Segher Boessenkool Cc: gcc-patches@sourceware.org Subject: Re: [RS6000] rs6000_rtx_costs cost IOR Message-ID: <20200917034219.GP5452@bubble.grove.modra.org> References: <20200915011946.3395-1-amodra@gmail.com> <20200915011946.3395-7-amodra@gmail.com> <20200917000206.GI28786@gate.crashing.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200917000206.GI28786@gate.crashing.org> User-Agent: Mutt/1.9.4 (2018-02-28) X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Sep 2020 03:42:26 -0000 On Wed, Sep 16, 2020 at 07:02:06PM -0500, Segher Boessenkool wrote: > Hi! > > On Tue, Sep 15, 2020 at 10:49:44AM +0930, Alan Modra wrote: > > * config/rs6000/rs6000.c (rs6000_rtx_costs): Cost IOR. > > > case IOR: > > - /* FIXME */ > > *total = COSTS_N_INSNS (1); > > - return true; > > Hey this was okay for over five years :-) > > > + left = XEXP (x, 0); > > + if (GET_CODE (left) == AND > > + && CONST_INT_P (XEXP (left, 1))) > > Add a comment that this is the integer insert insns? > > > + // rotlsi3_insert_5 > > But use /* comments */. > > > + /* Test both regs even though the one in the mask is > > + constrained to be equal to the output. Increasing > > + cost may well result in rejecting an invalid insn > > + earlier. */ > > Is that ever actually useful? Possibly not in this particular case, but I did see cases where invalid insns were rejected early by costing non-reg sub-expressions. Beside that, the default position on rtx_costs paths that return true should be to cost any sub-expressions unless you know for sure they are zero cost. And yes, we fail to do that for some cases, eg. mul_highpart. > So this new block is pretty huge. Can it easily be factored to a > separate function? Just the insert insns part, not all IOR. Done in my local tree. > Okay for trunk with the comments changed to the correct syntax, and > factoring masked insert out to a separate function pre-approved if you > want to do that. Thanks! I'll hold off committing until the whole rtx_costs patch series is reviewed (not counting the rotate_and_mask_constant patch). -- Alan Modra Australia Development Lab, IBM