From 0db7b1373f71594a17c358bb9d907c904f2ca3d6 Mon Sep 17 00:00:00 2001 From: Joern Rennecke Date: Thu, 5 Sep 2013 23:23:53 +0000 Subject: [PATCH] 20101011-1.c [__arc__] (DO_TEST): Define as 0. * 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. Co-Authored-By: Vineet Gupta From-SVN: r202301 --- gcc/testsuite/ChangeLog | 12 ++++ .../gcc.c-torture/execute/20101011-1.c | 3 + gcc/testsuite/gcc.dg/builtin-apply2.c | 2 +- gcc/testsuite/gcc.dg/stack-usage-1.c | 2 + gcc/testsuite/gcc.dg/torture/pr37868.c | 2 +- .../torture/stackalign/builtin-apply-2.c | 2 +- gcc/testsuite/gcc.target/arc/arc.exp | 41 ++++++++++++ .../gcc.target/arc/builtin_arc_aligned-1.c | 16 +++++ .../gcc.target/arc/builtin_arc_aligned-2.c | 28 ++++++++ .../gcc.target/arc/builtin_arc_aligned-3.c | 67 +++++++++++++++++++ gcc/testsuite/gcc.target/arc/interrupt-1.c | 5 ++ gcc/testsuite/gcc.target/arc/interrupt-2.c | 5 ++ gcc/testsuite/gcc.target/arc/interrupt-3.c | 14 ++++ .../gcc.target/arc/mulsi3_highpart-1.c | 28 ++++++++ .../gcc.target/arc/mulsi3_highpart-2.c | 30 +++++++++ gcc/testsuite/gcc.target/arc/nv-cache.c | 9 +++ gcc/testsuite/gcc.target/arc/sdata-1.c | 10 +++ gcc/testsuite/gcc.target/arc/sdata-2.c | 10 +++ gcc/testsuite/gcc.target/arc/v-cache.c | 9 +++ 19 files changed, 292 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gcc.target/arc/arc.exp create mode 100644 gcc/testsuite/gcc.target/arc/builtin_arc_aligned-1.c create mode 100644 gcc/testsuite/gcc.target/arc/builtin_arc_aligned-2.c create mode 100644 gcc/testsuite/gcc.target/arc/builtin_arc_aligned-3.c create mode 100644 gcc/testsuite/gcc.target/arc/interrupt-1.c create mode 100644 gcc/testsuite/gcc.target/arc/interrupt-2.c create mode 100644 gcc/testsuite/gcc.target/arc/interrupt-3.c create mode 100644 gcc/testsuite/gcc.target/arc/mulsi3_highpart-1.c create mode 100644 gcc/testsuite/gcc.target/arc/mulsi3_highpart-2.c create mode 100644 gcc/testsuite/gcc.target/arc/nv-cache.c create mode 100644 gcc/testsuite/gcc.target/arc/sdata-1.c create mode 100644 gcc/testsuite/gcc.target/arc/sdata-2.c create mode 100644 gcc/testsuite/gcc.target/arc/v-cache.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4f6d88e0d6b..3700847f09e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,15 @@ +2013-09-06 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. + 2013-09-04 Jan Hubicka PR middle-end/58201 diff --git a/gcc/testsuite/gcc.c-torture/execute/20101011-1.c b/gcc/testsuite/gcc.c-torture/execute/20101011-1.c index 8d821839b1a..bd54318a263 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 9b731470e6c..daaef477894 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 fa299c4385a..ff9709ad4a2 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 2b245ebf49b..cc9c24f49bb 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 f683a2a042d..ed81e808309 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 00000000000..83e2762e64a --- /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 00000000000..b1990c628e9 --- /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 00000000000..d48a915b8bd --- /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 00000000000..23d80edd478 --- /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 00000000000..70514572ea5 --- /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 00000000000..ee8593b3039 --- /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 00000000000..fa598d67e6b --- /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 00000000000..398ecfe948e --- /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 00000000000..ccc74e7b1ad --- /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 00000000000..9687195981c --- /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 00000000000..3d8366c1564 --- /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 00000000000..ebaa25e7267 --- /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 00000000000..7722c433581 --- /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" } } */