From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by sourceware.org (Postfix) with ESMTP id 9BA0B3858D20 for ; Fri, 28 Oct 2022 21:45:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9BA0B3858D20 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=kernel.crashing.org Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 29SLh3gc006137; Fri, 28 Oct 2022 16:43:03 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 29SLh3GU006136; Fri, 28 Oct 2022 16:43:03 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Fri, 28 Oct 2022 16:43:03 -0500 From: Segher Boessenkool To: Eric Botcazou Cc: "H.J. Lu" , gcc-patches@gcc.gnu.org Subject: Re: [PATCH] x86: Replace ne:CCC/ne:CCO with UNSPEC_CC_NE in neg patterns Message-ID: <20221028214303.GH25951@gate.crashing.org> References: <20221026185857.234023-1-hjl.tools@gmail.com> <4752529.GXAFRqVoOG@fomalhaut> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4752529.GXAFRqVoOG@fomalhaut> User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi! On Fri, Oct 28, 2022 at 10:35:03AM +0200, Eric Botcazou via Gcc-patches wrote: > > (set (reg:SI 93) > > (neg:SI (ltu:SI (reg:CCC 17 flags) (const_int 0 [0])))) > > > > as > > > > (set (reg:SI 93) > > (neg:SI (ltu:SI (const_int 1) (const_int 0 [0])))) > > > > which leads to incorrect results since LTU on MODE_CC register isn't the > > same as "unsigned less than" in x86 backend. > > That's not specific to the x86 back-end, i.e. it's a generic caveat. A MODE_CC reg can never be "const_int 1". That is total garbage. It cannot work. It would mean all of (eq (reg:CC) (const_int 0)) (lt (reg:CC) (const_int 0)) (gt (reg:CC) (const_int 0)) (ne (reg:CC) (const_int 0)) (ge (reg:CC) (const_int 0)) (le (reg:CC) (const_int 0)) (and more) are simultaneously true. > > PR target/107172 > > * config/i386/i386.md (UNSPEC_CC_NE): New. > > Replace ne:CCC/ne:CCO with UNSPEC_CC_NE in neg patterns. > > FWIW the SPARC back-end uses a COMPARE instead of an UNSPEC here. You mean in CCV? That works yes, but only because (or if) the setter and getter of the CC reg both use CCV (so never use any other flag at the same time; CCV has an empty intersection with all other CC modes). Segher