From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 159233858D3C for ; Wed, 19 Oct 2022 08:21:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 159233858D3C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 480A5339B8; Wed, 19 Oct 2022 08:21:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1666167706; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=b/+2RYekRK/AylvHSIvl23La3gwSLDUECKZjwW7uxGY=; b=rTWaLxGns2xGIdMqSQ59G/pBOcWM3tt+UFV+wmUnYsvCgMtgoRshjZecvBHu/tqYGUlAWV TNptCj/R2ifmlZtmtOj9CRLNZu3mFUZehQpe3hIuEvDVHm6xhgNYWGiJHB2U8/C5fCh5cx oxNbGEXKiMMQRxbRT7U6+ZHKGvHw/HI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1666167706; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=b/+2RYekRK/AylvHSIvl23La3gwSLDUECKZjwW7uxGY=; b=xMTciZZtj8vCtyzC+/KzYoud1y6+wDkhrxeLNrdSdaNEl4RaD9cYccis0Cu4muHrN07/RW f9f9MmJ05ZKznZAg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 2DE3213345; Wed, 19 Oct 2022 08:21:46 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id rzcdC5qzT2NjXAAAMHmgww (envelope-from ); Wed, 19 Oct 2022 08:21:46 +0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Richard Biener Mime-Version: 1.0 (1.0) Subject: Re: [PATCH] expr: Fix ICE on BFmode -> SFmode conversion of constant [PR107262] Date: Wed, 19 Oct 2022 10:21:45 +0200 Message-Id: References: Cc: Jeff Law , gcc-patches@gcc.gnu.org In-Reply-To: To: Jakub Jelinek X-Mailer: iPhone Mail (19H12) X-Spam-Status: No, score=-5.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS,TXREP 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: > Am 19.10.2022 um 09:55 schrieb Jakub Jelinek via Gcc-patches : >=20 > =EF=BB=BFHi! >=20 > I forgot to handle the case where lowpart_subreg returns a VOIDmode > CONST_INT, in that case convert_mode_scalar obviously doesn't work. >=20 > The following patch fixes that. >=20 > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? Ok. Thanks, Richard=20 > 2022-10-19 Jakub Jelinek >=20 > PR middle-end/107262 > * expr.cc (convert_mode_scalar): For BFmode -> SFmode conversions > of constants, use simplify_unary_operation if fromi has VOIDmode > instead of recursive convert_mode_scalar. >=20 > * gcc.dg/pr107262.c: New test. >=20 > --- gcc/expr.cc.jj 2022-10-14 09:35:56.134991155 +0200 > +++ gcc/expr.cc 2022-10-18 14:07:24.330512745 +0200 > @@ -416,8 +416,15 @@ convert_mode_scalar (rtx to, rtx from, i > rtx tof =3D NULL_RTX; > if (fromi) > { > - rtx toi =3D gen_reg_rtx (toi_mode); > - convert_mode_scalar (toi, fromi, 1); > + rtx toi; > + if (GET_MODE (fromi) =3D=3D VOIDmode) > + toi =3D simplify_unary_operation (ZERO_EXTEND, toi_mode, > + fromi, fromi_mode); > + else > + { > + toi =3D gen_reg_rtx (toi_mode); > + convert_mode_scalar (toi, fromi, 1); > + } > toi > =3D maybe_expand_shift (LSHIFT_EXPR, toi_mode, toi, > GET_MODE_PRECISION (to_mode) > --- gcc/testsuite/gcc.dg/pr107262.c.jj 2022-10-18 14:09:44.114607505 +0= 200 > +++ gcc/testsuite/gcc.dg/pr107262.c 2022-10-18 14:09:33.708749313 +0200= > @@ -0,0 +1,13 @@ > +/* PR middle-end/107262 */ > +/* { dg-do compile } */ > +/* { dg-options "-O2 -ffast-math" } */ > +/* { dg-add-options bfloat16 } */ > +/* { dg-require-effective-target bfloat16_runtime } */ > + > +__bf16 > +foo (__bf16 a) > +{ > + __bf16 b =3D 0; > + b /=3D a; > + return b; > +} >=20 > Jakub >=20