From patchwork Thu Sep 5 19:18:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joern Rennecke X-Patchwork-Id: 272942 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 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "www.sourceware.org", Issuer "StartCom Class 1 Primary Intermediate Server CA" (not verified)) by ozlabs.org (Postfix) with ESMTPS id B1B0C2C00EC for ; Fri, 6 Sep 2013 05:18:48 +1000 (EST) 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:to:subject:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=edH252E6p5NsW7ZX 6OT30Z3a7FbZhv2WnOHawujGibVWcy6NvgbljYs/XblkP63JcOI/MiCPu6Y2+wa0 lUqZNpQq9wySTZCeXhnU/ehBoHnLUBzR0G+45IauTiCyKz6ClWYBuKn5ASjPeKBm A3Hkmf/F2VL1FEbRuUVhXZhs+r0= 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:to:subject:mime-version:content-type :content-transfer-encoding; s=default; bh=uqzGkF6/xR3PRsOn+iPGyI U/Bt4=; b=j9T22rbvVe1/uFkEHJFPuSVMbdOJkbyp/0pHWqTjxZFuJpyqA1XofD 6wdWzjFp7J7m4oK/JdidgkMbDr34thZcn4CEahoJVMtZtw89QTkXriVXzfngt4xh SJd2whh/LhGES1f+JGDcVmtKLnrbWHyM9fkKez/s6pEJa30zb6M88= Received: (qmail 13142 invoked by alias); 5 Sep 2013 19:18:41 -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 13131 invoked by uid 89); 5 Sep 2013 19:18:41 -0000 Received: from c62.cesmail.net (HELO c62.cesmail.net) (216.154.195.54) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Thu, 05 Sep 2013 19:18:41 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.2 required=5.0 tests=AWL, BAYES_50, FSL_HELO_NON_FQDN_1, RDNS_NONE autolearn=no version=3.3.2 X-HELO: c62.cesmail.net Received: from unknown (HELO epsilon2) ([192.168.1.60]) by c62.cesmail.net with ESMTP; 05 Sep 2013 15:18:37 -0400 Received: from cust213-dsl91-135-11.idnet.net (cust213-dsl91-135-11.idnet.net [91.135.11.213]) by webmail.spamcop.net (Horde MIME library) with HTTP; Thu, 05 Sep 2013 15:18:37 -0400 Message-ID: <20130905151837.vo0fm3sj4ook8k0o-nzlynne@webmail.spamcop.net> Date: Thu, 05 Sep 2013 15:18:37 -0400 From: Joern Rennecke To: gcc-patches@gcc.gnu.org Subject: Ping^5/update: contribute Synopsys Designware ARC port (7/7): testsuite MIME-Version: 1.0 User-Agent: Internet Messaging Program (IMP) H3 (4.1.4) OK to apply? FWIW, my colleague Simon Cook is currently working on adding more target option / builtin tests. 2013-08-31 Joern Rennecke Vineet Gupta * gcc.c-torture/execute/20101011-1.c [__arc__] (DO_TEST): Define as 0. * testsuite/gcc.target/arc: New directory. * gcc.dg/torture/pr37868.c: Also skip for arc*-*-*. * gcc.dg/stack-usage-1.c [__arc__] (SIZE): Define. * testsuite/gcc.dg/torture/stackalign/builtin-apply-2.c [__arc__] (STACK_ARGUMENTS_SIZE): Set to 0. * testsuite/gcc.dg/builtin-apply2.c [__arc__] (STACK_ARGUMENTS_SIZE): Set to 0. diff --git a/gcc/testsuite/gcc.c-torture/execute/20101011-1.c b/gcc/testsuite/gcc.c-torture/execute/20101011-1.c index 8d82183..bd54318 100644 --- a/gcc/testsuite/gcc.c-torture/execute/20101011-1.c +++ b/gcc/testsuite/gcc.c-torture/execute/20101011-1.c @@ -43,6 +43,9 @@ #elif defined (__CRIS__) /* No SIGFPE for CRIS integer division. */ # define DO_TEST 0 +#elif defined (__arc__) + /* No SIGFPE for ARC integer division. */ +# define DO_TEST 0 #elif defined (__arm__) && defined (__ARM_EABI__) # ifdef __ARM_ARCH_EXT_IDIV__ /* Hardware division instructions may not trap, and handle trapping diff --git a/gcc/testsuite/gcc.dg/builtin-apply2.c b/gcc/testsuite/gcc.dg/builtin-apply2.c index 9b73147..daaef47 100644 --- a/gcc/testsuite/gcc.dg/builtin-apply2.c +++ b/gcc/testsuite/gcc.dg/builtin-apply2.c @@ -17,7 +17,7 @@ E, F and G are passed on stack. So the size of the stack argument data is 20. */ #define STACK_ARGUMENTS_SIZE 20 -#elif defined __MMIX__ +#elif defined __MMIX__ || defined __arc__ /* No parameters on stack for bar. */ #define STACK_ARGUMENTS_SIZE 0 #else diff --git a/gcc/testsuite/gcc.dg/stack-usage-1.c b/gcc/testsuite/gcc.dg/stack-usage-1.c index fa299c4..ff9709a 100644 --- a/gcc/testsuite/gcc.dg/stack-usage-1.c +++ b/gcc/testsuite/gcc.dg/stack-usage-1.c @@ -9,6 +9,8 @@ #if defined(__aarch64__) # define SIZE 256 /* No frame pointer for leaf functions (default) */ +#elif defined(__arc__) +# define SIZE (256-4) #elif defined(__i386__) # define SIZE 248 #elif defined(__x86_64__) diff --git a/gcc/testsuite/gcc.dg/torture/pr37868.c b/gcc/testsuite/gcc.dg/torture/pr37868.c index 2b245eb..cc9c24f 100644 --- a/gcc/testsuite/gcc.dg/torture/pr37868.c +++ b/gcc/testsuite/gcc.dg/torture/pr37868.c @@ -1,6 +1,6 @@ /* { dg-do run } */ /* { dg-options "-fno-strict-aliasing" } */ -/* { dg-skip-if "unaligned access" { epiphany-*-* sparc*-*-* sh*-*-* tic6x-*-* } "*" "" } */ +/* { dg-skip-if "unaligned access" { arc*-*-* epiphany-*-* sparc*-*-* sh*-*-* tic6x-*-* } "*" "" } */ extern void abort (void); #if (__SIZEOF_INT__ <= 2) diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/builtin-apply-2.c b/gcc/testsuite/gcc.dg/torture/stackalign/builtin-apply-2.c index f683a2a..ed81e80 100644 --- a/gcc/testsuite/gcc.dg/torture/stackalign/builtin-apply-2.c +++ b/gcc/testsuite/gcc.dg/torture/stackalign/builtin-apply-2.c @@ -19,7 +19,7 @@ E, F and G are passed on stack. So the size of the stack argument data is 20. */ #define STACK_ARGUMENTS_SIZE 20 -#elif defined __aarch64__ || defined __MMIX__ +#elif defined __aarch64__ || defined __arc__ || defined __MMIX__ /* No parameters on stack for bar. */ #define STACK_ARGUMENTS_SIZE 0 #else diff --git a/gcc/testsuite/gcc.target/arc/arc.exp b/gcc/testsuite/gcc.target/arc/arc.exp new file mode 100644 index 0000000..83e2762 --- /dev/null +++ b/gcc/testsuite/gcc.target/arc/arc.exp @@ -0,0 +1,41 @@ +# Copyright (C) 2007, 2011, 2012 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# . + +# GCC testsuite that uses the `dg.exp' driver. + +# Exit immediately if this isn't an arc target. +if ![istarget arc*-*-*] then { + return +} + +# Load support procs. +load_lib gcc-dg.exp + +# If a testcase doesn't have special options, use these. +global DEFAULT_CFLAGS +if ![info exists DEFAULT_CFLAGS] then { + set DEFAULT_CFLAGS " -ansi -pedantic-errors" +} + +# Initialize `dg'. +dg-init + +# Main loop. +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] \ + "" $DEFAULT_CFLAGS + +# All done. +dg-finish diff --git a/gcc/testsuite/gcc.target/arc/builtin_arc_aligned-1.c b/gcc/testsuite/gcc.target/arc/builtin_arc_aligned-1.c new file mode 100644 index 0000000..b1990c6 --- /dev/null +++ b/gcc/testsuite/gcc.target/arc/builtin_arc_aligned-1.c @@ -0,0 +1,16 @@ +/* { dg-do run } */ +/* { dg-options "-O" } */ + +extern void abort (void); + +/* In macros like optimized memset, we want to be able to decide what + alignment a passed pointer has. */ +#define f(p) __builtin_arc_aligned (p, 4) + +int main (void) +{ + int i; + if (f (&i) == 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.target/arc/builtin_arc_aligned-2.c b/gcc/testsuite/gcc.target/arc/builtin_arc_aligned-2.c new file mode 100644 index 0000000..d48a915 --- /dev/null +++ b/gcc/testsuite/gcc.target/arc/builtin_arc_aligned-2.c @@ -0,0 +1,28 @@ +/* { dg-do run } */ +/* { dg-options "-O" } */ + +extern void abort (void); + +typedef struct { + short x; +} mytype_t; + +mytype_t *__attribute__ ((noinline,weak)) +some_func (void) +{ + static mytype_t s; + return &s; +}; + +int main (void) +{ + int y, y2; + mytype_t *shorter = some_func(); + y = __builtin_arc_aligned (shorter, 2); + if (!y) + abort (); + y2 = __builtin_arc_aligned (shorter, 4); + if (y2) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.target/arc/builtin_arc_aligned-3.c b/gcc/testsuite/gcc.target/arc/builtin_arc_aligned-3.c new file mode 100644 index 0000000..23d80ed --- /dev/null +++ b/gcc/testsuite/gcc.target/arc/builtin_arc_aligned-3.c @@ -0,0 +1,67 @@ +/* { dg-do run } */ +/* { dg-options "-O" } */ + +extern void abort (void); + +typedef struct { + int b, c; +} +__attribute__((aligned(32))) inner_t; // data type is 32 byte aligned + +typedef struct { + inner_t *inner; + int a; +} outer_t; + +void __attribute__ ((noinline,weak)) +somefunc (int a, int b, int c) +{ + if (!a || !b || c) + abort (); +}; + +__attribute__ ((noinline,weak)) +outer_t * +some_alloc_1 () +{ + static outer_t x; + return &x; +} + +__attribute__ ((noinline,weak)) +inner_t * +some_alloc_2 () +{ + static inner_t x; + return &x; +} + +int main (void) +{ + int y, y2, y3; + // @p_out is pointing to instance of outer_t, naturally aligned to 4+4 = 8 + // and not gauranteed be 32 byte aligned. + outer_t *p_out = some_alloc_1( ); // returns 8 byte aligned ptr + + // @ptr is pointing to instance of inner_t which is naturally aligned to 32. + // It is assigned to p_out->inner which is of type inner_t thus 32 byte + // aligned as well + // Note that gcc can deduce p_out->inner is 32b aligned, not at runtime, + // because it was assigned @ptr, but even at compile time, because it's data + // type is naturally 32 byte aligned. + inner_t *ptr = some_alloc_2(); // returns 32 byte aligned ptr + p_out->inner = ptr; // this ptr will also be 32 byte aligned + + y = __builtin_arc_aligned(ptr, 32); // this shd return 1 + y2 = __builtin_arc_aligned(p_out->inner, 32); // this also shd return 1 + // Although p_out->inner ptr is 32 byte aligned, + // it's container &(p_out->inner) need not be. + // That is because the hoister has no relation to contents. + // p_out is not gauranteed to be 32 byte + // aligned, so it's member @inner in p_out need not be. + y3 = __builtin_arc_aligned(&(p_out->inner), 32); + // compiler not sure, so must return 0 + + somefunc(y, y2, y3); + return 0; +} diff --git a/gcc/testsuite/gcc.target/arc/interrupt-1.c b/gcc/testsuite/gcc.target/arc/interrupt-1.c new file mode 100644 index 0000000..7051457 --- /dev/null +++ b/gcc/testsuite/gcc.target/arc/interrupt-1.c @@ -0,0 +1,5 @@ +void __attribute__ ((interrupt("ilink1"))) +handler1 (void) +{ +} +/* { dg-final { scan-assembler-times "j.*\[ilink1\]" 1 } } */ diff --git a/gcc/testsuite/gcc.target/arc/interrupt-2.c b/gcc/testsuite/gcc.target/arc/interrupt-2.c new file mode 100644 index 0000000..ee8593b --- /dev/null +++ b/gcc/testsuite/gcc.target/arc/interrupt-2.c @@ -0,0 +1,5 @@ +void __attribute__ ((interrupt("ilink2"))) +handler1 (void) +{ +} +/* { dg-final { scan-assembler-times "j.*\[ilink2\]" 1 } } */ diff --git a/gcc/testsuite/gcc.target/arc/interrupt-3.c b/gcc/testsuite/gcc.target/arc/interrupt-3.c new file mode 100644 index 0000000..fa598d6 --- /dev/null +++ b/gcc/testsuite/gcc.target/arc/interrupt-3.c @@ -0,0 +1,14 @@ +void __attribute__ ((interrupt)) +handler0 (void) +{ /* { dg-error "wrong number of arguments specified" } */ +} + +void __attribute__ ((interrupt("you load too"))) +handler1 (void) +{ /* { dg-warning "is not \"ilink1\" or \"ilink2\"" } */ +} + +void __attribute__ ((interrupt(42))) +hander2 (void) +{ /* { dg-warning "is not a string constant" } */ +} diff --git a/gcc/testsuite/gcc.target/arc/mulsi3_highpart-1.c b/gcc/testsuite/gcc.target/arc/mulsi3_highpart-1.c new file mode 100644 index 0000000..398ecfe --- /dev/null +++ b/gcc/testsuite/gcc.target/arc/mulsi3_highpart-1.c @@ -0,0 +1,28 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -mARC700 --save-temps" } */ + +#include + +/* Hide value propagation from the optimizers. */ +static int +id (int i) +{ + asm ("": "+Xr" (i)); + return i; +} + +static int +mulhigh (unsigned a, unsigned b) +{ + return (unsigned long long) a * b >> 32; +} + +int +main (void) +{ + if (mulhigh (id (0x12345678), id (0x90abcdef)) != 0xa49a83e) + abort (); + return 0; +} + +/* { dg-final { scan-assembler "mpyhu\[ \t\]" } } */ diff --git a/gcc/testsuite/gcc.target/arc/mulsi3_highpart-2.c b/gcc/testsuite/gcc.target/arc/mulsi3_highpart-2.c new file mode 100644 index 0000000..ccc74e7 --- /dev/null +++ b/gcc/testsuite/gcc.target/arc/mulsi3_highpart-2.c @@ -0,0 +1,30 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -mARC700 --save-temps -mno-mpy" } */ + +#include + +/* Hide value propagation from the optimizers. */ +static int +id (int i) +{ + asm ("": "+Xr" (i)); + return i; +} + +static int +mulhigh (unsigned a, unsigned b) +{ + return (unsigned long long) a * b >> 32; +} + +int +main (void) +{ + if (mulhigh (id (0x12345678), id (0x90abcdef)) != 0xa49a83e) + abort (); + return 0; +} + +/* { dg-final { scan-assembler-not "mpyhu\[ \t\]" } } */ +/* { dg-final { scan-assembler-not "@__muldi3" } } */ +/* { dg-final { scan-assembler "@__umulsi3_highpart" } } */ diff --git a/gcc/testsuite/gcc.target/arc/nv-cache.c b/gcc/testsuite/gcc.target/arc/nv-cache.c new file mode 100644 index 0000000..9687195 --- /dev/null +++ b/gcc/testsuite/gcc.target/arc/nv-cache.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mno-volatile-cache" } */ + +volatile int i; +void f (void) +{ + i = 0; +} +/* { dg-final { scan-assembler "st\.di" } } */ diff --git a/gcc/testsuite/gcc.target/arc/sdata-1.c b/gcc/testsuite/gcc.target/arc/sdata-1.c new file mode 100644 index 0000000..3d8366c --- /dev/null +++ b/gcc/testsuite/gcc.target/arc/sdata-1.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -msdata" } */ + +int i; + +int f (void) +{ + return i; +} +/* { dg-final { scan-assembler "@sda" } } */ diff --git a/gcc/testsuite/gcc.target/arc/sdata-2.c b/gcc/testsuite/gcc.target/arc/sdata-2.c new file mode 100644 index 0000000..ebaa25e --- /dev/null +++ b/gcc/testsuite/gcc.target/arc/sdata-2.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mno-sdata" } */ + +int i; + +int f (void) +{ + return i; +} +/* { dg-final { scan-assembler-not "@sda" } } */ diff --git a/gcc/testsuite/gcc.target/arc/v-cache.c b/gcc/testsuite/gcc.target/arc/v-cache.c new file mode 100644 index 0000000..7722c43 --- /dev/null +++ b/gcc/testsuite/gcc.target/arc/v-cache.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mvolatile-cache" } */ + +volatile int i; +void f (void) +{ + i = 0; +} +/* { dg-final { scan-assembler-not "st\.di" } } */