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 <Vineet.Gupta@synopsys.com>

From-SVN: r202301
This commit is contained in:
Joern Rennecke 2013-09-05 23:23:53 +00:00 committed by Joern Rennecke
parent e18412fc01
commit 0db7b1373f
19 changed files with 292 additions and 3 deletions

View File

@ -1,3 +1,15 @@
2013-09-06 Joern Rennecke <joern.rennecke@embecosm.com>
Vineet Gupta <Vineet.Gupta@synopsys.com>
* 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 <jh@suse.cz>
PR middle-end/58201

View File

@ -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

View File

@ -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

View File

@ -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__)

View File

@ -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)

View File

@ -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

View File

@ -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
# <http://www.gnu.org/licenses/>.
# 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

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -0,0 +1,5 @@
void __attribute__ ((interrupt("ilink1")))
handler1 (void)
{
}
/* { dg-final { scan-assembler-times "j.*\[ilink1\]" 1 } } */

View File

@ -0,0 +1,5 @@
void __attribute__ ((interrupt("ilink2")))
handler1 (void)
{
}
/* { dg-final { scan-assembler-times "j.*\[ilink2\]" 1 } } */

View File

@ -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" } */
}

View File

@ -0,0 +1,28 @@
/* { dg-do run } */
/* { dg-options "-O2 -mARC700 --save-temps" } */
#include <stdlib.h>
/* 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\]" } } */

View File

@ -0,0 +1,30 @@
/* { dg-do run } */
/* { dg-options "-O2 -mARC700 --save-temps -mno-mpy" } */
#include <stdlib.h>
/* 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" } } */

View File

@ -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" } } */

View File

@ -0,0 +1,10 @@
/* { dg-do compile } */
/* { dg-options "-O2 -msdata" } */
int i;
int f (void)
{
return i;
}
/* { dg-final { scan-assembler "@sda" } } */

View File

@ -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" } } */

View File

@ -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" } } */