From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by sourceware.org (Postfix) with ESMTPS id 01BDE3858C2D for ; Tue, 27 Jun 2023 06:30:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 01BDE3858C2D 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 relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 376E61F8BA; Tue, 27 Jun 2023 06:30:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1687847444; 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=m0+Us8I7yrw4YZWzkE1w/uCepbohDf7XDSNzt9r4aj8=; b=ZQqYRA2U7YCypgpwAMTYZGl2PuyUSdbVqbqmOCL0d2WdLZkhtT55EH31bdEUYtF23lIMbZ Iaa58JsfNg2XQ6Ex4BezkaBcqqO9WtVd+Cbi3nN7blJk9i8GEAZbs2bTrj/AcGqG72X/UB eGETRhoKUmPMN6x65HobH2yhnPtumbg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1687847444; 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=m0+Us8I7yrw4YZWzkE1w/uCepbohDf7XDSNzt9r4aj8=; b=ZIikEBY/n9YKtt71IOiYdURaMWts+UjUll/n09SgccKeG15ttx42nuli6Yw+t1l7LZKsAL BbmHxyjePey0yIDA== Received: from wotan.suse.de (wotan.suse.de [10.160.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 2548B2C141; Tue, 27 Jun 2023 06:30:44 +0000 (UTC) Date: Tue, 27 Jun 2023 06:30:44 +0000 (UTC) From: Richard Biener To: Robin Dapp cc: gcc-patches , Tamar.Christina@arm.com Subject: Re: [PATCH] match.pd: Use element_mode instead of TYPE_MODE. In-Reply-To: <3fc809a1-6667-daca-e95a-b0a58825e16f@gmail.com> Message-ID: References: <3fc809a1-6667-daca-e95a-b0a58825e16f@gmail.com> User-Agent: Alpine 2.22 (LSU 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-10.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,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 Mon, 26 Jun 2023, Robin Dapp wrote: > Hi, > > this patch changes TYPE_MODE into element_mode in a match.pd > simplification. As the simplification can be called with vector types > real_can_shorten_arithmetic would ICE in REAL_MODE_FORMAT which > expects a scalar mode. Therefore, use element_mode instead of > TYPE_MODE. > > Additionally, check if the target supports the resulting operation in the > new mode. One target that supports e.g. a float addition but not a > _Float16 addition is the RISC-V vector Float16 extension Zvfhmin. > > Bootstrap on x86_64 succeeded, testsuite is currently running. Is this OK > if the testsuite is clean? The element_mode passing is OK. We don't do a target support check in any other place when non-vector operations are involved. Can you push the element_mode change separately please? I'd like to hear more reasoning of why target_supports_op_p is wanted here. Doesn't target_supports_op_p return false if this is for example a soft-fp target? So if at all, shouldn't the test only be carried out if the original operation was supported by the target? Thanks, Richard. > Regards > Robin > > gcc/ChangeLog: > > * match.pd: Use element_mode and check if target supports > operation with new type. > --- > gcc/match.pd | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/gcc/match.pd b/gcc/match.pd > index 33ccda3e7b6..4a200f221f6 100644 > --- a/gcc/match.pd > +++ b/gcc/match.pd > @@ -7454,10 +7454,11 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) > values representable in the TYPE to be within the > range of normal values of ITYPE. */ > (if (element_precision (newtype) < element_precision (itype) > + && target_supports_op_p (newtype, op, optab_default) > && (flag_unsafe_math_optimizations > || (element_precision (newtype) == element_precision (type) > - && real_can_shorten_arithmetic (TYPE_MODE (itype), > - TYPE_MODE (type)) > + && real_can_shorten_arithmetic (element_mode (itype), > + element_mode (type)) > && !excess_precision_type (newtype))) > && !types_match (itype, newtype)) > (convert:type (op (convert:newtype @1) > -- Richard Biener SUSE Software Solutions Germany GmbH, Frankenstrasse 146, 90461 Nuernberg, Germany; GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman; HRB 36809 (AG Nuernberg)