From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) by sourceware.org (Postfix) with ESMTPS id 788E33858D1E for ; Mon, 20 May 2024 11:48:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 788E33858D1E 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 788E33858D1E Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=192.198.163.13 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1716205711; cv=pass; b=owzjHmYJxRY0JPRpIkSuLbDwpQ8M+hhISFUNDioljzMjVl3nYCqntURibDmKvV7uvSDqP9FCfywO5oLHwbvTzxpsxbfnc3ncMIqxDe9CbHSl1TkCqG6pE2PBEJKM06wvLp60eWwiyJ38HMBw/ih4z6w6wdEXI0uAvffNoQowlG4= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1716205711; c=relaxed/simple; bh=aMB7ZKwsnAteYnWGeDpl/AXwhN64hqKPn3m1wQ5B8f8=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=DknD9FV0KbHemXeiP1E2TDnU9T7+mXDZxhR0B0CIUAFz8q0i8xQ/OaCFa4vVcWpZU0chsgV8NCLa/PMSmgw1ZuLZSVilOPHVkXuL4sB5qAiSzsWfd40zCGGu2ArUkmFqh9p43b99xkJUpHdzYqNSIxcvdw+IGOvr7tJi7aDRqmA= 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=1716205710; x=1747741710; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=aMB7ZKwsnAteYnWGeDpl/AXwhN64hqKPn3m1wQ5B8f8=; b=Flc55rpH6YzodwINH4txrYcLztKhF+kF0m2IfidaGfVN0mCUx7rlIPef 84lxki+iIQ8rQJPDn2VvS8GcvsecYHdIzktvunulX/SOIQrqC/YWAr2tv nmFbflV1pN9jtH41PprwvcAzigbNq+UZn1/MB8O7gp7yHk9GxJ6PFHjNG mdnvHA3vHaNogFv7OdtnJaf5RnuHr0StEUrdIREWp6/Mc7/iJFY9zBZ/8 iWMQJdbSK0cyYtec1joeBk0uJ5GBxCQUpkoRN9Dq6kNiaKHOb1wLhyAxM 24+oZcjsU4SqJO7B3aK5gnpZolZd1mh8EL1y/NEg9boER5x0TIFryJERy g==; X-CSE-ConnectionGUID: McBUUPeeRZ29lBjkz29QMg== X-CSE-MsgGUID: yVW9Nsi+T2mKvhvCgBGR0Q== X-IronPort-AV: E=McAfee;i="6600,9927,11077"; a="15274758" X-IronPort-AV: E=Sophos;i="6.08,174,1712646000"; d="scan'208";a="15274758" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 May 2024 04:48:25 -0700 X-CSE-ConnectionGUID: scpR5HixSqeqjbottg9csQ== X-CSE-MsgGUID: eZuJw8qFS+O+1ievO/CZQg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,174,1712646000"; d="scan'208";a="37268614" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orviesa003.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 20 May 2024 04:48:24 -0700 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.39; Mon, 20 May 2024 04:48:24 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) 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.39 via Frontend Transport; Mon, 20 May 2024 04:48:24 -0700 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (104.47.74.40) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Mon, 20 May 2024 04:48:24 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KmfWdOE4HEXjg188U2wyAyiR7hU1xJyNnYmO+VGpcq70S7EYdd+TH8GITWGnBxePqpUOcL3ll4Pn1YQXWgUVAgQufONUUvdRZckRItVdSP94ymg+S9Scob3xD+kFp0LnlUk8dAHXZC9ZDC7HVnnGVk07SfNT4zhSrjAmok5GuXG9tgA9zSlFdjAtxNyVYWhfjEPPM2hoaToEfcl8q7AzKyGPbgvGCe1ZJqiE9IE4IpqOklJTt5f1JqWMJRz+IzF3++0oGHmBd6Z8dBClYHEc/WI8kuEqOdrfI/v25TzifamQVxS18yGjOIIO3EwNYNwTscEmdJBCHjPyWewcK7LKxw== 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=YyTk3SEl27keA0zPqEW+1+2Soz5MiN2CU2Us/eQGVzY=; b=EvcpCro1yMXqHjfc8x8KSRnqEbNqjmLtM+/utjhvbo3oggm+NSp3LKY/P0PjeXJoYBWObrh3AOWAONfO4IKlWMKl43gFtBGgB4BCoY4tGl7fJ+l7IUDOZzI9XtSdd/A7/LniSCeA69frcGai+KhXCu/0Ke6Y2QAFy/1sT9qZDKXBed7RI0CLArbxPlZbA1md1hBfbygSiIimcUT+M9wjMMM7nj6HIdQQ52noMsD7z703rk7as8Zk36GrmHQj7rh8MJ+mZb0rKlPXNnGxMargH0vqDmwokkxatoiXSrL3EFQjpWji6zmX5C25t3ZmMsBeSm03cbi703el0qGcKkwT3A== 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 CH3PR11MB7322.namprd11.prod.outlook.com (2603:10b6:610:14a::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.35; Mon, 20 May 2024 11:48:21 +0000 Received: from MW5PR11MB5908.namprd11.prod.outlook.com ([fe80::aaa8:bc22:5fb0:5ed0]) by MW5PR11MB5908.namprd11.prod.outlook.com ([fe80::aaa8:bc22:5fb0:5ed0%5]) with mapi id 15.20.7587.030; Mon, 20 May 2024 11:48:21 +0000 From: "Li, Pan2" To: Tamar Christina , "gcc-patches@gcc.gnu.org" CC: "juzhe.zhong@rivai.ai" , "kito.cheng@gmail.com" , "richard.guenther@gmail.com" Subject: RE: [PATCH v1] Match: Extract integer_types_ternary_match helper to avoid code dup [NFC] Thread-Topic: [PATCH v1] Match: Extract integer_types_ternary_match helper to avoid code dup [NFC] Thread-Index: AQHaqaNqv0QxUdjh4EWWmABikJwcQrGf/BSAgAAFVJA= Date: Mon, 20 May 2024 11:48:21 +0000 Message-ID: References: <20240519041651.1743716-1-pan2.li@intel.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_|CH3PR11MB7322:EE_ x-ms-office365-filtering-correlation-id: 800eefb0-b4aa-49d4-4ce6-08dc78c2bfeb x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230031|1800799015|376005|366007|38070700009; x-microsoft-antispam-message-info: =?us-ascii?Q?8Ph8YutLTkVzDg6Zev9FCbiZVWB43erloLO/hFTxvwnGkVpwVLskGJf/Zhls?= =?us-ascii?Q?zBmf6IjJRCgWjicquCUEqkJql90QuMcjWe4JMjaRIY388HJsFc9O18F+3srq?= =?us-ascii?Q?zW5Z7RALhCkJ/WCn7V++1AfCU58ln6p3K6EQTPMcg2nqYZN2hSUwx/O0eDFi?= =?us-ascii?Q?I1hJSQ8SiNhRTO6T1wICakK9B1eOMg3sAVoKvUJO6zHpZ36uVfMq3xMAQL2G?= =?us-ascii?Q?auQ6cMryzMagPhEeuh5sW4eTl8NUbNY9n4+m+BjvBPBZI1XFPUEHyfBN6d5K?= =?us-ascii?Q?e9/zGhLOKqdt0I/fdjNZENITVIXZc4dSbq/SVfbB/PGE+LGiWd6cR1qmYmCx?= =?us-ascii?Q?0IMVqZWy51U86pD79WskjZpDug+9A2GrYzRelO2Sugt32mo++vBlCr3PstWd?= =?us-ascii?Q?bwSGnZUZrVL9lwKcCB12HYeWP1xVo+nR1nn61Qt+njHWTyf+KN4db6tv5LVz?= =?us-ascii?Q?YeEcuN5nXtAEmSSeH1+IelouvNrUzpp7GbPjieweCDL4e/z7tXqLRZXs7SiE?= =?us-ascii?Q?fMuO/hWzI4fu9LtzoiodHmuX9sqOCmvSTLz7uHMd6cZdxxUVJKK8WEAvbCri?= =?us-ascii?Q?c3RZhI2iShNbuVLoHaxzoCnTesq6HFx3E+M5+ha55anSHAeximJfK/qmbsna?= =?us-ascii?Q?e35CZpQ/LPzEXR6hGrWN2FFI/ATor/qU3igYNRBnPvdTbPlirba+TaU0HpNW?= =?us-ascii?Q?YNgc7t9TVV6F+zrqs4s1LAo0/TY7lE9DEaG8WVxPppjs6x3LXnirnNgKK71G?= =?us-ascii?Q?uMduKCjeCJuKNCoLKFNEvlG2pPxTqbBwFj/3FfZRwfVoDbsPx4xoTAK4TYSB?= =?us-ascii?Q?C17b/SNuAj5xlSvrqgyKjmUwPSGfA32BpyDtb0dFJV/Zwu0bdnD/PBFziROX?= =?us-ascii?Q?9sVfmRTyRE9xYOOnHJxoVpF5o/Rpzmc8ZGHamhqwJpwdioLxYJaAW6rn8a9g?= =?us-ascii?Q?hRIcTpPUPGa6nbiXj5ARRatnrfqP0U2d2MRHoBBblQ6hEfCoENbVYtFx6/So?= =?us-ascii?Q?vZRzspO0ffMMRiQvA0Uyzs7/jqUwZCywLtiH4RzNtOla7Z/H+IXCwyiU7eIo?= =?us-ascii?Q?9RFHfI9bqWRrIhWXCVG47N/jg9zZqPfleWCCxpT0aDADcrGjz0Ch7S6PNzd5?= =?us-ascii?Q?h/c7vPdUMjutDjsd3dRpbKTu0tl1kHsQm1VBsuyIj+2ffGI9l5OX7ABu75km?= =?us-ascii?Q?cOl4ozWGFpFw6g9aIDU/CegbrQgsqk9IuFYWOVzLr7fXEOP8tO13SDEMIlhY?= =?us-ascii?Q?rc2niNPN8sUgRLhEWpDyZrmq9W6/3/0OxPIHRrU1irdH/n8td1uFpZzvK19X?= =?us-ascii?Q?+Xtxq74q93ymYeJ9vV2KfITtjdGP9SJr2icSlqV7xVHEPg=3D=3D?= 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)(1800799015)(376005)(366007)(38070700009);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?DSGim+XIBrqG58r4TnToXemSRFUZgzEnul+6Hw39hMXt4A0tuTPY+BXUfdOg?= =?us-ascii?Q?RnDkq3oKCJ1Tj3Ji6izoDeuysBxUu6sYk63ZF6X9oX0j5n6M5H6lE5AG58EC?= =?us-ascii?Q?ZCdpSwuIv20VlYe/BjphOLWYQ/o0Ng4SkUABhsRTPtSQ+3ba+zTJDmjoT+nV?= =?us-ascii?Q?XGF294sXKVlzgUBbi+dyvidybBdOiedFwgb87GCFKKch8maQpCZH90yMDQVl?= =?us-ascii?Q?bZr9HCfAqnkZmX7ph8/YlPLget3PfjTaSP18733bWnklxpizhTqaAG2zuhaT?= =?us-ascii?Q?paaUPVFA9fy0900UVmM7lmmN6w+KFMLxvMcGJe89ghisNOJaJFDJqt1ktnPo?= =?us-ascii?Q?bvU1Kj8kGmqYINZQ7ETnqKR2yzVqxat9xk7z8lpcfoiGXfOYRcl6f8DYnQ2H?= =?us-ascii?Q?9MvkYi7K/G6qAN7/jFcBWnbl8TULIzf1xcQ7yM6PqKVa3N9knpOogIBvNQei?= =?us-ascii?Q?Ir+TS0iCwhqSyyL78RbkGz9FVZJc+4FQTbR4u53vCogPxqBFbQb9HC6ns2q/?= =?us-ascii?Q?dl2ciY1vqI4C077C5QvI2HsnusmVbwlEpGYkr6fReSmX7WTKpgbxcQCnm1lC?= =?us-ascii?Q?o6SSQuyRERseyPloRdb4SRdyMZCNoEn5ralVyzl9ml3jdmEWfzt9LYWXgOVJ?= =?us-ascii?Q?MLzIK5Th7RDSZcObUKr9YZg/yoENnJHzk+2KWbrIYjYzFBz3fIuRByblmC9Q?= =?us-ascii?Q?5zgfuMEWmlWqFxRXNDonhfvR/BpHnBdDvmAMpsgpLCZbxmZfQO7OLII/alZH?= =?us-ascii?Q?45AtWQSpCRanR7LLOHm0lzxxf78XcBbsQAS2tHEInxrJZMpovX6/1s/t7gN6?= =?us-ascii?Q?QTISoZ72mGGdFuLLby0sbFSeaEyjYkvTOpJmTe4ZEMdA9A8jOFtXEAWwACA+?= =?us-ascii?Q?a9SuLkgAz0+BbxVCO5sYKzN0DofGPikhIa2gBOKrtAkWni7fkPGwXgtraSgj?= =?us-ascii?Q?OjqXTBtjFwq+NrpuGmJrL/R0MFvBFcjgmbZtHCEZ6TQLPe/YmSieW6zFh4X2?= =?us-ascii?Q?SpYQQ+R5moFv6rflxxHhwgLGahzVn263NFLLlR4sSpFZ3+M4oUbY7I5o6wGJ?= =?us-ascii?Q?BanRRg+cLUxJJjzV5g1JxeetzJuLjyAsCzlnqtGyRo6rx70EgQZgS9mbjKEY?= =?us-ascii?Q?zp7lg9uZNc6Zc6A3yQprEq5dNnNQKUMST9lwleS+F+zXZOBWv2urbmxCuUw0?= =?us-ascii?Q?Qs3dmW9Y1mfuk42GpbpF9Zz+UiyKShbD4OKdNhH+uuSRAyq0O1bmKSOE1Or1?= =?us-ascii?Q?G8VDJkP1kAaCHdo5sTe7kf7sBLs2Pgjb8nVIbRoMBiX7Y4aCt7J++Uww97oH?= =?us-ascii?Q?aY6GwN2STR6QMErvLxWEkyK8dyfpwSpdBE4ZrCMiiEsujt2ps7a4AjZRyQKt?= =?us-ascii?Q?yj+KX7vwXqn/qZISFPVfllrbEogz5bHRD6rTZfAMF+FAWco10RuFjNmZc7fO?= =?us-ascii?Q?b6ggC3ZusB7yY8qRve4MBZgV562wdQ2ioapwxUnqMCvvW80XXulEYWEHOpy6?= =?us-ascii?Q?PskF25BBAjWgp3vtvaVeylIqNK44ca7iG8DFYS41W84iRvVc3tHn5yfFfoQA?= =?us-ascii?Q?VAPDCgFO95HV9mAZvf8=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: 800eefb0-b4aa-49d4-4ce6-08dc78c2bfeb X-MS-Exchange-CrossTenant-originalarrivaltime: 20 May 2024 11:48:21.8057 (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: ckGhQjdbwKA2KCTZxBpVLAsGnN0U/JCnDYKsb3hNFkzDTE6wIulDbYutytgrlc3YoMMfTSCFiPIHBp3LKPd/pw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR11MB7322 X-OriginatorOrg: intel.com X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_NONE,SPF_NONE,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: > See e.g. bitmask_inv_cst_vector_p which is also defined in tree.h/tree.cc= . Aha, I tried this way first and consider that maybe it should be something = like types_match. Thus, sent the v1 for this, will go bitmask_inv_cst_vector_p in v3. Pan -----Original Message----- From: Tamar Christina =20 Sent: Monday, May 20, 2024 7:20 PM To: Li, Pan2 ; gcc-patches@gcc.gnu.org Cc: juzhe.zhong@rivai.ai; kito.cheng@gmail.com; richard.guenther@gmail.com Subject: RE: [PATCH v1] Match: Extract integer_types_ternary_match helper t= o avoid code dup [NFC] > -----Original Message----- > From: pan2.li@intel.com > Sent: Sunday, May 19, 2024 5:17 AM > To: gcc-patches@gcc.gnu.org > Cc: juzhe.zhong@rivai.ai; kito.cheng@gmail.com; Tamar Christina > ; richard.guenther@gmail.com; Pan Li > > Subject: [PATCH v1] Match: Extract integer_types_ternary_match helper to = avoid > code dup [NFC] >=20 > From: Pan Li >=20 > There are sorts of match pattern for SAT related cases, there will be > some duplicated code to check the dest, op_0, op_1 are same tree types. > Aka ternary tree type matches. Thus, extract one helper function to > do this and avoid match code duplication. >=20 > The below test suites are passed for this patch: > * The rv64gcv fully regression test. > * The x86 bootstrap test. > * The x86 regression test. >=20 > gcc/ChangeLog: >=20 > * generic-match-head.cc (integer_types_ternary_match): New helper > function to check tenary tree type matches or not. > * gimple-match-head.cc (integer_types_ternary_match): Ditto but > for match. > * match.pd: Leverage above helper function to avoid code dup. >=20 Nice cleanup! This function isn't part of the machinery of match.pd and is instead part o= f a pattern. For these things we usually put them in tree.h/tree.cc and declare them at = the top of match.pd in the "define_predicates" list. This will also allow you to get rid of the code duplication. In addition s= uch functions which return a true/false we consider predicates, and name them ending with= _p. See e.g. bitmask_inv_cst_vector_p which is also defined in tree.h/tree.cc. Cheers, Tamar > Signed-off-by: Pan Li > --- > gcc/generic-match-head.cc | 17 +++++++++++++++++ > gcc/gimple-match-head.cc | 17 +++++++++++++++++ > gcc/match.pd | 25 +++++-------------------- > 3 files changed, 39 insertions(+), 20 deletions(-) >=20 > diff --git a/gcc/generic-match-head.cc b/gcc/generic-match-head.cc > index 0d3f648fe8d..cdd48c7a5cc 100644 > --- a/gcc/generic-match-head.cc > +++ b/gcc/generic-match-head.cc > @@ -59,6 +59,23 @@ types_match (tree t1, tree t2) > return TYPE_MAIN_VARIANT (t1) =3D=3D TYPE_MAIN_VARIANT (t2); > } >=20 > +/* Routine to determine if the types T1, T2 and T3 are effectively > + the same integer type for GENERIC. If T1, T2 or T3 is not a type, > + the test applies to their TREE_TYPE. */ > + > +static inline bool > +integer_types_ternary_match (tree t1, tree t2, tree t3) > +{ > + t1 =3D TYPE_P (t1) ? t1 : TREE_TYPE (t1); > + t2 =3D TYPE_P (t2) ? t2 : TREE_TYPE (t2); > + t3 =3D TYPE_P (t3) ? t3 : TREE_TYPE (t3); > + > + if (!INTEGRAL_TYPE_P (t1) || !INTEGRAL_TYPE_P (t2) || !INTEGRAL_TYPE_P > (t3)) > + return false; > + > + return types_match (t1, t2) && types_match (t1, t3); > +} > + > /* Return if T has a single use. For GENERIC, we assume this is > always true. */ >=20 > diff --git a/gcc/gimple-match-head.cc b/gcc/gimple-match-head.cc > index 5f8a1a1ad8e..91f2e56b8ef 100644 > --- a/gcc/gimple-match-head.cc > +++ b/gcc/gimple-match-head.cc > @@ -79,6 +79,23 @@ types_match (tree t1, tree t2) > return types_compatible_p (t1, t2); > } >=20 > +/* Routine to determine if the types T1, T2 and T3 are effectively > + the same integer type for GIMPLE. If T1, T2 or T3 is not a type, > + the test applies to their TREE_TYPE. */ > + > +static inline bool > +integer_types_ternary_match (tree t1, tree t2, tree t3) > +{ > + t1 =3D TYPE_P (t1) ? t1 : TREE_TYPE (t1); > + t2 =3D TYPE_P (t2) ? t2 : TREE_TYPE (t2); > + t3 =3D TYPE_P (t3) ? t3 : TREE_TYPE (t3); > + > + if (!INTEGRAL_TYPE_P (t1) || !INTEGRAL_TYPE_P (t2) || !INTEGRAL_TYPE_P > (t3)) > + return false; > + > + return types_match (t1, t2) && types_match (t1, t3); > +} > + > /* Return if T has a single use. For GIMPLE, we also allow any > non-SSA_NAME (ie constants) and zero uses to cope with uses > that aren't linked up yet. */ > diff --git a/gcc/match.pd b/gcc/match.pd > index 0f9c34fa897..b291e34bbe4 100644 > --- a/gcc/match.pd > +++ b/gcc/match.pd > @@ -3046,38 +3046,23 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) > /* Unsigned Saturation Add */ > (match (usadd_left_part_1 @0 @1) > (plus:c @0 @1) > - (if (INTEGRAL_TYPE_P (type) > - && TYPE_UNSIGNED (TREE_TYPE (@0)) > - && types_match (type, TREE_TYPE (@0)) > - && types_match (type, TREE_TYPE (@1))))) > + (if (TYPE_UNSIGNED (type) && integer_types_ternary_match (type, @0, @1)= ))) >=20 > (match (usadd_left_part_2 @0 @1) > (realpart (IFN_ADD_OVERFLOW:c @0 @1)) > - (if (INTEGRAL_TYPE_P (type) > - && TYPE_UNSIGNED (TREE_TYPE (@0)) > - && types_match (type, TREE_TYPE (@0)) > - && types_match (type, TREE_TYPE (@1))))) > + (if (TYPE_UNSIGNED (type) && integer_types_ternary_match (type, @0, @1)= ))) >=20 > (match (usadd_right_part_1 @0 @1) > (negate (convert (lt (plus:c @0 @1) @0))) > - (if (INTEGRAL_TYPE_P (type) > - && TYPE_UNSIGNED (TREE_TYPE (@0)) > - && types_match (type, TREE_TYPE (@0)) > - && types_match (type, TREE_TYPE (@1))))) > + (if (TYPE_UNSIGNED (type) && integer_types_ternary_match (type, @0, @1)= ))) >=20 > (match (usadd_right_part_1 @0 @1) > (negate (convert (gt @0 (plus:c @0 @1)))) > - (if (INTEGRAL_TYPE_P (type) > - && TYPE_UNSIGNED (TREE_TYPE (@0)) > - && types_match (type, TREE_TYPE (@0)) > - && types_match (type, TREE_TYPE (@1))))) > + (if (TYPE_UNSIGNED (type) && integer_types_ternary_match (type, @0, @1)= ))) >=20 > (match (usadd_right_part_2 @0 @1) > (negate (convert (ne (imagpart (IFN_ADD_OVERFLOW:c @0 @1)) > integer_zerop))) > - (if (INTEGRAL_TYPE_P (type) > - && TYPE_UNSIGNED (TREE_TYPE (@0)) > - && types_match (type, TREE_TYPE (@0)) > - && types_match (type, TREE_TYPE (@1))))) > + (if (TYPE_UNSIGNED (type) && integer_types_ternary_match (type, @0, @1)= ))) >=20 > /* We cannot merge or overload usadd_left_part_1 and usadd_left_part_2 > because the sub part of left_part_2 cannot work with right_part_1. > -- > 2.34.1