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 AFF7A385842D for ; Thu, 29 Jun 2023 08:12:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AFF7A385842D 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 E42E91F8BF for ; Thu, 29 Jun 2023 08:12:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1688026350; h=from:from:reply-to:date:date:to:to:cc:mime-version:mime-version: content-type:content-type; bh=m9bByz8lWnCl44H6yY52S+oB7WxnoTeWmy8/5zTgWKk=; b=arCp4bm+XitQJpPRBgj0reymqziyJKeth464Ipjs1tdDkkzXGki+XOyCaFt6w9n13fPSTW p4NRsHZ8lZpR3ImiAHswloO8TxPR0MWy6dkiLZtRsYndx4w/NHj1G1JwqBoARepz9L6fQC 8FOVPTuy1v1KrJS6CdR2vYNjxoQ+HBk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1688026350; h=from:from:reply-to:date:date:to:to:cc:mime-version:mime-version: content-type:content-type; bh=m9bByz8lWnCl44H6yY52S+oB7WxnoTeWmy8/5zTgWKk=; b=wyhU3yLaF/zdVMtLKb03+S/ap3tbLQu1oo7CrvHG0yg1IHRsvYVjkg6JhRQoUlZ9q2n9CJ 1/2WomOCvqu8yEAg== 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 DA4D32C142 for ; Thu, 29 Jun 2023 08:12:30 +0000 (UTC) Date: Thu, 29 Jun 2023 08:12:30 +0000 (UTC) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] middle-end/110461 - pattern applying wrongly to vectors 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.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,MISSING_MID,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: Message-ID: <20230629081230.H0d9kKuLrRTVla3dqof4sfUkQ9MvDgLC6GrxpnHeHTk@z> The following guards a match.pd pattern that wasn't supposed to apply to vectors and thus runs into TYPE_PRECISION checking. For vector support the constant case is lacking and the pattern would have missing optab support checking for the result operation. Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed. PR middle-end/110461 * match.pd (bitop (convert@2 @0) (convert?@3 @1)): Disable for VECTOR_TYPE_P. * gcc.dg/pr110461.c: New testcase. --- gcc/match.pd | 1 + gcc/testsuite/gcc.dg/pr110461.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/pr110461.c diff --git a/gcc/match.pd b/gcc/match.pd index 83bcefa914b..f09583bbcac 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -1853,6 +1853,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) || tree_nop_conversion_p (TREE_TYPE (@0), type))) || types_match (@0, @1)) && !POINTER_TYPE_P (TREE_TYPE (@0)) + && !VECTOR_TYPE_P (TREE_TYPE (@0)) && TREE_CODE (TREE_TYPE (@0)) != OFFSET_TYPE /* ??? This transform conflicts with fold-const.cc doing Convert (T)(x & c) into (T)x & (T)c, if c is an integer diff --git a/gcc/testsuite/gcc.dg/pr110461.c b/gcc/testsuite/gcc.dg/pr110461.c new file mode 100644 index 00000000000..cd23a2b1615 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr110461.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O" } */ + +typedef int v4si __attribute__ ((vector_size (4*sizeof(int)))); +typedef short v4hi __attribute__ ((vector_size (4*sizeof(short)))); + +v4hi res; +v4hi a, b; + +void f(void) +{ + v4si t = __builtin_convertvector (a, v4si); + v4si t1 = __builtin_convertvector (b, v4si); + t ^= t1; + res = __builtin_convertvector (t, v4hi); +} -- 2.35.3