From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2043.outbound.protection.outlook.com [40.107.247.43]) by sourceware.org (Postfix) with ESMTPS id 8ECA83858401 for ; Thu, 7 Mar 2024 10:44:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8ECA83858401 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8ECA83858401 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.247.43 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1709808266; cv=pass; b=wADkE0fkJ9rJxhOQFgyjdzGfiPzexc109x8M+Ts3RhNRO/j3u5zN44mzb2PGIOVf/CHF6gm0fIaismJ9u2ZTjFruM1ow5K/OKaEX7Lia9nOG4rcd1QDvoeiFqt0dE3C45o401eRpUCQHtrdAXAe4VeavWeoXbAN7UbeUpO+NtAE= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1709808266; c=relaxed/simple; bh=w95MT60aYGE+XDsiCI2m8ZmR4u3ZZ6iKCBqEVi0ZGqc=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=gm5WUe+E7v6Ur0l6D0662bafqL+XAw0OyMEIj3sXgnGphHnsKh+hPBuMp9krjGGfaOzY0gWrTFu6149FXn+IdlF3oW5c9m9bjRzFTsliySdi4RmWWFFX6z4qnY7FpkIROF92FlTH2qhiQWssQLav5zTe9uRUI1s1nEW5QoQ7OHM= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=GtV7PYMCNoY993hWh+cmTEmjLnvokN4ITxI7DpEGSc3rQYyu4ZG445gDtGmOCQs6jKShtRQ6uHVni7CHGwjxZHgw8TGYSuv86dYSu6WrSppxLK3OTVajvKWTA634nNxbOEAjyGMK3I/bu+Ys9OyCY5vYtYXjpTDu+Xbs6MYG9qxx3dB3QtGBmA1gKj8IewYKWfwks7JYHItX2nGNvJmWwrveiuEdIgE0xcuAESz7e7ZaWuAJgxD84q1p2UjFd9n5QRT6uRJlgisdyv0REftnNoJg+iJTayBsAMZqOUZzoDSvws/olN/TeQuJLmoV2sv8xKI2vvHR2d/GBh+y6W4ywg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=HPmG23e43IArjr8HQDPzDXVlfr/wBDyEUEZn4E5JcA0=; b=GQV3xG9rvv+nK0V/Uu6x404M4Tax6qeT0S2RSAYv10x4Hudr/kHE9dEZVJZerkSWA5gAnRT9uiQW7wQHZpo1ZRj3ekXHxzmhp4j6C72N5/DEuWDg5b3xPnrdyEURy9lNzLfNwJP/L8vfjA3smkpvZmANwajz8h/oL6eiObddxXBGJziJ8SYGTQG7bROmUdIRKObQhtL0Sd919VPYoSXUJAdfAfmeIaoc4HB9Gd8ingxs0Dtm9MaR8r4+MVFTFqa04zOBnSBEscPz6kS3SHU8xKvzLv6GBImb7xGiKUmgL/GNNHu0pvW6udzyFmTKoDD579BLywuzttxgnk8GSQbxkg== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=gcc.gnu.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dmarc=[1,1,header.from=arm.com]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HPmG23e43IArjr8HQDPzDXVlfr/wBDyEUEZn4E5JcA0=; b=TmB4t0Dgx82z8AHLV5mfaHkrHfrBBVGKw9yKkgAn6MM/HZVu/Me3plI4R0Xkrct+jKZ1p8qA2YsaGKaw2qc17Y2/1mypdFN5YwpDk2GHKK7RlW2oYSaDEM1b1qBgMBdJe4gHGU8H1wKGdzez/fjRyW30J41Xi/spCFH2tF/qxas= Received: from DBBPR09CA0038.eurprd09.prod.outlook.com (2603:10a6:10:d4::26) by PAXPR08MB6589.eurprd08.prod.outlook.com (2603:10a6:102:159::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.39; Thu, 7 Mar 2024 10:44:21 +0000 Received: from DU2PEPF00028D06.eurprd03.prod.outlook.com (2603:10a6:10:d4:cafe::35) by DBBPR09CA0038.outlook.office365.com (2603:10a6:10:d4::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.24 via Frontend Transport; Thu, 7 Mar 2024 10:44:21 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DU2PEPF00028D06.mail.protection.outlook.com (10.167.242.166) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.11 via Frontend Transport; Thu, 7 Mar 2024 10:44:21 +0000 Received: ("Tessian outbound 6a48a1f51a3c:v276"); Thu, 07 Mar 2024 10:44:21 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: dc0518fdfeadf94f X-CR-MTA-TID: 64aa7808 Received: from 01391980d336.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 86FB0228-A703-4A43-BB2B-14FEC59FF41B.1; Thu, 07 Mar 2024 10:44:14 +0000 Received: from EUR03-DBA-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 01391980d336.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 07 Mar 2024 10:44:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TKw2GTyRwaR+9hWEB2bDefNUqRaYf7MGR2SQBMP4OImAA/DRTGD/faZKPTZYXtMCKxpHt49aOTjxR+UncZW7F7OEI035uh7h/+FRcAUVQMcXhiJmJet+ATHlLPimSF/UMsvmRakN/s/dm25LGnDQqDjF5UJsVCm8RHNHFg3GVyGBg1gv1BqaBbfQBtqslDsoOSlCPFdz6e6V+YcSa7FA8nzpFfJ9PD1ZNdhA38auELcoHaMGnXcAxbUnVATplJeX//J2fUrN+jMHQ138bJhQU0wsgU7XucE4UlHZhDBXelvgNnp8a25GB6r3tN1Wub6B+xNEifexqdpU/9w/M0p7iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=HPmG23e43IArjr8HQDPzDXVlfr/wBDyEUEZn4E5JcA0=; b=mh+imckDitwggCUobYhThcBsHrf/6+dFt/vKh49AW6jiEkQC+lgHGvchFn9m+TAbJG+EmuDUcB+nCIxMhHzJ0TGa3MTA+a2LpZonvFlZOKfiqSvT4Ke6UdSiRngno6dBE6n9MrYcEliz8MMsUXRFgnHWt4BN6JWHjH/30lVBm4Zf4itb5fpQLQ/h6C8vyrODW2I8XnKV2N8glrLXUMAu5iFbLH5rNIO4/20FhuONmXDyW/7IC2hVJ8JQqq76fcqrWwHoghcLUoDAA8KDN0gJI5bIPu1KoTdY4Kfgp8j9ht+0U0A67M423aPNBkPjKNHuLGimvFC1a/VUHPnyMmKHCg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=gcc.gnu.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HPmG23e43IArjr8HQDPzDXVlfr/wBDyEUEZn4E5JcA0=; b=TmB4t0Dgx82z8AHLV5mfaHkrHfrBBVGKw9yKkgAn6MM/HZVu/Me3plI4R0Xkrct+jKZ1p8qA2YsaGKaw2qc17Y2/1mypdFN5YwpDk2GHKK7RlW2oYSaDEM1b1qBgMBdJe4gHGU8H1wKGdzez/fjRyW30J41Xi/spCFH2tF/qxas= Received: from DUZPR01CA0107.eurprd01.prod.exchangelabs.com (2603:10a6:10:4bb::25) by PAWPR08MB9029.eurprd08.prod.outlook.com (2603:10a6:102:341::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.26; Thu, 7 Mar 2024 10:44:12 +0000 Received: from DB1PEPF000509F8.eurprd02.prod.outlook.com (2603:10a6:10:4bb:cafe::e9) by DUZPR01CA0107.outlook.office365.com (2603:10a6:10:4bb::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.26 via Frontend Transport; Thu, 7 Mar 2024 10:44:12 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; pr=C Received: from nebula.arm.com (40.67.248.234) by DB1PEPF000509F8.mail.protection.outlook.com (10.167.242.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7362.11 via Frontend Transport; Thu, 7 Mar 2024 10:44:12 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Thu, 7 Mar 2024 10:44:03 +0000 Received: from a078660.blr.arm.com (10.162.46.14) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Thu, 7 Mar 2024 10:44:02 +0000 From: Tejas Belagod To: CC: Tejas Belagod , Subject: [PATCH] vect: Call vect_convert_output with the right vecitype [PR114108] Date: Thu, 7 Mar 2024 16:14:00 +0530 Message-ID: <20240307104400.1970528-1-tejas.belagod@arm.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: DB1PEPF000509F8:EE_|PAWPR08MB9029:EE_|DU2PEPF00028D06:EE_|PAXPR08MB6589:EE_ X-MS-Office365-Filtering-Correlation-Id: 100ababa-3da6-42d4-6941-08dc3e938c20 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: /CdvxWikohUmwj6b9OOaesU5wvXENKQAqkWQ+7vUkLNkGAPJx9FMvu07FOPmzr/yDohPt5G1DlQihVoOWo3pA2Uvbg2JUYzwsSibsGPBX/f83YmqeZQt/lubNhCOFkdZ3Jkre5xrkdUDnCotcbdvMk4FEAvSXoGi5jfDjBROMQAupxXpjYaQ6fXpYeuFVERWPs9dn5AOBCZ3ISXEbD+7Qb8vy90V2AmgJGg/X+wkyKF54AW1d5lmv9bAPZ3a82XUfaXtfesM8wUSSp/0yDfy7pwMiQxO9vL20LkFgYg5aPhDIN6HdF2++ACzExRywpoUdzJ9SLIk7P+FS6RzKhatX1EqIOMtCbIQZvzhlAIrQ2IVFLj/WonhhFXMEyZ3116uL1EQKstlqKqGsSNziBuHa7AUg39s8Qwk71Pf5z01p96DW7IsD4Of32c1peQK7xoYyVPvoPj+fTmdvKqAN+CjoVClUBtyOfaezCvgaLma1m0cHu2nlIsZZZwonEcEwBHB4un9e3xmBFAq8fxsS344B9vq5ek9ERbHXK7LURdkNiPnphCRz7wbjxOs1SqCfPhs9rOdF2GtlxFsh1w6Tv2b+N3Fg5bqNsDQZYKJBi+6jOefDzhzWnZy/1pzJNB+YjIw6641tzojAjOR5Bv42Sg05W8da6lZjaFYU1z5X8X/lgQAl67+b4VeAW65Eu1VcOdd//OsVG9aZooNe/gGLOikWA== X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(376005)(36860700004)(82310400014);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR08MB9029 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DU2PEPF00028D06.eurprd03.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 414a8e47-a7ff-4ef2-a00c-08dc3e938708 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Vdw+Jd6l0/s6pgVTp7tYA74tphOaNrJOV+RBKxb9LB+SFFFHJN3hMrVMshYgsznTXyhv5K2iEpOX/luz+08H730jDAXw3/NESR0JA3Z+hqIs0KKlVpheSt+QhVbqiOrBjq9y/AixZ7gcvuKkPh2mTF3Tx807gdH1mtSDvsgKnegidH7w5FgdO6kCq4o6ZLlw7m3gj2c88laxJw/Qf+n9VluXAkcoZ/fricqIedcxC8v6uA5OZLpsEYpOE6aVYJs/wYOLsv0yC5z06PjlWaBhRudj7YVCanvQt4AbdZBf6UiiS5yWzluumdYPF72vnduEnEV+AyFEk4uO4wOAaSnN2NGclQBUp23SC3+dTlejuRLJ5NG8RD+lbeSUvdyiKi2/J2FovyEo155rz6RqciTXUrWBKAklbJAJCeX3uyT8EbdrMILI1iPP7B8cv7T5NuvGhvuc9xOUKFwE88iUPqSmb/dsGw/8GGLRpSXmVAt+Nexp3AZLyjRk6DEfqgUT49luSyagyUG4uWCqEFY455L0Dbn0rtaMecBcHiiLcAusyEFE6xGDmJyTc2r+wDk0sL7qfbZMMURUqeGNHh5eGAkg4o8/q6yW9+pGunL+Fgevwuaxilf+kBLipmNk9c6eBZr9+fYFN3hVGikGA/KdHmjMgeTSGwglre0VKFOK1SMzj3atnOxfAWuF5F1okaeJk5OvJBlGT/homUOFOOwEBIC+ew== X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230031)(82310400014)(36860700004)(376005);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2024 10:44:21.1816 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 100ababa-3da6-42d4-6941-08dc3e938c20 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DU2PEPF00028D06.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR08MB6589 X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,FORGED_SPF_HELO,GIT_PATCH_0,KAM_DMARC_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY 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: This patch fixes a bug where vect_recog_abd_pattern called vect_convert_output with the incorrect vecitype for the corresponding pattern_stmt. vect_convert_output expects vecitype to be the vector form of the scalar type of the LHS of pattern_stmt, but we were passing in the vector form of the LHS of the new impending conversion statement. This caused a skew in ABD's pattern_stmt having the vectype of the following gimple pattern_stmt. 2024-03-06 Tejas Belagod gcc/ChangeLog: PR middle-end/114108 * tree-vect-patterns.cc (vect_recog_abd_pattern): Call vect_convert_output with the correct vecitype. gcc/testsuite/ChangeLog: * gcc.dg/vect/pr114108.c: New test. --- gcc/testsuite/gcc.dg/vect/pr114108.c | 19 +++++++++++++++++++ gcc/tree-vect-patterns.cc | 5 ++--- 2 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/vect/pr114108.c diff --git a/gcc/testsuite/gcc.dg/vect/pr114108.c b/gcc/testsuite/gcc.dg/vect/pr114108.c new file mode 100644 index 00000000000..b3075d41398 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr114108.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ + +#include "tree-vect.h" + +typedef signed char schar; + +__attribute__((noipa, noinline, optimize("O3"))) +void foo(const schar *a, const schar *b, schar *c, int n) +{ + for (int i = 0; i < n; i++) + { + unsigned u = __builtin_abs (a[i] - b[i]); + c[i] = u <= 7U ? u : 7U; + } +} + + +/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" { target aarch64*-*-* } } } */ +/* { dg-final { scan-tree-dump "vect_recog_abd_pattern: detected" "vect" { target aarch64*-*-* } } } */ diff --git a/gcc/tree-vect-patterns.cc b/gcc/tree-vect-patterns.cc index d562f57920f..4f491c6b833 100644 --- a/gcc/tree-vect-patterns.cc +++ b/gcc/tree-vect-patterns.cc @@ -1576,9 +1576,8 @@ vect_recog_abd_pattern (vec_info *vinfo, && !TYPE_UNSIGNED (abd_out_type)) { tree unsign = unsigned_type_for (abd_out_type); - tree unsign_vectype = get_vectype_for_scalar_type (vinfo, unsign); - stmt = vect_convert_output (vinfo, stmt_vinfo, unsign, stmt, - unsign_vectype); + stmt = vect_convert_output (vinfo, stmt_vinfo, unsign, stmt, vectype_out); + vectype_out = get_vectype_for_scalar_type (vinfo, unsign); } return vect_convert_output (vinfo, stmt_vinfo, out_type, stmt, vectype_out); -- 2.25.1