From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id 28672394C078 for ; Thu, 29 Apr 2021 07:25:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 28672394C078 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rguenther@suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 08CE9AF32; Thu, 29 Apr 2021 07:25:58 +0000 (UTC) Date: Thu, 29 Apr 2021 09:25:57 +0200 (CEST) From: Richard Biener To: Uros Bizjak cc: "gcc-patches@gcc.gnu.org" , Jakub Jelinek Subject: Re: [PATCH] target/100312 - make x86 masked load builtins pure In-Reply-To: Message-ID: References: User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, 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, 29 Apr 2021 07:26:00 -0000 On Wed, 28 Apr 2021, Uros Bizjak wrote: > On Wed, Apr 28, 2021 at 3:32 PM Richard Biener wrote: > > > > On Wed, 28 Apr 2021, Uros Bizjak wrote: > > > > > On Wed, Apr 28, 2021 at 1:46 PM Richard Biener wrote: > > > > > > > > On Wed, 28 Apr 2021, Uros Bizjak wrote: > > > > > > > > > On Wed, Apr 28, 2021 at 1:02 PM Richard Biener wrote: > > > > > > > > > > > > This arranges for the x86 AVX and AVX2 masked load builtins to be > > > > > > pure to enable dead code elimination and more appropriate alias > > > > > > analysis. > > > > > > > > > > > > Bootstrapped and tested on x86_64-unknown-linux-gnu. OK for trunk? > > > > > > > > > > > > Thanks, > > > > > > Richard. > > > > > > > > > > > > 2021-04-28 Richard Biener > > > > > > > > > > > > PR target/100312 > > > > > > * config/i386/i386-builtin.def (IX86_BUILTIN_MASKLOADPD, > > > > > > IX86_BUILTIN_MASKLOADPS, IX86_BUILTIN_MASKLOADPD256, > > > > > > IX86_BUILTIN_MASKLOADPS256, IX86_BUILTIN_MASKLOADD, > > > > > > IX86_BUILTIN_MASKLOADQ, IX86_BUILTIN_MASKLOADD256, > > > > > > IX86_BUILTIN_MASKLOADQ256): Remove. > > > > > > * config/i386/i386-builtins.h (ix86_builtins): Add entries for > > > > > > IX86_BUILTIN_MASKLOADPD, IX86_BUILTIN_MASKLOADPS, > > > > > > IX86_BUILTIN_MASKLOADPD256, IX86_BUILTIN_MASKLOADPS256, > > > > > > IX86_BUILTIN_MASKLOADD, IX86_BUILTIN_MASKLOADQ, > > > > > > IX86_BUILTIN_MASKLOADD256, and IX86_BUILTIN_MASKLOADQ256. > > > > > > * config/i386/i386-builtins.c (ix86_init_mmx_sse_builtins): > > > > > > Initialize IX86_BUILTIN_MASKLOADPD, IX86_BUILTIN_MASKLOADPS, > > > > > > IX86_BUILTIN_MASKLOADPD256, IX86_BUILTIN_MASKLOADPS256, > > > > > > IX86_BUILTIN_MASKLOADD, IX86_BUILTIN_MASKLOADQ, > > > > > > IX86_BUILTIN_MASKLOADD256, and IX86_BUILTIN_MASKLOADQ256 > > > > > > as pure builtins. > > > > > > > > > > OK. > > > > > > > > Whoops - somehow I posted the wrong version. The version posted > > > > ICEs because I failed to realize I'd have to explicitely handle > > > > those builtins in ix86_expand_builtin. What bootstrapped and > > > > tested OK is the version below. > > > > > > > > Is that version also OK? > > > > > > Hm, your previous version removed mentioned builtins from builtins.def > > > and initialized them in ix86_init_mmx_sse_builtins by hand (this seems > > > to be the preferred way). This should work, so I really don't see why > > > the previous approach would result in ICE. > > > > It eventually runs into the gcc_unreachable () at the very end of > > ix86_expand_builtin since IX86_BUILTIN_MASKLOADD and friends are > > no longer in the range of IX86_BUILTIN__BDESC_SPECIAL_ARGS_FIRST > > to IX86_BUILTIN__BDESC_SPECIAL_ARGS_LAST. > > How about the attached (untested) patch then? Ah yeah - good idea. The patch works, bootstrapped and tested on x86_64-unknown-linux-gnu. As expected it reduces the number of masked load builtins for the PR99912 testcase from ~800 to ~350 (at the GIMPLE level). Thanks, Richard.