From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 64319 invoked by alias); 24 Nov 2017 14:58:00 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 64297 invoked by uid 89); 24 Nov 2017 14:57:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.1 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KB_WAM_FROM_NAME_SINGLEWORD,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=sk:armv8_2, sk:sudida, sk:sudi.da, sudidasarmcom X-HELO: EUR01-VE1-obe.outbound.protection.outlook.com Received: from mail-ve1eur01on0049.outbound.protection.outlook.com (HELO EUR01-VE1-obe.outbound.protection.outlook.com) (104.47.1.49) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 24 Nov 2017 14:57:57 +0000 Received: from [10.2.206.246] (217.140.96.140) by DB5PR08MB1048.eurprd08.prod.outlook.com (2603:10a6:0:14::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.260.4; Fri, 24 Nov 2017 14:57:53 +0000 To: "gcc-patches@gcc.gnu.org" Cc: nd , kyrylo.tkachov@arm.com, Ramana Radhakrishnan , Richard Earnshaw From: Sudakshina Das Subject: [PATCH][ARM] Fix wrong code by arm_final_prescan with fp16 move instructions Message-ID: <4db1e5be-24b1-bab7-d351-b00ef5332728@arm.com> Date: Fri, 24 Nov 2017 15:44:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------C54047336CEE190682584A81" X-ClientProxiedBy: AM4PR05CA0014.eurprd05.prod.outlook.com (2603:10a6:205::27) To DB5PR08MB1048.eurprd08.prod.outlook.com (2603:10a6:0:14::21) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(48565401081)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603258)(49563074);SRVR:DB5PR08MB1048; X-Microsoft-Exchange-Diagnostics: 1;DB5PR08MB1048;3:aXYq0AEHAOYlGhLjQUBhSobkeG550w1cP/wwBXhy5bwydWfBlSra60OxNky3L9BNxM3B3PkGgsP9EAkTSBkxie71HE47dLcqIbzLb/F9BClWrSiJCxuLqmBYbJJhLLnH5CQjt9UHEdHqTujrNMRb6nmfX+7/D7KAv7Wc9igtoop+Oo263tfU2zhKlvLRqqPUfz45XT5j3aLRqAN3aE2lv5UZZGBbfYBJhLo6dVSSy9b/ZtnWndKYDz//ZRcoXN16;25:WidrtfzPs2bSFZK35scKYAlzDN883d3835/aVVWCJvm8t3us7I5BL3Eb0DoTxTYtSHG84iR4r49CvqP0T81F87n1thbfydgz7hUQvDcL93kjDzijR0TK99mrrMicyMP0PsfnETaJqhIhFSlEOJ4gdLHNCfGcpp4ImOrMxUnij8DQ8jHLbgNldplqu6cB3gvoI6U2kakGTuJC1wqVMDxH9yF5IqJ0rlP4ckd6ISCjv83sxbFSEbFFKvBQxgz2Xi5Ya1dvzD4LlJi7bTz169Cc1+xJ72YP4hqhZ9o++DWmTNZ+9xNVt3BMCMO+W5oQswS0OZYkXIRwCbGLcjzUeqGYvg==;31:aGkm0AygTml2ZTclFJZgRjKabMj0kwAtvOxhUVU5dlPUj+kK7MTqwHRkjOPpBmH+6+w1pd/vFt2Mz6wmsIDi8TNNC4naxVhBMMFyo74F0Ickt3UTzq5JrKb716cjwRVwndVj9sJwpIX38kxUKNSpPoAdUGKvcblHcKvtqShAkBNfdrEGHRF2UEAjARfN361BJDupZDyin92IZPLdpgyxx+8/LmyP8r3HXwNOlDksJbc= X-MS-TrafficTypeDiagnostic: DB5PR08MB1048: X-MS-Office365-Filtering-Correlation-Id: 2f67c78b-1de3-46cf-179e-08d5334bbd5f NoDisclaimer: True X-Microsoft-Exchange-Diagnostics: 1;DB5PR08MB1048;20:1jmH8fH4OtA8em3L+dLnqXGvpIYBdBPQwK9L4AJ9O7d8PiVS3fpAOLzAIILNFiGh4XWsDAcqvTOWTsNdySxrdu1ttkajtvRxdSc2g4EOqE54/M/O+UOqkT1FJAoxCmk4VtPC8ga+2bJv1WJfApKE4DdMXrp6qgsEY/W3Ey+mEWc=;4:N6E1lRN1BPFNxNjsJ+GcPrylV31eXbwzgKk4U3vEwxYP6DkZFdZvGj028WoBYuju/2MAWtZZ/qYBTsUZ945m0BOSxu5v+SaVznvp7ehXoAdsNvd4EcE1UibIu8tLtjIllRgKJDjOn3idd3+z4hbSeWcWgPK7HcK47nvqEuX1hl5bANxm8Cpv6lbgsBc7Kx7Sn1W//kU8lBOPaO1fJkh3wEla0LiF13wNvnfQOfusGFMRs9JOLaAjJx2hd4z3/614lkf/O6gQ1bGtCPpEYTeiUa0jt1Li6ihOiQVlDc6/oBw+TOfpKMNjFdG5G+hZZXg3 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(180628864354917); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(102415395)(6040450)(2401047)(5005006)(8121501046)(3002001)(3231022)(10201501046)(93006095)(93001095)(6055026)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123562025)(20161123558100)(20161123555025)(20161123560025)(6072148)(201708071742011);SRVR:DB5PR08MB1048;BCL:0;PCL:0;RULEID:(100000803101)(100110400095);SRVR:DB5PR08MB1048; X-Forefront-PRVS: 05015EB482 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6009001)(6049001)(366004)(39860400002)(376002)(346002)(189002)(377424004)(199003)(54534003)(105586002)(106356001)(270700001)(3846002)(6116002)(25786009)(2476003)(101416001)(4001150100001)(31686004)(5660300001)(50986999)(65826007)(2351001)(72206003)(478600001)(83506002)(33646002)(64126003)(189998001)(6916009)(54356999)(53936002)(5640700003)(568964002)(316002)(65956001)(81156014)(16526018)(8676002)(2906002)(2501003)(66066001)(5890100001)(4326008)(77096006)(6486002)(31696002)(36756003)(21490400003)(7736002)(97736004)(68736007)(86362001)(4610100001)(305945005)(16576012)(37036004)(52116002)(16586007)(58126008)(8936002)(65806001)(54906003)(84326002)(81166006);DIR:OUT;SFP:1101;SCL:1;SRVR:DB5PR08MB1048;H:[10.2.206.246];FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; Received-SPF: None (protection.outlook.com: arm.com does not designate permitted sender hosts) Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Sudi.Das@arm.com; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;DB5PR08MB1048;23:TgFbdr8c/rAJcvfdHzJ1UkfM4WFwUZXareAFMZbqQ?= =?us-ascii?Q?/uJeGnte/Lv3i0nOEml0HsroytKP+P6G3y5OWq+ZYX99puaprxFGrLL4fXEX?= =?us-ascii?Q?OG9r46x+h24Iqh55c2/DY08nWnI67lsNDqHfYj2mw2vQSkHACYvI6RpjOBUf?= =?us-ascii?Q?q3EY7nOI7vi0t1rZFql68wrFoYk0XTWivsuXkzlVsreyjPGW6cEW/6Wx4fha?= =?us-ascii?Q?oO20ct1fL2XsLqK+7Bm53QsQ/rl56rmlDF+R2B0OYVVLq5EHgTsiMa72BayR?= =?us-ascii?Q?NfhriJdbmH35zdNcyp2D+yy8YIxTQpRqCHIrdn7u7FIOyP7tm5LyDMRLPxla?= =?us-ascii?Q?YRNyCLNMrN17e2l/pNwXN7SZF62tfjngN0xY3RSOz9N9tEIlYMXOCJzed6Gn?= =?us-ascii?Q?wvIN7l/mzhEf/YCQa5ah3VMjSKLUCaVfba1EzRVUYjs859lx7Bn1TTYBSnsy?= =?us-asc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Ba9iasI4nbm/y7bZj3oeJcTaBQkdOpihZ7w5lzJ6o/liBpV44x2d/8q3Z5xZhjirRG5yBKERzk+NCMHysRLHbPwBwr0qkxnMUEz94cM07MVlRMSHx6NqvZOE SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Nov 2017 14:57:53.1263 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2f67c78b-1de3-46cf-179e-08d5334bbd5f X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5PR08MB1048 X-IsSubscribed: yes X-SW-Source: 2017-11/txt/msg02211.txt.bz2 This is a multi-part message in MIME format. --------------C54047336CEE190682584A81 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1225 Hi For the following test case: __fp16 test_select (__fp16 a, __fp16 b, __fp16 c) { return (a < b) ? b : c; } when compiled with -mfpu=fp-armv8 -march=armv8.2-a+fp16 -marm -mfloat-abi=hard trunk generates wrong code: test_select: @ args = 0, pretend = 0, frame = 0 @ frame_needed = 0, uses_anonymous_args = 0 @ link register save eliminated. vcvtb.f32.f16 s0, s0 vcvtb.f32.f16 s15, s1 vcmpe.f32 s0, s15 vmrs APSR_nzcv, FPSCR // <------ No conditional branch! vmov s1, s2 @ __fp16 .L2: vmov s0, s1 @ __fp16 bx lr There should have been a conditional branch there to skip one of the VMOVs. This patch fixes this problem by making *movhf_vfp_fp16 unconditional wherever needed. Testing done: Add a new test case and checked for regressions arm-none-linux-gnueabihf. Is this ok for trunk? Sudi ChangeLog entry are as follow: *** gcc/ChangeLog *** 2017-11-24 Sudakshina Das * config/arm/vfp.md (*movhf_vfp_fp16): Add conds attribute. *** gcc/testsuite/ChangeLog *** 2017-11-24 Sudakshina Das * gcc.target/arm/armv8_2-fp16-move-2.c: New test. --------------C54047336CEE190682584A81 Content-Type: text/x-patch; name="patch-7703.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="patch-7703.diff" Content-length: 1161 diff --git a/gcc/config/arm/vfp.md b/gcc/config/arm/vfp.md index 075a938..61b6477 100644 --- a/gcc/config/arm/vfp.md +++ b/gcc/config/arm/vfp.md @@ -410,7 +410,10 @@ gcc_unreachable (); } } - [(set_attr "predicable" "yes, yes, no, yes, no, no, no, no, no, no") + [(set_attr "conds" "*, *, unconditional, *, unconditional, unconditional,\ + unconditional, unconditional, unconditional,\ + unconditional") + (set_attr "predicable" "yes, yes, no, yes, no, no, no, no, no, no") (set_attr "predicable_short_it" "no, no, no, yes,\ no, no, no, no,\ no, no") diff --git a/gcc/testsuite/gcc.target/arm/armv8_2-fp16-move-2.c b/gcc/testsuite/gcc.target/arm/armv8_2-fp16-move-2.c new file mode 100644 index 0000000..fcb857f --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/armv8_2-fp16-move-2.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_v8_2a_fp16_scalar_ok } */ +/* { dg-options "-O2 -marm" } */ +/* { dg-add-options arm_v8_2a_fp16_scalar } */ + +__fp16 +test_select (__fp16 a, __fp16 b, __fp16 c) +{ + return (a < b) ? b : c; +} +/* { dg-final { scan-assembler "bmi" } } */ --------------C54047336CEE190682584A81--