From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by sourceware.org (Postfix) with ESMTPS id 0EA483858C33 for ; Mon, 13 Nov 2023 03:25:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0EA483858C33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=intel.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 0EA483858C33 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=192.198.163.7 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1699845915; cv=pass; b=RS7b0IZggyR30ZNjjyCon7QQ7eObRu+SoL+aKbVbwu/VUjLMZkADZh0wG55cJbWCBDVnt/ActiaJLhzk2VvvJTk+87+QKiDjtspxwEWP1fEu/xxolUuIMUBMF3BBOTX+K53LYGOHsEhAWgnuCoO5+YGs5ionh3ACW/vbn0pNN4U= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1699845915; c=relaxed/simple; bh=mzUrTgsm/y0YzDmtxj9GTBgS/8+TTzHHr2YmtBl8bQA=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=O6By7LiCvUJg81RrD1ZGf08NmBwFgzg018taGKFif979I21DyPDtuBEC711Z871bkoqWz/9Ozahp5U6laXxMxxZJQQCatRHGE4BryNXXoANKooVKHjWT9Irl+fOkTtkR3tf6QmfUw7V4zWL0cZtn9eDUwRdWD1TfbF3dQXw/qTY= ARC-Authentication-Results: i=2; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1699845913; x=1731381913; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=mzUrTgsm/y0YzDmtxj9GTBgS/8+TTzHHr2YmtBl8bQA=; b=bjbpTkG+t3hBvXhsz9HomVfzPDzY1zCbEcYQkBkrv9Be9nOh7m68gSi2 0gQfcNAVpss6mGVDbiZkqCx9XJsMYWgkdDi3JNvGurHS0hX7GNBG52iCF XaW2iYtdExpNpNoen5I+1QKjjPUYn8SGVhbfpUlBI7XcBnGJuBuLmE5pb WWDSskWCHURHsEYyIHxuNzWPKHgBGWW3S75lqhiPRf2Etai1bqDvrtsOo Vz0wcnBEX9qa0m3fQxVnzoya10thHdpjDlbZr4gHcu6js67N+yGP+SZD0 BMw0QRTdqKwXms9T09f8yUfHSBA07WLrh3/h5n8SpDM2cmp5LCvYrt4u3 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10892"; a="11921061" X-IronPort-AV: E=Sophos;i="6.03,298,1694761200"; d="scan'208";a="11921061" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Nov 2023 19:25:12 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.03,298,1694761200"; d="scan'208";a="5349303" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orviesa002.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 12 Nov 2023 19:25:12 -0800 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Sun, 12 Nov 2023 19:25:11 -0800 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34 via Frontend Transport; Sun, 12 Nov 2023 19:25:11 -0800 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.100) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.34; Sun, 12 Nov 2023 19:25:10 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=I17ZdfJwWevkoktAuF2nRl42ZuqIhymFJcAj6cVZzVLMezh/XlwZ93nycer6aBY6+hroYNPduyw9SEWeYQTbqVFqnacSkqtDR8Rl6PTzX7PhKtUo7i6jW42JgccCAaY0Dw2fKZDfl13rcPpRXKyhIw+MC42emaPEZjblntEeIQmmkIhEzSItIHbC/D9XdxVRWqNTkvkpfBxeRMHPYs4xrSZQssd2bn+ZezEHgmSuCf3Ocgd/KgxEgp1aQv53ahQ2kyYZM51DZV/uJc7F6DdddSeTUxTAYXbPcqaj7kzMOHewXGsg6byux+YX3Yo6e7hOyN1fxT5yX+tQMcnXxlMGaQ== 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=9YunfJkVB77Y0+V2g0ss1eyBzc6kSiKAEbfJXhqpHaY=; b=e4yxOqHAdO0+/3tXdYbcLE4G9rFDIPv2sF2s9K1jhsSicqBOsHQm23l+HBU0LfoVeX4i0zTBE7tRN/qIsSQtovNM/UrDHqas8ico8PjAR49m7ph3HjsmJouMtJIlua9Ky+psYV7tNNp0lv5vTetWVcwR0BoRGT6VU4JszfGqA69864j9s42qaGip0ClhZso/ppF4JaPHNvJ7q+Qu2NNeRU7TAtSHQpkYeYgKZS4L7a/SfdSMzIMM2tK8fHURZ8mIky2uieHbM7GlHCYa6/3/LdMY50Vtd+wmUowKO8jlhgifhCwIje1HSTDWIwJ6oQOIB5et950aqFjQ6l7F5VA14Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from MW5PR11MB5908.namprd11.prod.outlook.com (2603:10b6:303:194::10) by DM4PR11MB5424.namprd11.prod.outlook.com (2603:10b6:5:39c::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6977.29; Mon, 13 Nov 2023 03:25:08 +0000 Received: from MW5PR11MB5908.namprd11.prod.outlook.com ([fe80::4317:53a0:2638:358c]) by MW5PR11MB5908.namprd11.prod.outlook.com ([fe80::4317:53a0:2638:358c%5]) with mapi id 15.20.6977.029; Mon, 13 Nov 2023 03:25:08 +0000 From: "Li, Pan2" To: Richard Sandiford , Jeff Law CC: "gcc-patches@gcc.gnu.org" , "juzhe.zhong@rivai.ai" , "Wang, Yanzhang" , "kito.cheng@gmail.com" , "richard.guenther@gmail.com" Subject: RE: [PATCH v2] DSE: Allow vector type for get_stored_val when read < store Thread-Topic: [PATCH v2] DSE: Allow vector type for get_stored_val when read < store Thread-Index: AQHaEtNG2R/A3PeYSUWKivFFh4FufbByKnYAgAMWAduAALh30IABoyDA Date: Mon, 13 Nov 2023 03:25:07 +0000 Message-ID: References: <20231102031423.3751965-1-pan2.li@intel.com> <20231109060858.3067686-1-pan2.li@intel.com> <7b7ad19b-7212-4dca-b58d-5d77f8f10dbe@gmail.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MW5PR11MB5908:EE_|DM4PR11MB5424:EE_ x-ms-office365-filtering-correlation-id: deadb22c-cda4-47e8-ba05-08dbe3f822d9 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 8Suomnvdvu++QUpxM63Mv9Lsf3eXA5U+tYUaauBKULqnlbIxoxSMNDQfu8/wz1II/eToeyv2wO8sJgacKBLq9luag3abL/WNkGijx72Izk6I3VPGCezAzZKbRDC9VCOsH0IwJ2iNzJ28aFAwCylhGgPiI/qvGQnMlUeTj2owvrLs5GoCz38xi8MAFBaGw6SML6DnBX3c2xZ6nIrfHmZQFnAiiHvspm8o/QBLxIO+r46zJROc9+pU0y8AJ2NTZ4lS2/vVcJN5GuJ730+JGGDe0KBW2DsIf6s+mpmBK7aaFR2N59GgDja9xccERiXkIpm+jip3TbGcXl+ayRcqXbt0fY+8bgjZcHd3LfFSSSoFkpGY7wGI1FVFlYuE9WsbgxnYSvcZ4BnFxIOzsaDLwQlb/zDlKHtkIlmt2RgUtxR6gdZrQ7bujEQPUwxARysoToNWHVXEGjplkHloSRFcOtwAHxFKyU3cCrzxz/lgzueyhfvthW5GWHx/AhAXjkR+MEFZVJi+cpDXtWuBhWelX7CuW1Da4nZbeUIO/R95GvHPbPYtpJDDksDaRoiKhPiS+XM40b2Nmx79ebUiD3+HPgkleQXQEetTiODrRqYf3xHaRfwHQdfymXCFPAMtobXKO2bJMc4bsyDJdJ0k9c5qCfkAVw== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MW5PR11MB5908.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(376002)(39860400002)(346002)(136003)(396003)(230922051799003)(451199024)(64100799003)(186009)(1800799009)(84970400001)(41300700001)(55016003)(7696005)(6506007)(71200400001)(2906002)(83380400001)(5660300002)(8676002)(8936002)(4326008)(52536014)(38070700009)(110136005)(66556008)(66476007)(316002)(66446008)(66946007)(76116006)(33656002)(966005)(86362001)(53546011)(478600001)(54906003)(64756008)(26005)(9686003)(122000001)(38100700002)(82960400001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?CBVuZCCZu9zOoir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1CJDB?= =?us-ascii?Q?jXQRYsT9jxu1kgjFlucSXaRRGVeQXuDjfXgfvlBFNXxMtODUlwUmEsAGZkKo?= =?us-ascii?Q?4Rg44VRkOOaEGnb95ADrtyu0LfM8+8Nt97iHHOQIhD36paHuhG916f5g9Pti?= =?us-ascii?Q?A1Bv5TMWiDzoQln/eqElB6pwxNtUUyxbu9niFlcyyAsQU2yon7LTtAygJ7yk?= =?us-ascii?Q?NGnynyYSNh+6iZ3aOMTynt2HR/KrGX764+OhYLf6LbBCJuoL7kXioMgpQJtG?= =?us-ascii?Q?KHiNaVTGBDnV4Wp9g1XygLF2vMS4GVkKYyS9hzsrr4zJ+gfGeXMukbAAEQSi?= =?us-ascii?Q?bcGDis9HXjIRwmksAsc+QDRm2iqP7GMlMKSfgC/EMNJ4mBuiqytExFsjAfMW?= =?us-ascii?Q?+FCba87+06nctkmSA7TZ71FjmUNSlOcGWSiYmw31DOEO3cRVFd4eelo9mYe4?= =?us-ascii?Q?SccCNDcIx0EIOWeW7TEmW5X2Z50Ku/R2cy0EHfvgAqzmL5O0NSPUSi472HuM?= =?us-ascii?Q?a85INrx/TzgHAvluAahcFb+i4zJ0Bglnb97ciSAUDxogNcUV5IB6q+eFzK9Y?= =?us-ascii?Q?hEsukr7PYNr7vBqRyNGAtMk4R1y/NDCPLXiWBUem0mqrwJ3rvFf9o/5GSiEQ?= =?us-ascii?Q?X65PvbDZqX69P1GNAvotGFHRQ8oEwaNqTpTFcrR8YqobFvUz0YyXH5FG31bF?= =?us-ascii?Q?TrNVoJ5R/LIcUULmCvY=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MW5PR11MB5908.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: deadb22c-cda4-47e8-ba05-08dbe3f822d9 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Nov 2023 03:25:07.8722 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 5J0hAZx6I5sAc8djJUexhPDQtP7ls/N2/hMMekx8Qjsgjlx8fR2ymu9l2SqqkwO3DdV20V71j7T//nJ9rjOZrQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR11MB5424 X-OriginatorOrg: intel.com X-Spam-Status: No, score=-6.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_SHORT,SPF_HELO_NONE,SPF_NONE,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: Update v4 in below link, please help to ignore v3. https://gcc.gnu.org/pipermail/gcc-patches/2023-November/636216.html Sorry for inconvenience. Pan -----Original Message----- From: Li, Pan2=20 Sent: Sunday, November 12, 2023 10:31 AM To: Richard Sandiford ; Jeff Law Cc: gcc-patches@gcc.gnu.org; juzhe.zhong@rivai.ai; Wang, Yanzhang ; kito.cheng@gmail.com; richard.guenther@gmail.com Subject: RE: [PATCH v2] DSE: Allow vector type for get_stored_val when read= < store Thanks Richard S and Jeff for comments. > Did you want to use known_le so that you'd pick up the case when the two= =20 > modes are the same size? Or was known_lt the test you really wanted=20 > (and if so, why). Take known_lt in v2 due to consideration that leave the equal go to origina= l code path. Just have a try for known_le and got sorts of ICE when test, I bet it may b= e related to the latent bug as Richard S mentioned. > instead. Alternatively, we could remove the is_constant condition > and fix PR87815 in a different way, e.g. by protecting the > smallest_int_mode_for_size with a tighter condition. That might > allow a similar DSE optimisation to this patch for nonzero offsets, > thanks to: Thus, looks like we should fix the PR87815 from the way suggested by Richar= d S, before we take known_le for vector here. I will have a try soon and keep you posted. Pan -----Original Message----- From: Richard Sandiford =20 Sent: Saturday, November 11, 2023 11:23 PM To: Jeff Law Cc: Li, Pan2 ; gcc-patches@gcc.gnu.org; juzhe.zhong@riva= i.ai; Wang, Yanzhang ; kito.cheng@gmail.com; richa= rd.guenther@gmail.com Subject: Re: [PATCH v2] DSE: Allow vector type for get_stored_val when read= < store Jeff Law writes: > On 11/8/23 23:08, pan2.li@intel.com wrote: >> From: Pan Li >>=20 >> Update in v2: >> * Move vector type support to get_stored_val. >>=20 >> Original log: >>=20 >> This patch would like to allow the vector mode in the >> get_stored_val in the DSE. It is valid for the read >> rtx if and only if the read bitsize is less than the >> stored bitsize. >>=20 >> Given below example code with >> --param=3Driscv-autovec-preference=3Dfixed-vlmax. >>=20 >> vuint8m1_t test () { >> uint8_t arr[32] =3D { >> 1, 2, 7, 1, 3, 4, 5, 3, 1, 0, 1, 2, 4, 4, 9, 9, >> 1, 2, 7, 1, 3, 4, 5, 3, 1, 0, 1, 2, 4, 4, 9, 9, >> }; >>=20 >> return __riscv_vle8_v_u8m1(arr, 32); >> } >>=20 >> Before this patch: >> test: >> lui a5,%hi(.LANCHOR0) >> addi sp,sp,-32 >> addi a5,a5,%lo(.LANCHOR0) >> li a3,32 >> vl2re64.v v2,0(a5) >> vsetvli zero,a3,e8,m1,ta,ma >> vs2r.v v2,0(sp) <=3D=3D Unnecessary store to stack >> vle8.v v1,0(sp) <=3D=3D Ditto >> vs1r.v v1,0(a0) >> addi sp,sp,32 >> jr ra >>=20 >> After this patch: >> test: >> lui a5,%hi(.LANCHOR0) >> addi a5,a5,%lo(.LANCHOR0) >> li a4,32 >> addi sp,sp,-32 >> vsetvli zero,a4,e8,m1,ta,ma >> vle8.v v1,0(a5) >> vs1r.v v1,0(a0) >> addi sp,sp,32 >> jr ra >>=20 >> Below tests are passed within this patch: >>=20 >> * The x86 bootstrap and regression test. >> * The aarch64 regression test. >> * The risc-v regression test. >>=20 >> PR target/111720 >>=20 >> gcc/ChangeLog: >>=20 >> * dse.cc (get_stored_val): Allow vector mode if the read >> bitsize is less than stored bitsize. >>=20 >> gcc/testsuite/ChangeLog: >>=20 >> * gcc.target/riscv/rvv/base/pr111720-0.c: New test. >> * gcc.target/riscv/rvv/base/pr111720-1.c: New test. >> * gcc.target/riscv/rvv/base/pr111720-10.c: New test. >> * gcc.target/riscv/rvv/base/pr111720-2.c: New test. >> * gcc.target/riscv/rvv/base/pr111720-3.c: New test. >> * gcc.target/riscv/rvv/base/pr111720-4.c: New test. >> * gcc.target/riscv/rvv/base/pr111720-5.c: New test. >> * gcc.target/riscv/rvv/base/pr111720-6.c: New test. >> * gcc.target/riscv/rvv/base/pr111720-7.c: New test. >> * gcc.target/riscv/rvv/base/pr111720-8.c: New test. >> * gcc.target/riscv/rvv/base/pr111720-9.c: New test. > We're always getting the lowpart here AFAICT and it appears that all the= =20 > right thing should happen if gen_lowpart_common fails (it returns NULL,=20 > which bubbles up and is the right return value from get_stored_val if it= =20 > can't be optimized). Yeah, we should always be operating on the lowpart, but it looks like there's a latent bug. This check: if (gap.is_constant () && maybe_ne (gap, 0)) { ... } else ... means that we ignore the gap if it's a nonzero runtime value. I guess it should be: if (maybe_ne (gap, 0)) { if (!gap.is_constant ()) return NULL_RTX; ... } instead. Alternatively, we could remove the is_constant condition and fix PR87815 in a different way, e.g. by protecting the smallest_int_mode_for_size with a tighter condition. That might allow a similar DSE optimisation to this patch for nonzero offsets, thanks to: if (multiple_p (shift, GET_MODE_BITSIZE (new_mode)) && known_le (GET_MODE_SIZE (new_mode), GET_MODE_SIZE (store_mode))) { /* Try to implement the shift using a subreg. */ ... > Did you want to use known_le so that you'd pick up the case when the two= =20 > modes are the same size? Or was known_lt the test you really wanted=20 > (and if so, why). Agree it should be known_le FWIW. Thanks, Richard