From patchwork Mon Feb 17 17:03:56 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Clifton X-Patchwork-Id: 321065 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 ABCE62C00D1 for ; Tue, 18 Feb 2014 04:08:12 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; q=dns; s= default; b=eyQYHDaVx79572ywyNCtjG/eOnoNNWpFV+cLh9+JlbDRQ648nttVL K5+l4pdI3bW6RozsTDGOuDmWOzbAMYbnOZkw3xBV/hWD0PoQ/AzdPZAR7NgHO6KP 9pD/8PUUSb0gy8c1krKKPzw4DdbXIQXxr/E3+3A5IAy7IXA0CjlCZs= 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:from :to:subject:date:message-id:mime-version:content-type; s= default; bh=eYqS1/ebUBZJ2zPJTB8+RL5NfpM=; b=QS6wizLaFsId+9VEqSMZ vd4Q5BBpsX616RGecPxoY4lLu3Op/TUslR4veKHxbWRm+xg0Co3Ba0rzPrjcsd/a PjhQqTnqIX4KaKHvskPgDwvKFjmVNJRRUOmHg0A1oI8Z34ng0OUIrmuVIVDoxzcL cNqyU8sNGfZ76CRMHpq+DAw= Received: (qmail 21809 invoked by alias); 17 Feb 2014 17:08:05 -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 21794 invoked by uid 89); 17 Feb 2014 17:08:04 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.2 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 17 Feb 2014 17:08:03 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s1HH81LL027695 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 17 Feb 2014 12:08:01 -0500 Received: from Cadeux.redhat.com (vpn1-7-30.ams2.redhat.com [10.36.7.30]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s1HH7v7G012925 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO) for ; Mon, 17 Feb 2014 12:07:59 -0500 From: Nick Clifton To: gcc-patches@gcc.gnu.org Subject: RFA: Fix some gcc tests for 16-bit targets Date: Mon, 17 Feb 2014 17:03:56 +0000 Message-ID: <8738jhvfgj.fsf@redhat.com> MIME-Version: 1.0 X-IsSubscribed: yes Hi Guys, There are several tests in the gcc testsuite which implicitly assume a 32-bit (or larger) target. The patch below provides fixes for these tests in a variety of different ways. Where possible I have tried to recode the test so that it will compile on a 16-bit target, but in a couple of cases the test itself is too big, and so I have added a requirement on a 32-bit+ target. Tested with no regressions on an i686-pc-linux-gnu and an x86_64-pc-linux-gnu toolchain, and with reduction in the number of unexpected failures for rl78-elf, rx-elf and msp430-elf toolchains. OK to apply ? Cheers Nick gcc/testsuite/ChangeLog 2014-02-17 Nick Clifton * gcc.dg/c-torture/execute/pr43220.c: Use a long integer to count the iterations. * gcc.c-torture/execute/pr58570.c: Use a long integer to hold a 29-bit bitfield. * gcc.c-torture/unsorted/DFcmp.c: Use smaller arrays on 16-bit targets. * gcc.c-torture/unsorted/SFset.c: Likewise. * gcc.dg/graphite/pr46966.c: Require a 32-bit plus target - it is too big for smaller targets. * gcc.dg/pr23623.c: Use a long integer to hold 31-bit bitfields. * gcc.dg/pr48784-1.c: Use a long integer to hold a 28-bit bitfield. * gcc.dg/pr48784-2.c: Likewise. * gcc.dg/pr56997-2.c: Use a long integer as the test_type on 16-bit targets. * gcc.dg/pr59471.c: Use a long integer as the 32-bit vector type on 16-bit targets. * gcc.dg/sms-6.c: Use a long integer as the array_type on 16-bit targets. * gcc.dg/torture/vec-cvt-1.c: Require a 32-bit plus target - it is too big for smaller targets. Index: gcc/testsuite/gcc.c-torture/execute/pr43220.c =================================================================== --- gcc/testsuite/gcc.c-torture/execute/pr43220.c (revision 207817) +++ gcc/testsuite/gcc.c-torture/execute/pr43220.c (working copy) @@ -3,7 +3,7 @@ int main (void) { - int n = 0; + long int n = 0; lab:; { int x[n % 1000 + 1]; Index: gcc/testsuite/gcc.c-torture/execute/pr58570.c =================================================================== --- gcc/testsuite/gcc.c-torture/execute/pr58570.c (revision 207817) +++ gcc/testsuite/gcc.c-torture/execute/pr58570.c (working copy) @@ -2,7 +2,7 @@ struct S { int f0:15; - int f1:29; + long int f1:29; }; int e = 1, i; Index: gcc/testsuite/gcc.c-torture/unsorted/DFcmp.c =================================================================== --- gcc/testsuite/gcc.c-torture/unsorted/DFcmp.c (revision 207817) +++ gcc/testsuite/gcc.c-torture/unsorted/DFcmp.c (working copy) @@ -22,6 +22,17 @@ #define adrx1 (E1[x1]) #define regx1 (p1[x1]) +#if __SIZEOF_INT__ <= 2 +#undef E0 +#define E0 ((type *)10000) +#undef adrreg0 +#define adrreg0 (p0[10000]) +#undef E1 +#define E1 ((type *)(1111 & ~(__alignof__ (type) - 1))) +#undef adrreg1 +#define adrreg1 (p1[1111/4]) +#endif + reg0reg1 (r0, r1, x0, x1, p0, p1) type r0, r1; type *p0, *p1; {if (reg0 <= reg1) return 1; else return 0;} Index: gcc/testsuite/gcc.c-torture/unsorted/SFset.c =================================================================== --- gcc/testsuite/gcc.c-torture/unsorted/SFset.c (revision 207817) +++ gcc/testsuite/gcc.c-torture/unsorted/SFset.c (working copy) @@ -18,6 +18,17 @@ #define adrx1 (E1[x1]) #define regx1 (p1[x1]) +#if __SIZEOF_INT__ <= 2 +#undef E0 +#define E0 ((type *)10000) +#undef adrreg0 +#define adrreg0 (p0[10000]) +#undef E1 +#define E1 ((type *)(1111 & ~(__alignof__ (type) - 1))) +#undef adrreg1 +#define adrreg1 (p1[1111/4]) +#endif + int glob0, glob1; #define type float Index: gcc/testsuite/gcc.dg/graphite/pr46966.c =================================================================== --- gcc/testsuite/gcc.dg/graphite/pr46966.c (revision 207817) +++ gcc/testsuite/gcc.dg/graphite/pr46966.c (working copy) @@ -1,5 +1,7 @@ /* PR tree-optimization/46966 */ /* { dg-do compile } */ +/* This test is too big for small targets. */ +/* { dg-require-effective-target size32plus } */ /* { dg-options "-O -floop-interchange -ffast-math -fno-tree-copy-prop -fno-tree-loop-im" } */ int a[1000][1000]; Index: gcc/testsuite/gcc.dg/pr23623.c =================================================================== --- gcc/testsuite/gcc.dg/pr23623.c (revision 207817) +++ gcc/testsuite/gcc.dg/pr23623.c (working copy) @@ -8,19 +8,19 @@ extern struct { unsigned int b : 1; - unsigned int : 31; + unsigned long int : 31; } bf1; extern volatile struct { unsigned int b : 1; - unsigned int : 31; + unsigned long int : 31; } bf2; extern struct { volatile unsigned int b : 1; - volatile unsigned int : 31; + volatile unsigned long int : 31; } bf3; void writeb(void) @@ -45,4 +45,3 @@ variable, we need to give a count of 12 instead of 6 here. */ /* { dg-final { scan-rtl-dump-times "mem/v(/.)*:SI" 12 "final" } } */ /* { dg-final { cleanup-rtl-dump "final" } } */ - Index: gcc/testsuite/gcc.dg/pr48784-1.c =================================================================== --- gcc/testsuite/gcc.dg/pr48784-1.c (revision 207817) +++ gcc/testsuite/gcc.dg/pr48784-1.c (working copy) @@ -6,13 +6,13 @@ #pragma pack(1) volatile struct S0 { signed a : 7; - unsigned b : 28; /* b can't be fetched with an aligned 32-bit access, */ + unsigned long b : 28; /* b can't be fetched with an aligned 32-bit access, */ /* but it certainly can be fetched with an unaligned access */ -} g = {0,0xfffffff}; +} g = {0,0xfffffffUL}; int main() { - unsigned b = g.b; - if (b != 0xfffffff) + unsigned long b = g.b; + if (b != 0xfffffffUL) abort (); return 0; } Index: gcc/testsuite/gcc.dg/pr48784-2.c =================================================================== --- gcc/testsuite/gcc.dg/pr48784-2.c (revision 207817) +++ gcc/testsuite/gcc.dg/pr48784-2.c (working copy) @@ -6,13 +6,13 @@ #pragma pack(1) volatile struct S0 { signed a : 7; - unsigned b : 28; /* b can't be fetched with an aligned 32-bit access, */ + unsigned long b : 28; /* b can't be fetched with an aligned 32-bit access, */ /* but it certainly can be fetched with an unaligned access */ -} g = {0,0xfffffff}; +} g = {0,0xfffffffUL}; int main() { - unsigned b = g.b; - if (b != 0xfffffff) + unsigned long b = g.b; + if (b != 0xfffffffUL) abort (); return 0; } Index: gcc/testsuite/gcc.dg/pr56997-2.c =================================================================== --- gcc/testsuite/gcc.dg/pr56997-2.c (revision 207817) +++ gcc/testsuite/gcc.dg/pr56997-2.c (working copy) @@ -4,8 +4,13 @@ extern void abort (void); +#if __SIZEOF_INT__ <= 2 +#define test_type unsigned long +#define MAGIC 0x1020304ul +#else #define test_type unsigned int #define MAGIC 0x1020304u +#endif typedef struct s{ unsigned char Prefix; Index: gcc/testsuite/gcc.dg/pr59471.c =================================================================== --- gcc/testsuite/gcc.dg/pr59471.c (revision 207817) +++ gcc/testsuite/gcc.dg/pr59471.c (working copy) @@ -6,8 +6,13 @@ typedef unsigned short uint16x8_t __attribute__ ((__vector_size__ (16))); +#if __SIZEOF_INT__ <= 2 +typedef unsigned long int uint32x4_t +__attribute__ ((__vector_size__ (16))); +#else typedef unsigned int uint32x4_t __attribute__ ((__vector_size__ (16))); +#endif void foo (uint16x8_t *x, uint8x4_t *y) Index: gcc/testsuite/gcc.dg/sms-6.c =================================================================== --- gcc/testsuite/gcc.dg/sms-6.c (revision 207817) +++ gcc/testsuite/gcc.dg/sms-6.c (working copy) @@ -2,10 +2,16 @@ /* { dg-options "-O2 -fmodulo-sched -fdump-rtl-sms --param sms-min-sc=1" } */ /* { dg-options "-O2 -fmodulo-sched -fdump-rtl-sms --param sms-min-sc=1 -fmodulo-sched-allow-regmoves" { target powerpc*-*-* } } */ +#if (__SIZEOF_INT__ <= 2) +typedef long int array_type; +#else +typedef int array_type; +#endif + extern void abort (void); __attribute__ ((noinline)) -void foo (int * __restrict__ a, int * __restrict__ b, int * __restrict__ c) +void foo (array_type * __restrict__ a, array_type * __restrict__ b, array_type * __restrict__ c) { int i; for(i = 0; i < 100; i+=4) @@ -17,16 +23,13 @@ } } +array_type a[100], b[100], c[100]; -int a[100], b[100], c[100]; int main() { -#if (__SIZEOF_INT__ <= 2) int i; - long res; -#else - int i, res; -#endif + array_type res; + for(i = 0; i < 100; i++) { b[i] = c[i] = i; @@ -47,4 +50,3 @@ /* { dg-final { scan-rtl-dump-times "SMS succeeded" 1 "sms" { target spu-*-* } } } */ /* { dg-final { scan-rtl-dump-times "SMS succeeded" 3 "sms" { target powerpc*-*-* } } } */ /* { dg-final { cleanup-rtl-dump "sms" } } */ - Index: gcc/testsuite/gcc.dg/torture/vec-cvt-1.c =================================================================== --- gcc/testsuite/gcc.dg/torture/vec-cvt-1.c (revision 207817) +++ gcc/testsuite/gcc.dg/torture/vec-cvt-1.c (working copy) @@ -1,4 +1,6 @@ /* { dg-do run } */ +/* This test is too big for small targets. */ +/* { dg-require-effective-target size32plus } */ #include