From patchwork Fri Jun 3 08:30:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kyrill Tkachov X-Patchwork-Id: 629700 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 3rLck02jvjz9t88 for ; Fri, 3 Jun 2016 18:30:48 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=Fhx2FB78; dkim-atps=neutral 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:cc:subject:content-type; q=dns; s=default; b=k2OIM0K+7K9jiGFdmkwqDhan3+5FLRLk4XC/lVwNKfQ X1U7Bb5cXqJ+u/uhs1JfiVzVYXdBeWBwZD48gzbFjnWumAKMaM/pmGck7qBqqaSt kqE6URv38veh/I4aTIn7h123q0TySC6X4njdkyHAKWuNVEKa6MxQGMZjKl/CSNwM = 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:cc:subject:content-type; s=default; bh=12PKN77y5GnpYmRIsMLyZSBEJao=; b=Fhx2FB78uuHAp2cyP KrrfP82WjC3vaJLbgATAfjbd1onY9jpxj+Gz9BLXAvhfqNbWgr9KbnjVitvxLHqr LK0EtrX07jLOmT1U1LvV3oPzw3vi5fEOH01QkFDPkOjf0jBwNTuK2nhet2idWly/ 5/zVfnIvUhKpm5R483wzFM7Z/A= Received: (qmail 86075 invoked by alias); 3 Jun 2016 08:30:35 -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 84172 invoked by uid 89); 3 Jun 2016 08:30:28 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=BAYES_00, KAM_LAZY_DOMAIN_SECURITY, KAM_LOTSOFHASH, RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=refuses, H*MI:57514013, H*M:57514013, 2016-06-03 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, 03 Jun 2016 08:30:18 +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 5E17AF; Fri, 3 Jun 2016 01:30:44 -0700 (PDT) Received: from [10.2.206.43] (e100706-lin.cambridge.arm.com [10.2.206.43]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D03053F21A; Fri, 3 Jun 2016 01:30:12 -0700 (PDT) Message-ID: <57514013.3010608@foss.arm.com> Date: Fri, 03 Jun 2016 09:30:11 +0100 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 CC: Ramana Radhakrishnan , Richard Earnshaw Subject: [PATCH][ARM] Fix gcc.target/arm/builtin-bswap16-1.c Hi all, The test gcc.target/arm/builtin-bswap16-1.c refuses to compile when testing a toolchain configured with --with-mode=thumb --with-float=hard and an architecture that supports Thumb2. This is because the test explicitly sets the -march option to armv6 and we get an error complaining about Thumb1 used with the hard-float ABI. The proposed solution in this patch is to bump the architecture to armv6t2 so that it uses Thumb2 when -mthumb is used. But we don't want to lose Thumb1 test coverage. So this patch moves the actual C code into a separate .x file and includes it in two different tests, each testing Thumb1 or Thumb2. The new test passes and builtin-bswap16-1.c also now passes rather than complaining about the float ABI. Ok for trunk? Thanks, Kyrill 2016-06-03 Kyrylo Tkachov * gcc.target/arm/builtin-bswap16-1.c: Add -mfloat-abi=soft and -mthumb to dg-options. Include builtin-bswap16.x. * gcc.target/arm/builtin-bswap16: New file. * gcc.target/arm/builtin-bswap16-2.c: New test. diff --git a/gcc/testsuite/gcc.target/arm/builtin-bswap16-1.c b/gcc/testsuite/gcc.target/arm/builtin-bswap16-1.c index 6920f004eab42443441227029c579aeb2bb981ee..7c3f8370e132b4c41ad7b3dac973b552c4ddbfe1 100644 --- a/gcc/testsuite/gcc.target/arm/builtin-bswap16-1.c +++ b/gcc/testsuite/gcc.target/arm/builtin-bswap16-1.c @@ -1,15 +1,10 @@ /* { dg-do compile } */ -/* { dg-options "-O2" } */ +/* { dg-options "-O2 -mthumb -mfloat-abi=soft" } */ /* { dg-require-effective-target arm_arch_v6_ok } */ /* { dg-add-options arm_arch_v6 } */ -/* { dg-final { scan-assembler-not "orr\[ \t\]" } } */ -unsigned short swapu16_1 (unsigned short x) -{ - return (x << 8) | (x >> 8); -} +/* Test Thumb1 code generation when -mthumb is used. */ + +#include "builtin-bswap16.x" -unsigned short swapu16_2 (unsigned short x) -{ - return (x >> 8) | (x << 8); -} +/* { dg-final { scan-assembler-not "orr\[ \t\]" } } */ diff --git a/gcc/testsuite/gcc.target/arm/builtin-bswap16-2.c b/gcc/testsuite/gcc.target/arm/builtin-bswap16-2.c new file mode 100644 index 0000000000000000000000000000000000000000..a4927e3ab0ced7a272e5acb4a5c2bcb1b2badafc --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/builtin-bswap16-2.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +/* { dg-require-effective-target arm_arch_v6t2_ok } */ +/* { dg-add-options arm_arch_v6t2 } */ + +/* Test Thumb2 code generation when -mthumb is used. */ + +#include "builtin-bswap16.x" + +/* { dg-final { scan-assembler-not "orr\[ \t\]" } } */ + diff --git a/gcc/testsuite/gcc.target/arm/builtin-bswap16.x b/gcc/testsuite/gcc.target/arm/builtin-bswap16.x new file mode 100644 index 0000000000000000000000000000000000000000..1e7f41edf013e353944f0a4879a1248c8a8b2f11 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/builtin-bswap16.x @@ -0,0 +1,9 @@ +unsigned short swapu16_1 (unsigned short x) +{ + return (x << 8) | (x >> 8); +} + +unsigned short swapu16_2 (unsigned short x) +{ + return (x >> 8) | (x << 8); +}