From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00077.outbound.protection.outlook.com [40.107.0.77]) by sourceware.org (Postfix) with ESMTPS id 17BBF3858D37 for ; Thu, 6 Aug 2020 11:40:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 17BBF3858D37 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=Kyrylo.Tkachov@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=y8ldjIqLNBALrbzLKFPoS2/HXX7uZXh5nGp+pEe/6Es=; b=cL07O+5LAcIhthODsNrLk7P29PE92bdqj23iSAu/qp2q9iG9jh9/Q6Tg6jKSlER1XiUpiCv2Dy22yRVaCAb7VYnM8FY47uWteKB+cqWaJ4w09CyOWwVWMJKrKebr9L4OqizdZUg/navklKfWk+CacM6/16N9Mpo0KCG+sHv5p70= Received: from AM6P195CA0058.EURP195.PROD.OUTLOOK.COM (2603:10a6:209:87::35) by AM0PR08MB3009.eurprd08.prod.outlook.com (2603:10a6:208:66::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.19; Thu, 6 Aug 2020 11:40:54 +0000 Received: from AM5EUR03FT035.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:87:cafe::da) by AM6P195CA0058.outlook.office365.com (2603:10a6:209:87::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3239.19 via Frontend Transport; Thu, 6 Aug 2020 11:40:54 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; gcc.gnu.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;gcc.gnu.org; dmarc=bestguesspass 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; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT035.mail.protection.outlook.com (10.152.16.119) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.16 via Frontend Transport; Thu, 6 Aug 2020 11:40:53 +0000 Received: ("Tessian outbound 195a290eb161:v64"); Thu, 06 Aug 2020 11:40:53 +0000 X-CR-MTA-TID: 64aa7808 Received: from b49fb43af774.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id AE026504-2F09-4783-8154-9C3F1CD94972.1; Thu, 06 Aug 2020 11:40:48 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id b49fb43af774.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 06 Aug 2020 11:40:48 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=d/HrBwiMgIUUTO4EMN/DeQ3WnBnTFPaYIpWkBgMF9WlD2bAgveipBqFmcL4z6YgFenGD6GduU+Gx8SeLXFDFVst6S3IkfK/9dLiHJ1uVY+LC7rjJPvwuLa0OCq1kkXFc9n+KhYI+SuuFcMlRVRgMxlWOfWW/Ha17xo/LzS8ouBFliuLFn2Ri95fmH9idQfAE5i/at8qzi3xme2s6bvy1kmf3iTLN3hyPyhKIeMiYCdVVXyPhx/Bqs5ffh676F5QusK5HpzmLbxyLCUmAxLZxpEFFM5dvVFa2UwscwzlmPwEkA9LS80RSzKClaI64B7VuyillM1ALuaXeZF9ti8MbXQ== 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-SenderADCheck; bh=y8ldjIqLNBALrbzLKFPoS2/HXX7uZXh5nGp+pEe/6Es=; b=OdjmuW1R+qkIIEVucsbWER74MADTd4fGM9R/cFqsem971HX5Cwra+gMpt3uPE3OkKZFvBhVLPVAUGbRJputIHos3RGiY6T1ZOZs98BzihwNHq4yTlUZB8GFWty/VNThDUQIS+rAibfG3nyRSi5zy6UO8isymhwO5+aMfwpOuDeA/du0O6mvfqUNTKYfjJkmwt8jjzzQTVtlBNhF+OvAQCRJvA6/YG0n9PrSM27CgritCc8wGoKa2S+fEOnhCjNv0+LIXqUczsBjW5hhMJr4JwzWhWJWFhGaoJqbC3zolqp/9XpxWHz7n3N23o8cQmNSFLdxWwdSxggenfp7rVXeI1g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none 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=y8ldjIqLNBALrbzLKFPoS2/HXX7uZXh5nGp+pEe/6Es=; b=cL07O+5LAcIhthODsNrLk7P29PE92bdqj23iSAu/qp2q9iG9jh9/Q6Tg6jKSlER1XiUpiCv2Dy22yRVaCAb7VYnM8FY47uWteKB+cqWaJ4w09CyOWwVWMJKrKebr9L4OqizdZUg/navklKfWk+CacM6/16N9Mpo0KCG+sHv5p70= Received: from DB7PR08MB3002.eurprd08.prod.outlook.com (2603:10a6:5:20::25) by DB8PR08MB3948.eurprd08.prod.outlook.com (2603:10a6:10:a2::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3239.16; Thu, 6 Aug 2020 11:40:46 +0000 Received: from DB7PR08MB3002.eurprd08.prod.outlook.com ([fe80::5cd5:a4c8:f166:acf]) by DB7PR08MB3002.eurprd08.prod.outlook.com ([fe80::5cd5:a4c8:f166:acf%7]) with mapi id 15.20.3261.018; Thu, 6 Aug 2020 11:40:46 +0000 From: Kyrylo Tkachov To: Omar Tahir , "nickc@redhat.com" , Ramana Radhakrishnan , Richard Earnshaw , "gcc-patches@gcc.gnu.org" Subject: RE: [PATCH 3/5][Arm] New pattern for CSINC instructions Thread-Topic: [PATCH 3/5][Arm] New pattern for CSINC instructions Thread-Index: AdZqef4iUtYNV/e8SbuTpFz2jlc5DABbA3DQ Date: Thu, 6 Aug 2020 11:40:45 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: 52257297-6010-4e7a-afcf-a8fe278ef84e.0 x-checkrecipientchecked: true Authentication-Results-Original: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com; x-originating-ip: [80.5.218.175] x-ms-publictraffictype: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 7dabf413-60bf-4141-f051-08d839fd939a x-ms-traffictypediagnostic: DB8PR08MB3948:|AM0PR08MB3009: x-ld-processed: f34e5979-57d9-4aaa-ad4d-b122a662184d,ExtAddr x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:7219;OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: JuIHlcYUYgVekUMK3Z0roiGPlbN3Y967XdNbfx4sZTSM5mzuQYkmlYklEJMtnl7uNOJ9z/87PiI7VBmZX3kPJsj8hoA/ST6wCFF/3cpf4x6QqesLcoLoUuwpTi/N2Xrm9D/IA2nSVqrHUWtfDgc2jG4cUARP+vyNtLQ+AUJxvcAOcOU1w1G4ncu/KC+KFWK85uQNnXAyFcSFJr8jXwQhXEFr9GQV3N69QSuECF+g3VwILHdf5gXQSGSoxF9KFnOfbmPs3QO7UCEihVI052NKJl45coc/bWN7P96HDdMy3ZAC7T8wCu0y2rlwsPagUsYn X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB7PR08MB3002.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(396003)(39860400002)(346002)(366004)(136003)(376002)(316002)(53546011)(8936002)(186003)(2906002)(8676002)(110136005)(7696005)(6506007)(33656002)(26005)(71200400001)(478600001)(9686003)(66446008)(66946007)(66556008)(52536014)(5660300002)(66476007)(64756008)(55016002)(86362001)(76116006); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: dMEjP36Q0YP6AdwyUsUciqgeXXh/T7f9NyXZbOaebkX0eEp01RB1zmt7HhLaQY8ShwfRWHUM7IK6d6JCK/VGHY4VAs5Cpzf8dwpvmCzC7UOYTcsNehYM4uT1XBkiHHgG+rsMqfrgfg73YEsCPh9OSuOuWU7qGTQ+RSlrtjVxMS7Z4lqEGU6kUi3xUQaiVd1LjisQiz7QJxt6LSybeQ/d08rk4QshdkehI5fiKZ/caH3I3S4GcjekDURj3/+62FBL3GYvH7qJHHCe7QWjLt5NHSRTGhEGnH7irdbUYPRGkm4ctinOYORkwjKHw5J7fxkVNPwisrm8ayXVMAGbFVMh8qj1RZap6FxDx2KY8d+kH3Y7hyt7gsl8MdCedK7Cq/4b7n12algLRMpPKNbF1ep+ey5Fkh2esX822FyUuuTkt4oBS/BkJoytW7YO5qrVs6OQJXguREe+98+DN4d2Qt3634ezOwhaU2lBU6JXV9sGWndWWOYbMfiU/1+cqAGDSjCWRi+AvHK4iatfRlFfJZpzHVtmo7C+zUpHbgJElrDRcbBokPYSbCbuXbS7JwdQGNuU29LX2HKy+N8Fwn7SJlRiFyBB+b9GFdW2QID0PS2FUIsumycJd0hrh90QBeX8YYTBteljy2itb/6oIhv4cvqkZA== Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB3948 Original-Authentication-Results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT035.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: a18e9397-d771-4d22-5091-08d839fd8f0f X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gP89mOdAEpiVYzsqKS6vuqVxm+sQ5tiSYe4qOPAlv+CehVhnS22mmh/af/13H9/nsXGdpyBAlI8LS7nUcbm88YXBP6xrWbBvi1MvBk1Yf+fZIpD/Q7+o6NQud+maZcn4+PSzc0alnrs30w+VTlMSIZiOAD14qSQB2VcZ5i9cF/4gR5U4EviTQS+Lj3nPSixuYLu0Ly7MpbCpK3w/Ou389gcMGc4NSmjRIfmuo+/Cr64P7bsk0eZ4k6kGyYNrd5bv1nYBPLbTJlMfxpjFiR66f9T4MHdCgI8nhinqXMaYnOy/bjj2o8tSxAVVOxB0BUFeKCnv7eM+YgOhqyHElTwo4HZhIaszE2nNjxrmyPKZ04Lya6hSITBnZ+lAhUzq0A2qYM2KcaMY3wa5iOUN8ziK+Q== 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; SFTY:; SFS:(4636009)(376002)(136003)(39860400002)(346002)(396003)(46966005)(336012)(5660300002)(52536014)(356005)(82310400002)(8676002)(8936002)(186003)(70586007)(53546011)(47076004)(81166007)(26005)(55016002)(478600001)(316002)(6506007)(110136005)(2906002)(70206006)(36906005)(82740400003)(9686003)(33656002)(86362001)(7696005); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Aug 2020 11:40:53.8229 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7dabf413-60bf-4141-f051-08d839fd939a 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: AM5EUR03FT035.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3009 X-Spam-Status: No, score=-15.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Aug 2020 11:40:58 -0000 Hi Omar, From: Omar Tahir =20 Sent: 04 August 2020 17:13 To: Kyrylo Tkachov ; nickc@redhat.com; Ramana Radha= krishnan ; Richard Earnshaw ; gcc-patches@gcc.gnu.org Subject: [PATCH 3/5][Arm] New pattern for CSINC instructions This patch adds a new pattern, *thumb2_csinc, for generating CSINC instructions. It also modifies an existing pattern, *thumb2_cond_arith, to output CINC when the operation is an addition and TARGET_COND_ARITH is true= . Regression tested on arm-none-eabi. 2020-07-30: Sudakshina Das Omar Tahir * config/arm/thumb2.md (*thumb2_csinc): New. (*thumb2_cond_arith): Generate CINC where possible. gcc/testsuite/ChangeLog: 2020-07-30: Sudakshina Das Omar Tahir * gcc.target/arm/csinc-1.c: New test. diff --git a/gcc/config/arm/thumb2.md b/gcc/config/arm/thumb2.md index 0b00aef7ef7..79cf684e5cb 100644 --- a/gcc/config/arm/thumb2.md +++ b/gcc/config/arm/thumb2.md @@ -743,6 +743,9 @@ if (GET_CODE (operands[4]) =3D=3D LT && operands[3] =3D=3D const0_rtx) return \"%i5\\t%0, %1, %2, lsr #31\"; + if (GET_CODE (operands[5]) =3D=3D PLUS && TARGET_COND_ARITH) + return \"cinc\\t%0, %1, %d4\"; + output_asm_insn (\"cmp\\t%2, %3\", operands); Hmmm, this looks wrong. The pattern needs to perform the comparison (settin= g the CC reg) as well as do the conditional increment. Emitting a cinc without a cmp won't set the CC flags. Also, cinc increments only by 1, whereas the "arm_rhs_operand" predicate ac= cepts a wider variety of immediates, so just checking for GET_CODE (operand= s[5]) =3D=3D PLUS isn't enough. Thanks, Kyrill if (GET_CODE (operands[5]) =3D=3D AND) { @@ -952,6 +955,21 @@ (set_attr "predicable" "no")] ) +(define_insn "*thumb2_csinc" + [(set (match_operand:SI 0 "arm_general_register_operand" "=3Dr, r") + (if_then_else:SI + (match_operand 1 "arm_comparison_operation" "") + (plus:SI (match_operand:SI 2 "arm_general_register_operand" "r, r") + (const_int 1)) + (match_operand:SI 3 "reg_or_zero_operand" "r, Z")))] + "TARGET_COND_ARITH" + "@ + csinc\\t%0, %3, %2, %D1 + csinc\\t%0, zr, %2, %D1" + [(set_attr "type" "csel") + (set_attr "predicable" "no")] +) + (define_insn "*thumb2_movcond" [(set (match_operand:SI 0 "s_register_operand" "=3DTs,Ts,Ts") (if_then_else:SI diff --git a/gcc/testsuite/gcc.target/arm/csinc-1.c b/gcc/testsuite/gcc.tar= get/arm/csinc-1.c new file mode 100644 index 00000000000..b9928493862 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/csinc-1.c @@ -0,0 +1,23 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_arch_v8_1m_main_ok } */ +/* { dg-options "-O2 -march=3Darmv8.1-m.main" } */ + +int +test_csinc32_condasn1(int w0, int w1, int w2, int w3) +{ + int w4; + + /* { dg-final { scan-assembler "csinc\tr\[0-9\]*.*ne" } } */ + w4 =3D (w0 =3D=3D w1) ? (w2 + 1) : w3; + return w4; +} + +int +test_csinc32_condasn2(int w0, int w1, int w2, int w3) +{ + int w4; + + /* { dg-final { scan-assembler "csinc\tr\[0-9\]*.*eq" } } */ + w4 =3D (w0 =3D=3D w1) ? w3 : (w2 + 1); + return w4; +}