From patchwork Fri Jan 19 10:39:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kyrill Tkachov X-Patchwork-Id: 863462 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-471648-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="OTdtN17c"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zNHPm0dbNz9s7h for ; Fri, 19 Jan 2018 21:39:22 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=HVsJSBV674cIvE5aiBbYC4xZVfsCBO7IhHRZwtneLwV9Vg JxPyoqt81P8jf2wi1T6/R1p/wmlRjMTIICVo7K2Xku9o1jpo1UGzTcf8SlB2wBGi gGWuwZjFy0x3nEdkt8/Wrrz6OcH3xCQwkS3dvpL8AyYdUcJm55pHNExjwgSuA= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; s= default; bh=P/heq+NY8TyP8GQeLzTYG6AwwDQ=; b=OTdtN17cX+vhrN30eEue Jmsi/hrWNkCA5VS0Jl0jAQ8ZdnT2Sp8tgtxcc3yEfKVuRmO48t7/r3B7AMkl9n3Z C4EKzhE9EXD+QWYLW+D2ji5JuN1IvhRayZU1osXlx8mw2K+czkDGwLfxk/GTvJBg mC5wQH/oHNqnjo7DKFbXNDU= Received: (qmail 89365 invoked by alias); 19 Jan 2018 10:39:15 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 89356 invoked by uid 89); 19 Jan 2018 10:39:13 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.7 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, KAM_LOTSOFHASH, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 19 Jan 2018 10:39:12 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 20CB480D for ; Fri, 19 Jan 2018 02:39:11 -0800 (PST) Received: from [10.2.207.77] (e100706-lin.cambridge.arm.com [10.2.207.77]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C1FE53F41F for ; Fri, 19 Jan 2018 02:39:10 -0800 (PST) Message-ID: <5A61CACD.20509@foss.arm.com> Date: Fri, 19 Jan 2018 10:39:09 +0000 From: Kyrill Tkachov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" Subject: [PATCH][arm] Fix gcc.target/arm/negdi-[12].c Hi all, These tests are failing for a silly reason. They scan for an occurrence of the NEGS instruction. NEGS (and NEG in general) is a pre-UAL alias of RSB with an immediate of 0 and we only emit it in one pattern: *thumb2_negsi2_short in thumb2.md. In all other instances of negation we emit the modern RSB mnemonic. This causes needless differences in assembly output. For example, for these testcases we emit NEG when compiling for -march=armv7-a, but for armv7ve we emit RSB, causing the scan-assembler tests to fail. This patch updates the *thumb2_negsi2_short pattern to use the RSB mnemonic and fixes the flaky scan-assembler directives. These tests now pass for my compiler configured with: --with-cpu=cortex-a15 --with-fpu=neon-vfpv4 --with-float=hard --with-mode=thumb Bootstrapped and tested on arm-none-linux-gnueabihf as well. Committing to trunk. Thanks, Kyrill 2018-01-19 Kyrylo Tkachov * config/arm/thumb2.md (*thumb2_negsi2_short): Use RSB mnemonic instead of NEG. 2018-01-19 Kyrylo Tkachov * gcc.target/arm/negdi-1.c: Remove bogus assembler scan for negs. * gcc.target/arm/negdi-2.c: Likewise. * gcc.target/arm/thumb-16bit-ops.c: Replace scan for NEGS with RSBS. diff --git a/gcc/config/arm/thumb2.md b/gcc/config/arm/thumb2.md index e2e2298957a4b1790008a59d5e6cf9092ad2b00f..8eb20003ab2f6df847d9344ea78e0175ce6dd902 100644 --- a/gcc/config/arm/thumb2.md +++ b/gcc/config/arm/thumb2.md @@ -1420,7 +1420,7 @@ (define_insn "*thumb2_negsi2_short" (neg:SI (match_operand:SI 1 "low_register_operand" "l"))) (clobber (reg:CC CC_REGNUM))] "TARGET_THUMB2 && reload_completed" - "neg%!\t%0, %1" + "rsb%!\t%0, %1, #0" [(set_attr "predicable" "yes") (set_attr "length" "2") (set_attr "type" "alu_sreg")] diff --git a/gcc/testsuite/gcc.target/arm/negdi-1.c b/gcc/testsuite/gcc.target/arm/negdi-1.c index c9bef049c4a467288e90c96abe1a34e2d1e028fc..efa49ad62800378ba3ee810931680c159479c7b9 100644 --- a/gcc/testsuite/gcc.target/arm/negdi-1.c +++ b/gcc/testsuite/gcc.target/arm/negdi-1.c @@ -12,6 +12,5 @@ Expected output: rsb r0, r0, #0 mov r1, r0, asr #31 */ -/* { dg-final { scan-assembler-times "rsb" 1 { target { arm_nothumb } } } } */ -/* { dg-final { scan-assembler-times "negs\\t" 1 { target { ! { arm_nothumb } } } } } */ +/* { dg-final { scan-assembler-times "rsbs?\\t...?, ...?, #0" 1 } } */ /* { dg-final { scan-assembler-times "asr" 1 } } */ diff --git a/gcc/testsuite/gcc.target/arm/negdi-2.c b/gcc/testsuite/gcc.target/arm/negdi-2.c index 4444c20ea9c010e7f5de67a953730efa680146b3..38dffeddd54c14d64c39b35992bbb7225efbeb7f 100644 --- a/gcc/testsuite/gcc.target/arm/negdi-2.c +++ b/gcc/testsuite/gcc.target/arm/negdi-2.c @@ -11,6 +11,5 @@ Expected output: rsb r0, r0, #0 mov r1, #0 */ -/* { dg-final { scan-assembler-times "rsb\\t...?, ...?, #0" 1 { target { arm_nothumb } } } } */ -/* { dg-final { scan-assembler-times "negs\\t...?, ...?" 1 { target { ! arm_nothumb } } } } */ +/* { dg-final { scan-assembler-times "rsbs?\\t...?, ...?, #0" 1 } } */ /* { dg-final { scan-assembler-times "mov" 1 } } */ diff --git a/gcc/testsuite/gcc.target/arm/thumb-16bit-ops.c b/gcc/testsuite/gcc.target/arm/thumb-16bit-ops.c index 90407eb6872efe9c545c5945de17a2eead91eead..9f4f659b35c062c9c576e9bb2d6aae74f91f6a86 100644 --- a/gcc/testsuite/gcc.target/arm/thumb-16bit-ops.c +++ b/gcc/testsuite/gcc.target/arm/thumb-16bit-ops.c @@ -200,4 +200,4 @@ s (int a, int b) return -b; } -/* { dg-final { scan-assembler "negs r0, r1" } } */ +/* { dg-final { scan-assembler "rsbs r0, r1, #0" } } */