From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by sourceware.org (Postfix) with ESMTPS id 77ABD385841C for ; Fri, 19 Jan 2024 08:56:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 77ABD385841C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 77ABD385841C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705654593; cv=none; b=kNSTSm0axy3I8i8EwBGjgfu/flcQRqcYqLX8EUD3SpgiALaBXMckyxy+vgY8q2hPjnn1pcdEnWKYlXSHXhVRHu1mPxDnAtdcySUHpPDJn69LcWicPwrP9HLVu04+6F5GDtNq77WKBZfW3nsTyTaCpwbUmX1bynyCgpdRZ7y13Pg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705654593; c=relaxed/simple; bh=j80/vb9GMtgiWrKPKCrWj+Zp2xliNMTvP0en9/buUMI=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:Date: From:To:Subject:Message-ID:MIME-Version; b=mMRwwxhZ0Wo2L0qgFpZjn1FixaPOhZoANgjmUnsvbyo7KxqupcGexfC/0cV2aAffXFTmr4seiG06Je9XtU8xuZnI1BLcwOdV6tR6E2DJlS6zFnhjtlLsNTWSFQub+RD4RZIIwYZY95djz3nT2VFzmd3j/BT6q3fspB6kqNFo8YM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from [10.168.4.150] (unknown [10.168.4.150]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 3C8CA21B54; Fri, 19 Jan 2024 08:56:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1705654588; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=wz5TzjuPqIOS/mnezM8flLZR0M9HIzR2EqLOrL2CBs4=; b=eJ9GhY3hFpalRfCuSfqihWmgyOpbgrBHERrPmLIeR3aFapGVWfIm+BE0W0hnvsyRp54DLJ oonCWi5j+y/Ot8bLUq+mk0fPBgjzoYbfky4dzwK1IOXFSyb5ifynrBKPb+pTx7qNYIA0D3 wecCRDTwZ0uvKhGC3FZr/mCWodwlgAg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1705654588; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=wz5TzjuPqIOS/mnezM8flLZR0M9HIzR2EqLOrL2CBs4=; b=Dt+GOWU5jcNHxtEmLi/JInA5FcLfbo4veaZnbA4itScS9532svEMfqcGmlr/U41pkhftOD VxNZMnJmlsYDClDA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1705654588; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=wz5TzjuPqIOS/mnezM8flLZR0M9HIzR2EqLOrL2CBs4=; b=eJ9GhY3hFpalRfCuSfqihWmgyOpbgrBHERrPmLIeR3aFapGVWfIm+BE0W0hnvsyRp54DLJ oonCWi5j+y/Ot8bLUq+mk0fPBgjzoYbfky4dzwK1IOXFSyb5ifynrBKPb+pTx7qNYIA0D3 wecCRDTwZ0uvKhGC3FZr/mCWodwlgAg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1705654588; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=wz5TzjuPqIOS/mnezM8flLZR0M9HIzR2EqLOrL2CBs4=; b=Dt+GOWU5jcNHxtEmLi/JInA5FcLfbo4veaZnbA4itScS9532svEMfqcGmlr/U41pkhftOD VxNZMnJmlsYDClDA== Date: Fri, 19 Jan 2024 09:55:27 +0100 (CET) From: Richard Biener To: Jakub Jelinek cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH] sccvn: Don't use SCALAR_INT_TYPE_MODE on BLKmode BITINT_TYPEs [PR113459] In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Authentication-Results: smtp-out1.suse.de; none X-Spam-Level: X-Spam-Score: -0.10 X-Spamd-Result: default: False [-0.10 / 50.00]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; NEURAL_SPAM_SHORT(1.00)[0.333]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_TWO(0.00)[2]; DBL_BLOCKED_OPENRESOLVER(0.00)[tree-ssa-sccvn.cc:url,suse.de:email]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_COUNT_ZERO(0.00)[0]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; BAYES_HAM(-0.00)[38.60%] X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Fri, 19 Jan 2024, Jakub Jelinek wrote: > Hi! > > sccvn uses GET_MODE_SIZE (SCALAR_INT_TYPE_MODE (type)) for INTEGER_TYPEs, > most likely because that is what native_{interpret,encode}_int used. > This obviously doesn't work for larger BITINT_TYPEs which have BLKmode > and the above ICEs on those. native_{interpret,encode}_int checks whether > the BITINT_TYPE is medium/large/huge (i.e. an array of 2+ ABI limbs) > and uses TYPE_SIZE_UNIT for that case, otherwise SCALAR_INT_TYPE_MODE like > for the INTEGER_TYPE case. > > The following patch instead just uses SCALAR_INT_TYPE_MODE for non-BLKmode > TYPE_MODE and TYPE_SIZE_UNIT otherwise. > > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? OK. Thanks, Richard. > 2024-01-19 Jakub Jelinek > > PR tree-optimization/113459 > * tree-ssa-sccvn.cc (vn_walk_cb_data::push_partial_def): Use > TREE_INT_CST_LOW of TYPE_SIZE_UNIT rather than GET_MODE_SIZE > of SCALAR_INT_TYPE_MODE if type has BLKmode. > (vn_reference_lookup_3): Likewise. Formatting fix. > > * gcc.dg/bitint-73.c: New test. > > --- gcc/tree-ssa-sccvn.cc.jj 2024-01-03 11:51:42.361580881 +0100 > +++ gcc/tree-ssa-sccvn.cc 2024-01-18 12:39:52.789606975 +0100 > @@ -2287,7 +2287,12 @@ vn_walk_cb_data::push_partial_def (pd_da > BITS_PER_UNIT > - (maxsizei % BITS_PER_UNIT)); > if (INTEGRAL_TYPE_P (type)) > - sz = GET_MODE_SIZE (SCALAR_INT_TYPE_MODE (type)); > + { > + if (TYPE_MODE (type) != BLKmode) > + sz = GET_MODE_SIZE (SCALAR_INT_TYPE_MODE (type)); > + else > + sz = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (type)); > + } > if (sz > needed_len) > { > memcpy (this_buffer + (sz - needed_len), buffer, needed_len); > @@ -2967,8 +2972,10 @@ vn_reference_lookup_3 (ao_ref *ref, tree > } > else > { > - unsigned buflen = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (vr->type)) + 1; > - if (INTEGRAL_TYPE_P (vr->type)) > + unsigned buflen > + = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (vr->type)) + 1; > + if (INTEGRAL_TYPE_P (vr->type) > + && TYPE_MODE (vr->type) != BLKmode) > buflen = GET_MODE_SIZE (SCALAR_INT_TYPE_MODE (vr->type)) + 1; > unsigned char *buf = XALLOCAVEC (unsigned char, buflen); > memset (buf, TREE_INT_CST_LOW (gimple_call_arg (def_stmt, 1)), > @@ -3165,7 +3172,12 @@ vn_reference_lookup_3 (ao_ref *ref, tree > offset + maxsize - 1. */ > HOST_WIDE_INT sz = maxsizei / BITS_PER_UNIT; > if (INTEGRAL_TYPE_P (type)) > - sz = GET_MODE_SIZE (SCALAR_INT_TYPE_MODE (type)); > + { > + if (TYPE_MODE (type) != BLKmode) > + sz = GET_MODE_SIZE (SCALAR_INT_TYPE_MODE (type)); > + else > + sz = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (type)); > + } > amnt = ((unsigned HOST_WIDE_INT) offset2i + size2i > - offseti - maxsizei) % BITS_PER_UNIT; > if (amnt) > --- gcc/testsuite/gcc.dg/bitint-73.c.jj 2024-01-18 12:29:07.586634031 +0100 > +++ gcc/testsuite/gcc.dg/bitint-73.c 2024-01-18 12:28:42.406986342 +0100 > @@ -0,0 +1,18 @@ > +/* PR tree-optimization/113459 */ > +/* { dg-do compile { target bitint } } */ > +/* { dg-options "-std=c23 -O2" } */ > + > +#if __BITINT_MAXWIDTH__ >= 129 > +# define N 129 > +#else > +# define N 63 > +#endif > + > +_BitInt(N) a; > + > +_BitInt(N) > +foo (void) > +{ > + __builtin_memset (&a, 6, sizeof a); > + return a; > +} > > Jakub > > -- Richard Biener SUSE Software Solutions Germany GmbH, Frankenstrasse 146, 90461 Nuernberg, Germany; GF: Ivo Totev, Andrew McDonald, Werner Knoblich; (HRB 36809, AG Nuernberg)