From 1bc5aee63eb72b341f506ad058502cd0361f0d10 Mon Sep 17 00:00:00 2001 From: Ben Cheng Date: Tue, 25 Mar 2014 22:37:19 -0700 Subject: Initial checkin of GCC 4.9.0 from trunk (r208799). Change-Id: I48a3c08bb98542aa215912a75f03c0890e497dba --- gcc-4.9/gcc/testsuite/gcc.target/spu/ea/cache1.c | 195 +++++++ gcc-4.9/gcc/testsuite/gcc.target/spu/ea/cast1.c | 43 ++ gcc-4.9/gcc/testsuite/gcc.target/spu/ea/cast2.c | 74 +++ gcc-4.9/gcc/testsuite/gcc.target/spu/ea/compile1.c | 109 ++++ gcc-4.9/gcc/testsuite/gcc.target/spu/ea/compile2.c | 43 ++ .../gcc/testsuite/gcc.target/spu/ea/cppdefine.c | 36 ++ gcc-4.9/gcc/testsuite/gcc.target/spu/ea/ea.exp | 54 ++ gcc-4.9/gcc/testsuite/gcc.target/spu/ea/errors1.c | 67 +++ gcc-4.9/gcc/testsuite/gcc.target/spu/ea/errors2.c | 107 ++++ gcc-4.9/gcc/testsuite/gcc.target/spu/ea/execute1.c | 41 ++ gcc-4.9/gcc/testsuite/gcc.target/spu/ea/execute2.c | 41 ++ gcc-4.9/gcc/testsuite/gcc.target/spu/ea/execute3.c | 39 ++ gcc-4.9/gcc/testsuite/gcc.target/spu/ea/ops1.c | 94 ++++ gcc-4.9/gcc/testsuite/gcc.target/spu/ea/ops2.c | 94 ++++ gcc-4.9/gcc/testsuite/gcc.target/spu/ea/options1.c | 22 + gcc-4.9/gcc/testsuite/gcc.target/spu/ea/pr41857.c | 29 + .../gcc/testsuite/gcc.target/spu/ea/test-sizes.c | 608 +++++++++++++++++++++ 17 files changed, 1696 insertions(+) create mode 100644 gcc-4.9/gcc/testsuite/gcc.target/spu/ea/cache1.c create mode 100644 gcc-4.9/gcc/testsuite/gcc.target/spu/ea/cast1.c create mode 100644 gcc-4.9/gcc/testsuite/gcc.target/spu/ea/cast2.c create mode 100644 gcc-4.9/gcc/testsuite/gcc.target/spu/ea/compile1.c create mode 100644 gcc-4.9/gcc/testsuite/gcc.target/spu/ea/compile2.c create mode 100644 gcc-4.9/gcc/testsuite/gcc.target/spu/ea/cppdefine.c create mode 100644 gcc-4.9/gcc/testsuite/gcc.target/spu/ea/ea.exp create mode 100644 gcc-4.9/gcc/testsuite/gcc.target/spu/ea/errors1.c create mode 100644 gcc-4.9/gcc/testsuite/gcc.target/spu/ea/errors2.c create mode 100644 gcc-4.9/gcc/testsuite/gcc.target/spu/ea/execute1.c create mode 100644 gcc-4.9/gcc/testsuite/gcc.target/spu/ea/execute2.c create mode 100644 gcc-4.9/gcc/testsuite/gcc.target/spu/ea/execute3.c create mode 100644 gcc-4.9/gcc/testsuite/gcc.target/spu/ea/ops1.c create mode 100644 gcc-4.9/gcc/testsuite/gcc.target/spu/ea/ops2.c create mode 100644 gcc-4.9/gcc/testsuite/gcc.target/spu/ea/options1.c create mode 100644 gcc-4.9/gcc/testsuite/gcc.target/spu/ea/pr41857.c create mode 100644 gcc-4.9/gcc/testsuite/gcc.target/spu/ea/test-sizes.c (limited to 'gcc-4.9/gcc/testsuite/gcc.target/spu/ea') diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/cache1.c b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/cache1.c new file mode 100644 index 000000000..3487ce980 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/cache1.c @@ -0,0 +1,195 @@ +/* Copyright (C) 2009 Free Software Foundation, Inc. + + This file 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 file 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 this file; see the file COPYING3. If not see + . */ + +/* { dg-do run } */ +/* { dg-require-effective-target "ealib" } */ + +#include +#include +#include +#include + +#ifdef __EA64__ +#define addr unsigned long long +#else +#define addr unsigned long +#endif + +static __ea void *bigblock; +static __ea void *block; +static int *ls_block; + +extern char __cache_tag_array_size[]; +#define CACHE_SIZE (4 * (int) &__cache_tag_array_size[0]) +#define LINE_SIZE ((addr)128) + +void +init_mem (void) +{ + bigblock = malloc_ea (CACHE_SIZE + 2 * LINE_SIZE); + block = malloc_ea (2 * LINE_SIZE); + ls_block = malloc (LINE_SIZE); + + memset_ea (bigblock, 0, CACHE_SIZE + 2 * LINE_SIZE); + memset_ea (block, -1, 2 * LINE_SIZE); + memset (ls_block, -1, LINE_SIZE); + cache_flush (); +} + +/* Test 1: Simple cache fetching. */ +void +test1 (void) +{ + addr aligned = ((((addr) block) + LINE_SIZE - 1) & -LINE_SIZE); + int *p1 = NULL; + int *p2 = NULL; + int i = 0; + + /* First, check if the same addr give the same cache ptr. */ + p1 = cache_fetch ((__ea void *) aligned); + p2 = cache_fetch ((__ea void *) aligned); + + if (p1 != p2) + abort (); + + /* Check that the data actually is in the cache. */ + for (i = 0; i < LINE_SIZE / sizeof (int); i++) + { + if (p1[i] != -1) + abort (); + } + + /* Check returning within the cache line. */ + p2 = cache_fetch ((__ea void *) (aligned + sizeof (int))); + + if (p2 - p1 != 1) + abort (); + + /* Finally, check that fetching an LS pointer returns that pointer. */ + p1 = cache_fetch ((__ea char *) ls_block); + if (p1 != ls_block) + abort (); +} + +/* Test 2: Eviction testing. */ +void +test2 (void) +{ + addr aligned = ((((addr) block) + LINE_SIZE - 1) & -LINE_SIZE); + int *p = NULL; + int i = 0; + + /* First check that clean evictions don't write back. */ + p = cache_fetch ((__ea void *) aligned); + for (i = 0; i < LINE_SIZE / sizeof (int); i++) + p[i] = 0; + + cache_evict ((__ea void *) aligned); + memcpy_ea ((__ea char *) ls_block, (__ea void *) aligned, LINE_SIZE); + + for (i = 0; i < LINE_SIZE / sizeof (int); i++) + { + if (ls_block[i] == 0) + abort (); + } + + /* Now check that dirty evictions do write back. */ + p = cache_fetch_dirty ((__ea void *) aligned, LINE_SIZE); + for (i = 0; i < LINE_SIZE / sizeof (int); i++) + p[i] = 0; + + cache_evict ((__ea void *) aligned); + memcpy_ea ((__ea char *) ls_block, (__ea void *) aligned, LINE_SIZE); + + for (i = 0; i < LINE_SIZE / sizeof (int); i++) + { + if (ls_block[i] != 0) + abort (); + } + + /* Finally, check that non-atomic writeback only writes dirty bytes. */ + + for (i = 0; i < LINE_SIZE / sizeof (int); i++) + { + p = cache_fetch_dirty ((__ea void *) (aligned + i * sizeof (int)), + (i % 2) * sizeof (int)); + p[0] = -1; + } + + cache_evict ((__ea void *) aligned); + memcpy_ea ((__ea char *) ls_block, (__ea void *) aligned, LINE_SIZE); + + for (i = 0; i < LINE_SIZE / sizeof (int); i++) + { + if ((ls_block[i] == -1) && (i % 2 == 0)) + abort (); + if ((ls_block[i] == 0) && (i % 2 == 1)) + abort (); + } +} + +/* Test LS forced-eviction. */ +void +test3 (void) +{ + addr aligned = ((((addr) bigblock) + LINE_SIZE - 1) & -LINE_SIZE); + char *test = NULL; + char *ls = NULL; + int i = 0; + + /* Init memory, fill the cache to capacity. */ + ls = cache_fetch_dirty ((__ea void *) aligned, LINE_SIZE); + for (i = 1; i < (CACHE_SIZE / LINE_SIZE); i++) + cache_fetch_dirty ((__ea void *) (aligned + i * LINE_SIZE), LINE_SIZE); + + memset (ls, -1, LINE_SIZE); + test = cache_fetch ((__ea void *) (aligned + CACHE_SIZE)); + + /* test == ls indicates cache collision. */ + if (test != ls) + abort (); + + /* Make sure it actually wrote the cache line. */ + for (i = 0; i < LINE_SIZE; i++) + { + if (ls[i] != 0) + abort (); + } + + ls = cache_fetch ((__ea void *) aligned); + + /* test != ls indicates another entry was evicted. */ + if (test == ls) + abort (); + + /* Make sure that the previous eviction actually wrote back. */ + for (i = 0; i < LINE_SIZE; i++) + { + if (ls[i] != 0xFF) + abort (); + } +} + +int +main (int argc, char **argv) +{ + init_mem (); + test1 (); + test2 (); + test3 (); + + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/cast1.c b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/cast1.c new file mode 100644 index 000000000..9ec4e1546 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/cast1.c @@ -0,0 +1,43 @@ +/* Copyright (C) 2009 Free Software Foundation, Inc. + + This file 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 file 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 this file; see the file COPYING3. If not see + . */ + +/* { dg-do run } */ + +extern void abort (void); +extern unsigned long long __ea_local_store; + +__ea int *ppu; +int x, *spu = &x, *spu2; + +int +main (int argc, char **argv) +{ + ppu = (__ea int *) spu; + spu2 = (int *) ppu; + +#ifdef __EA32__ + if ((int) ppu != (int) __ea_local_store + (int) spu) +#else + if ((unsigned long long) ppu != __ea_local_store + (unsigned long long)(int) spu) +#endif + + abort (); + + if (spu != spu2) + abort (); + + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/cast2.c b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/cast2.c new file mode 100644 index 000000000..6ce57dc4d --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/cast2.c @@ -0,0 +1,74 @@ +/* Copyright (C) 2009 Free Software Foundation, Inc. + + This file 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 file 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 this file; see the file COPYING3. If not see + . */ + +/* { dg-do run } */ + +extern void abort (void); + +int array[128]; + +__ea int *ea; +int *lm; + +void verify_ea (void) __attribute__ ((noinline)); +void +verify_ea (void) +{ + if (ea != (__ea int *)lm) + abort (); +} + +void verify_lm (void) __attribute__ ((noinline)); +void +verify_lm (void) +{ + if ((int *)ea != lm) + abort (); +} + +void verify_diff (int x) __attribute__ ((noinline)); +void +verify_diff (int x) +{ + if (ea - lm != x) + abort (); +} + +int +main (int argc, char **argv) +{ + ea = 0; + lm = 0; + verify_ea (); + verify_lm (); + verify_diff (0); + + ea = &array[64]; + lm = &array[64]; + verify_ea (); + verify_lm (); + verify_diff (0); + + ea = &array[0]; + lm = &array[64]; + verify_diff (-64); + + ea = &array[64]; + lm = &array[0]; + verify_diff (64); + + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/compile1.c b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/compile1.c new file mode 100644 index 000000000..ee7a32ad2 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/compile1.c @@ -0,0 +1,109 @@ +/* Copyright (C) 2009 Free Software Foundation, Inc. + + This file 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 file 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 this file; see the file COPYING3. If not see + . */ + +/* Valid __ea declarations. */ + +/* { dg-do compile } */ + +/* Typedefs. */ +typedef __ea int ea_int_t; +typedef __ea int *ea_int_star_t; +typedef int outer_t; + +/* Externs. */ + +__ea extern int i1; +extern __ea int i2; +extern int __ea i3; +extern __ea ea_int_t i4; /* __ea qualifier permitted via typedef. */ +extern int __ea __ea __ea dupe; /* __ea duplicate permitted directly. */ +extern int __ea *ppu; + +/* Pointers. */ +__ea int *i4p; + +/* Structs. */ +struct st { + __ea int *p; +}; + +/* Variable definitions. */ +__ea int ii0; +int *__ea ii1; +static int __ea ii2; + +void +f1 () +{ + int *spu; + ppu = (ea_int_t *) spu; + ppu = (ea_int_star_t) spu; +} + +void +f2 () +{ + int *spu; + spu = (int *) ppu; + ppu = (__ea int *) spu; +} + +void +f3 () +{ + int i = sizeof (__ea int); +} + +__ea int *f4 (void) +{ + return 0; +} + +int f5 (__ea int *parm) +{ + static __ea int local4; + int tmp = local4; + local4 = *parm; + return tmp; +} + +static inline __ea void *f6 (__ea void *start) +{ + return 0; +} + +void f7 (void) +{ + __ea void *s1; + auto __ea void *s2; +} + +__ea int *f8 (__ea int *x) +{ + register __ea int *y = x; + __ea int *z = y; + return z; +} + +long long f9 (__ea long long x[2]) +{ + return x[0] + x[1]; +} + +void f10 () +{ + static __ea outer_t o; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/compile2.c b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/compile2.c new file mode 100644 index 000000000..58e64890e --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/compile2.c @@ -0,0 +1,43 @@ +/* Copyright (C) 2009 Free Software Foundation, Inc. + + This file 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 file 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 this file; see the file COPYING3. If not see + . */ + +/* Make sure __ea structure references work. */ + +/* { dg-do compile } */ + +typedef unsigned long int uintptr_t; + +struct tostruct +{ + uintptr_t selfpc; + long count; + unsigned short link; +}; + +/* froms are indexing tos */ +static __ea unsigned short *froms; +static __ea struct tostruct *tos = 0; + +void +foo (uintptr_t frompc, uintptr_t selfpc) +{ + __ea unsigned short *frompcindex; + + frompcindex = &froms[(frompc) / (4 * sizeof (*froms))]; + *frompcindex = tos[0].link; + + return; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/cppdefine.c b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/cppdefine.c new file mode 100644 index 000000000..583635734 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/cppdefine.c @@ -0,0 +1,36 @@ +/* Copyright (C) 2009 Free Software Foundation, Inc. + + This file 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 file 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 this file; see the file COPYING3. If not see + . */ + +/* Test default __EA32__/__EA64__ define. */ + +/* { dg-do compile } */ + +#if !defined (__EA32__) && !defined (__EA64__) +#error both __EA32__ and __EA64__ undefined +#endif + +#if defined (__EA32__) && defined (__EA64__) +#error both __EA32__ and __EA64__ defined +#endif + +#ifdef __EA32__ +int x [ sizeof (__ea char *) == 4 ? 1 : -1 ]; +#endif + +#ifdef __EA64__ +int x [ sizeof (__ea char *) == 8 ? 1 : -1 ]; +#endif + diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/ea.exp b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/ea.exp new file mode 100644 index 000000000..2e04f9d77 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/ea.exp @@ -0,0 +1,54 @@ +# Copyright (C) 2008-2014 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 a SPU target. +if { ![istarget spu-*-*] } then { + return +} + +# Load support procs. +load_lib gcc-dg.exp + +# Return 1 if target __ea library functions are available +proc check_effective_target_ealib { } { + return [check_no_compiler_messages ealib executable { + #include + int main (void) + { + __ea void *ptr = malloc_ea (1024); + return 0; + } + }] +} + +# If a testcase doesn't have special options, use these. +# We do not use the global DEFAULT_CFLAGS as all test cases +# in this directory use the __ea address space qualifier +# extension and thus will not compile with -ansi. +set DEFAULT_EA_CFLAGS "-std=gnu99 -pedantic-errors -O2" + +# Initialize `dg'. +dg-init + +# Run all tests in both -mea32 and -mea64 mode. +set tests [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] +dg-runtest $tests "-mea32" $DEFAULT_EA_CFLAGS +dg-runtest $tests "-mea64" $DEFAULT_EA_CFLAGS + +# All done. +dg-finish diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/errors1.c b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/errors1.c new file mode 100644 index 000000000..7d0b5a11c --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/errors1.c @@ -0,0 +1,67 @@ +/* Copyright (C) 2009 Free Software Foundation, Inc. + + This file 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 file 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 this file; see the file COPYING3. If not see + . */ + +/* Invalid __ea declarations. */ + +/* { dg-do compile } */ + +typedef __ea int eaint; + +void func () +{ + register __ea int local1; /* { dg-error "'__ea' combined with 'register' qualifier for 'local1'" } */ + auto __ea int local2; /* { dg-error "'__ea' combined with 'auto' qualifier for 'local2'" } */ + __ea int local3; /* { dg-error "'__ea' specified for auto variable 'local3'" } */ + register int *__ea p1; /* { dg-error "'__ea' combined with 'register' qualifier for 'p1'" } */ + auto char *__ea p2; /* { dg-error "'__ea' combined with 'auto' qualifier for 'p2'" } */ + void *__ea p3; /* { dg-error "'__ea' specified for auto variable 'p3'" } */ + register __ea int a1[2]; /* { dg-error "'__ea' combined with 'register' qualifier for 'a1'" } */ + auto __ea char a2[1]; /* { dg-error "'__ea' combined with 'auto' qualifier for 'a2'" } */ + __ea char a3[5]; /* { dg-error "'__ea' specified for auto variable 'a3'" } */ + register eaint td1; /* { dg-error "'__ea' combined with 'register' qualifier for 'td1'" } */ + auto eaint td2; /* { dg-error "'__ea' combined with 'auto' qualifier for 'td2'" } */ + eaint td3; /* { dg-error "'__ea' specified for auto variable 'td3'" } */ +} + +void func2 (__ea int x) /* { dg-error "'__ea' specified for parameter 'x'" } */ +{ } + +void func2td (eaint x) /* { dg-error "'__ea' specified for parameter 'x'" } */ +{ } + +struct st { + __ea int x; /* { dg-error "'__ea' specified for structure field 'x'" } */ + eaint td; /* { dg-error "'__ea' specified for structure field 'td'" } */ + int *__ea q; /* { dg-error "'__ea' specified for structure field 'q'" } */ + int __ea b : 7; /* { dg-error "'__ea' specified for structure field 'b'" } */ + int __ea : 1; /* { dg-error "'__ea' specified for structure field" } */ +} s; + +struct A { int a; }; + +int func3 (int *__ea); /* { dg-error "'__ea' specified for unnamed parameter" } */ +int func3 (int *__ea x) /* { dg-error "'__ea' specified for parameter 'x'" } */ +{ + struct A i = (__ea struct A) { 1 }; /* { dg-error "compound literal qualified by address-space qualifier" } */ + return i.a; +} + +extern __ea int ea_var; /* { dg-message "note: previous declaration of 'ea_var' was here" } */ +int ea_var; /* { dg-error "conflicting named address spaces \\(generic vs __ea\\) for 'ea_var'" } */ + +extern eaint ea_var_td; /* { dg-message "note: previous declaration of 'ea_var_td' was here" } */ +int ea_var_td; /* { dg-error "conflicting named address spaces \\(generic vs __ea\\) for 'ea_var_td'" } */ + diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/errors2.c b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/errors2.c new file mode 100644 index 000000000..74a32ff5e --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/errors2.c @@ -0,0 +1,107 @@ +/* Copyright (C) 2009 Free Software Foundation, Inc. + + This file 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 file 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 this file; see the file COPYING3. If not see + . */ + +/* Invalid __ea declarations. */ + +/* { dg-do compile } */ + +__ea char ea_str[] = "abc"; +char lm_str[] = "abc"; + +__ea char *lm_ea_ptr1 = "abc"; /* { dg-error "initializer element is not computable at load time" } */ +__ea char *lm_ea_ptr2 = (__ea char *)"abc"; /* { dg-error "initializer element is not constant" } */ +__ea char *lm_ea_ptr3 = ea_str; +__ea char *lm_ea_ptr4 = (__ea char *)ea_str; +__ea char *lm_ea_ptr5 = lm_str; /* { dg-error "initializer element is not computable at load time" } */ +__ea char *lm_ea_ptr6 = (__ea char *)lm_str; /* { dg-error "initializer element is not constant" } */ + +__ea char * __ea ea_ea_ptr1 = ea_str; +__ea char * __ea ea_ea_ptr2 = (__ea char *)ea_str; + +char * __ea ea_lm_ptr1 = lm_str; +char * __ea ea_lm_ptr2 = (char *)lm_str; + +struct foo { + int first; + __ea char *ptr; + int last; +}; + +__ea struct foo ea_struct1 = { + 10, + (__ea char *)0, + 11, +}; + +__ea struct foo ea_struct2 = { + 20, + 0, + 21, +}; + +struct foo ea_struct3 = { + 30, + ea_str, + 31, +}; + +struct foo ea_struct4 = { + 40, + (__ea char *)lm_str, /* { dg-error "(initializer element is not constant)|(near initialization)" "" } */ + 41, +}; + +struct bar { + int first; + char *ptr; + int last; +}; + +__ea struct bar ea_struct5 = { + 50, + 0, + 51, +}; + +__ea struct bar ea_struct6 = { + 60, + (char *)0, + 61, +}; + +__ea struct bar ea_struct7 = { + 70, + lm_str, + 71, +}; + +struct bar lm_struct8 = { + 80, + 0, + 81, +}; + +struct bar lm_struct9 = { + 90, + (char *)0, + 91, +}; + +struct bar lm_struct10 = { + 100, + lm_str, + 101, +}; diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/execute1.c b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/execute1.c new file mode 100644 index 000000000..99d6d6918 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/execute1.c @@ -0,0 +1,41 @@ +/* Copyright (C) 2009 Free Software Foundation, Inc. + + This file 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 file 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 this file; see the file COPYING3. If not see + . */ + +/* { dg-do compile } */ + +#include + +__ea char str[] = "abc"; + +int +main (void) +{ + __ea char *p = str; + + if (*p++ != 'a') + abort (); + + if (*p++ != 'b') + abort (); + + if (*p++ != 'c') + abort (); + + if (*p++ != '\0') + abort (); + + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/execute2.c b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/execute2.c new file mode 100644 index 000000000..5fce4e673 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/execute2.c @@ -0,0 +1,41 @@ +/* Copyright (C) 2009 Free Software Foundation, Inc. + + This file 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 file 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 this file; see the file COPYING3. If not see + . */ + +/* { dg-do run } */ + +#include + +char str[] = "abc"; + +int +main (void) +{ + __ea char *p = (__ea char *)str; + + if (*p++ != 'a') + abort (); + + if (*p++ != 'b') + abort (); + + if (*p++ != 'c') + abort (); + + if (*p++ != '\0') + abort (); + + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/execute3.c b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/execute3.c new file mode 100644 index 000000000..1b8c139d7 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/execute3.c @@ -0,0 +1,39 @@ +/* Copyright (C) 2009 Free Software Foundation, Inc. + + This file 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 file 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 this file; see the file COPYING3. If not see + . */ + +/* { dg-do run } */ + +#include + +int +main (void) +{ + __ea char *p = (__ea char *)"abc"; + + if (*p++ != 'a') + abort (); + + if (*p++ != 'b') + abort (); + + if (*p++ != 'c') + abort (); + + if (*p++ != '\0') + abort (); + + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/ops1.c b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/ops1.c new file mode 100644 index 000000000..0d162f218 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/ops1.c @@ -0,0 +1,94 @@ +/* Copyright (C) 2009 Free Software Foundation, Inc. + + This file 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 file 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 this file; see the file COPYING3. If not see + . */ + +/* This is the same as ops2.c except for the compile option. + If you modify this code, please modify ops2.c as well. */ + +/* { dg-do compile } */ +/* { dg-options "-O2 -std=gnu99 -pedantic-errors -maddress-space-conversion" } */ + +#define __lm + +__ea int ea_var = 1; +__lm int lm_var = 2; + +typedef __ea int *ea_ptr_t; +typedef __lm int *lm_ptr_t; + +typedef __ea void *ea_vptr_t; +typedef __lm void *lm_vptr_t; + +ea_ptr_t ea, ea2; +lm_ptr_t lm, lm2; + +ea_vptr_t eav; +lm_vptr_t lmv; + +extern void call_ea (ea_ptr_t); +extern void call_lm (lm_ptr_t); + +/* Assignment, initialization, argument passing, and return. */ +void to_ea (void) { ea = lm; } +void to_lm (void) { lm = ea; } /* { dg-error "assignment from pointer to non-enclosed address space" } */ +void init_ea (void) { ea_ptr_t l_ea = lm; } +void init_lm (void) { lm_ptr_t l_lm = ea; } /* { dg-error "initialization from pointer to non-enclosed address space" } */ +ea_ptr_t ret_ea (void) { return lm; } +lm_ptr_t ret_lm (void) { return ea; } /* { dg-error "return from pointer to non-enclosed address space" } */ +void call_ea2 (void) { call_ea (lm); } +void call_lm2 (void) { call_lm (ea); } /* { dg-error "passing argument 1 of 'call_lm' from pointer to non-enclosed address space" } */ + +/* Explicit casts. */ +void to_ea_with_cast (void) { ea = (ea_ptr_t)lm; } +void to_lm_with_cast (void) { lm = (lm_ptr_t)ea; } +void init_ea_with_cast (void) { ea_ptr_t l_ea = (ea_ptr_t)lm; } +void init_lm_with_cast (void) { lm_ptr_t l_lm = (lm_ptr_t)ea; } +ea_ptr_t ret_ea_with_cast (void) { return (ea_ptr_t)lm; } +lm_ptr_t ret_lm_with_cast (void) { return (lm_ptr_t)ea; } +void call_ea2_with_cast (void) { call_ea ((ea_ptr_t)lm); } +void call_lm2_with_cast (void) { call_lm ((lm_ptr_t)ea); } + +/* Arithmetic operators. */ +int sub_eaea (void) { return ea - ea2; } +int sub_ealm (void) { return ea - lm2; } +int sub_lmea (void) { return lm - ea2; } +int sub_lmlm (void) { return lm - lm2; } +ea_ptr_t if_eaea1 (int test) { return test? ea : ea2; } +lm_ptr_t if_eaea2 (int test) { return test? ea : ea2; } /* { dg-error "return from pointer to non-enclosed address space" } */ +ea_ptr_t if_ealm1 (int test) { return test? ea : lm2; } +lm_ptr_t if_ealm2 (int test) { return test? ea : lm2; } /* { dg-error "return from pointer to non-enclosed address space" } */ +ea_ptr_t if_lmea1 (int test) { return test? lm : ea2; } +lm_ptr_t if_lmea2 (int test) { return test? lm : ea2; } /* { dg-error "return from pointer to non-enclosed address space" } */ +ea_ptr_t if_lmlm1 (int test) { return test? lm : lm2; } +lm_ptr_t if_lmlm2 (int test) { return test? lm : lm2; } + +/* Relational operators. */ +int eq_eaea (void) { return ea == ea2; } +int eq_ealm (void) { return ea == lm2; } +int eq_lmea (void) { return lm == ea2; } +int eq_lmlm (void) { return lm == lm2; } +int lt_eaea (void) { return ea < ea2; } +int lt_ealm (void) { return ea < lm2; } +int lt_lmea (void) { return lm < ea2; } +int lt_lmlm (void) { return lm < lm2; } + +/* Null pointer. */ +void null_ea1 (void) { ea = 0; } +void null_ea2 (void) { ea = (void *)0; } +void null_ea3 (void) { ea = (__ea void *)0; } +void null_lm1 (void) { lm = 0; } +void null_lm2 (void) { lm = (void *)0; } +void null_lm3 (void) { lm = (__ea void *)0; } /* { dg-error "assignment from pointer to non-enclosed address space" } */ + diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/ops2.c b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/ops2.c new file mode 100644 index 000000000..2514e6b20 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/ops2.c @@ -0,0 +1,94 @@ +/* Copyright (C) 2009 Free Software Foundation, Inc. + + This file 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 file 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 this file; see the file COPYING3. If not see + . */ + +/* This is the same as ops1.c except for the compile option. + If you modify this code, please modify ops1.c as well. */ + +/* { dg-do compile } */ +/* { dg-options "-O2 -std=gnu99 -pedantic-errors -mno-address-space-conversion" } */ + +#define __lm + +__ea int ea_var = 1; +__lm int lm_var = 2; + +typedef __ea int *ea_ptr_t; +typedef __lm int *lm_ptr_t; + +typedef __ea void *ea_vptr_t; +typedef __lm void *lm_vptr_t; + +ea_ptr_t ea, ea2; +lm_ptr_t lm, lm2; + +ea_vptr_t eav; +lm_vptr_t lmv; + +extern void call_ea (ea_ptr_t); +extern void call_lm (lm_ptr_t); + +/* Assignment, initialization, argument passing, and return. */ +void to_ea (void) { ea = lm; } /* { dg-error "assignment from pointer to non-enclosed address space" } */ +void to_lm (void) { lm = ea; } /* { dg-error "assignment from pointer to non-enclosed address space" } */ +void init_ea (void) { ea_ptr_t l_ea = lm; } /* { dg-error "initialization from pointer to non-enclosed address space" } */ +void init_lm (void) { lm_ptr_t l_lm = ea; } /* { dg-error "initialization from pointer to non-enclosed address space" } */ +ea_ptr_t ret_ea (void) { return lm; } /* { dg-error "return from pointer to non-enclosed address space" } */ +lm_ptr_t ret_lm (void) { return ea; } /* { dg-error "return from pointer to non-enclosed address space" } */ +void call_ea2 (void) { call_ea (lm); } /* { dg-error "passing argument 1 of 'call_ea' from pointer to non-enclosed address space" } */ +void call_lm2 (void) { call_lm (ea); } /* { dg-error "passing argument 1 of 'call_lm' from pointer to non-enclosed address space" } */ + +/* Explicit casts. */ +void to_ea_with_cast (void) { ea = (ea_ptr_t)lm; } /* { dg-warning "cast to __ea address space pointer" } */ +void to_lm_with_cast (void) { lm = (lm_ptr_t)ea; } /* { dg-warning "cast to generic address space pointer" } */ +void init_ea_with_cast (void) { ea_ptr_t l_ea = (ea_ptr_t)lm; } /* { dg-warning "cast to __ea address space pointer" } */ +void init_lm_with_cast (void) { lm_ptr_t l_lm = (lm_ptr_t)ea; } /* { dg-warning "cast to generic address space pointer" } */ +ea_ptr_t ret_ea_with_cast (void) { return (ea_ptr_t)lm; } /* { dg-warning "cast to __ea address space pointer" } */ +lm_ptr_t ret_lm_with_cast (void) { return (lm_ptr_t)ea; } /* { dg-warning "cast to generic address space pointer" } */ +void call_ea2_with_cast (void) { call_ea ((ea_ptr_t)lm); } /* { dg-warning "cast to __ea address space pointer" } */ +void call_lm2_with_cast (void) { call_lm ((lm_ptr_t)ea); } /* { dg-warning "cast to generic address space pointer" } */ + +/* Arithmetic operators. */ +int sub_eaea (void) { return ea - ea2; } +int sub_ealm (void) { return ea - lm2; } /* { dg-error "invalid operands to binary -" } */ +int sub_lmea (void) { return lm - ea2; } /* { dg-error "invalid operands to binary -" } */ +int sub_lmlm (void) { return lm - lm2; } +ea_ptr_t if_eaea1 (int test) { return test? ea : ea2; } +lm_ptr_t if_eaea2 (int test) { return test? ea : ea2; } /* { dg-error "return from pointer to non-enclosed address space" } */ +ea_ptr_t if_ealm1 (int test) { return test? ea : lm2; } /* { dg-error "pointers to disjoint address spaces used in conditional expression" } */ +lm_ptr_t if_ealm2 (int test) { return test? ea : lm2; } /* { dg-error "pointers to disjoint address spaces used in conditional expression" } */ +ea_ptr_t if_lmea1 (int test) { return test? lm : ea2; } /* { dg-error "pointers to disjoint address spaces used in conditional expression" } */ +lm_ptr_t if_lmea2 (int test) { return test? lm : ea2; } /* { dg-error "pointers to disjoint address spaces used in conditional expression" } */ +ea_ptr_t if_lmlm1 (int test) { return test? lm : lm2; } /* { dg-error "return from pointer to non-enclosed address space" } */ +lm_ptr_t if_lmlm2 (int test) { return test? lm : lm2; } + +/* Relational operators. */ +int eq_eaea (void) { return ea == ea2; } +int eq_ealm (void) { return ea == lm2; } /* { dg-error "comparison of pointers to disjoint address spaces" } */ +int eq_lmea (void) { return lm == ea2; } /* { dg-error "comparison of pointers to disjoint address spaces" } */ +int eq_lmlm (void) { return lm == lm2; } +int lt_eaea (void) { return ea < ea2; } +int lt_ealm (void) { return ea < lm2; } /* { dg-error "comparison of pointers to disjoint address spaces" } */ +int lt_lmea (void) { return lm < ea2; } /* { dg-error "comparison of pointers to disjoint address spaces" } */ +int lt_lmlm (void) { return lm < lm2; } + +/* Null pointer. */ +void null_ea1 (void) { ea = 0; } +void null_ea2 (void) { ea = (void *)0; } +void null_ea3 (void) { ea = (__ea void *)0; } +void null_lm1 (void) { lm = 0; } +void null_lm2 (void) { lm = (void *)0; } +void null_lm3 (void) { lm = (__ea void *)0; } /* { dg-error "assignment from pointer to non-enclosed address space" } */ + diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/options1.c b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/options1.c new file mode 100644 index 000000000..190400902 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/options1.c @@ -0,0 +1,22 @@ +/* Copyright (C) 2009 Free Software Foundation, Inc. + + This file 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 file 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 this file; see the file COPYING3. If not see + . */ + +/* Test -mcache-size. */ + +/* { dg-do compile } */ +/* { dg-options "-mcache-size=128" } */ + +int x; diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/pr41857.c b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/pr41857.c new file mode 100644 index 000000000..17710674c --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/pr41857.c @@ -0,0 +1,29 @@ +/* Copyright (C) 2009 Free Software Foundation, Inc. + + This file 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 file 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 this file; see the file COPYING3. If not see + . */ + +/* { dg-do compile } */ + +__ea char *strchr_ea (__ea const char *s, int c); +__ea char *foo (__ea char *s) +{ + __ea char *ret = s; + int i; + + for (i = 0; i < 3; i++) + ret = strchr_ea (ret, s[i]); + + return ret; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/test-sizes.c b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/test-sizes.c new file mode 100644 index 000000000..e467616b6 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/spu/ea/test-sizes.c @@ -0,0 +1,608 @@ +/* Copyright (C) 2009 Free Software Foundation, Inc. + + This file 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 file 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 this file; see the file COPYING3. If not see + . */ + +/* { dg-do run } */ + +#ifdef __EA32__ +#define EA_PTRSIZE 4 +#endif +#ifdef __EA64__ +#define EA_PTRSIZE 8 +#endif + +#if !defined(LEVEL1) && !defined(LEVEL2) && !defined(LEVEL3) +#define LEVEL1 1 /* single pointer indirection */ +#define LEVEL2 1 /* 2 levels of pointer indirection */ +#define LEVEL3 1 /* 3 levels of pointer indirection */ + +#else +#ifndef LEVEL1 +#define LEVEL1 0 +#endif + +#ifndef LEVEL2 +#define LEVEL2 0 +#endif + +#ifndef LEVEL3 +#define LEVEL3 0 +#endif +#endif + +#if !defined(USE_SIMPLE) && !defined(USE_COMPLEX) +#define USE_SIMPLE 1 /* build up pointers via multiple typedefs */ +#define USE_COMPLEX 1 /* single typedef for pointer indirections */ + +#else +#ifndef USE_SIMPLE +#define USE_SIMPLE 0 +#endif + +#ifndef USE_COMPLEX +#define USE_COMPLEX 0 +#endif +#endif + +#if !defined(USE_LOCAL_VAR) && !defined(USE_EA_VAR) +#define USE_LOCAL_VAR 1 /* use variables declared locally */ +#define USE_EA_VAR 1 /* use variables on the host */ + +#else +#ifndef USE_LOCAL_VAR +#define USE_LOCAL_VAR 0 +#endif + +#ifndef USE_EA_VAR +#define USE_EA_VAR 0 +#endif +#endif + +static int errors; + +#ifdef USE_PRINTF /* print results via printf */ +#include +#include + +static int num_tests; + +#define TEST_SIZE(EXPR, EXPECTED) \ +do { \ + char *msg; \ + \ + if (sizeof (EXPR) != EXPECTED) \ + { \ + msg = ", FAIL"; \ + errors++; \ + } \ + else \ + msg = ""; \ + \ + num_tests++; \ + printf ("sizeof %-20s = %2u, expected = %2u%s\n", \ + #EXPR, \ + (unsigned) sizeof (EXPR), \ + (unsigned) EXPECTED, \ + msg); \ +} while (0) + +#define PRINT1(FMT) printf (FMT) +#define PRINT2(FMT,A1) printf (FMT,A1) +#define PRINT3(FMT,A1,A2) printf (FMT,A1,A2) + +#else /* standalone */ +extern void abort (void); + +#define TEST_SIZE(EXPR, EXPECTED) \ +do { \ + if (sizeof (EXPR) != EXPECTED) \ + abort (); \ +} while (0) + +#define PRINT1(FMT) +#define PRINT2(FMT,ARG) +#define PRINT3(FMT,A1,A2) +#endif + +/* 'local memory' hack to keep the same spacing. */ +#define __lm + +#if USE_SIMPLE +#if (LEVEL1 || LEVEL2 || LEVEL3) +typedef __lm char *lm_ptr_t; +typedef __ea char *ea_ptr_t; +#endif + +#if LEVEL1 +#if USE_LOCAL_VAR +__lm lm_ptr_t lm_ptr; +__lm ea_ptr_t ea_ptr; +#endif + +#if USE_EA_VAR +__ea lm_ptr_t lm_ptr_ea; +__ea ea_ptr_t ea_ptr_ea; +#endif +#endif + +#if (LEVEL2 || LEVEL3) +typedef __lm lm_ptr_t *lm_lm_ptr_t; +typedef __ea lm_ptr_t *ea_lm_ptr_t; +typedef __lm ea_ptr_t *lm_ea_ptr_t; +typedef __ea ea_ptr_t *ea_ea_ptr_t; +#endif + +#if LEVEL2 +#if USE_LOCAL_VAR +__lm lm_lm_ptr_t lm_lm_ptr; +__lm ea_lm_ptr_t ea_lm_ptr; +__lm lm_ea_ptr_t lm_ea_ptr; +__lm ea_ea_ptr_t ea_ea_ptr; +#endif + +#if USE_EA_VAR +__ea lm_lm_ptr_t lm_lm_ptr_ea; +__ea ea_lm_ptr_t ea_lm_ptr_ea; +__ea lm_ea_ptr_t lm_ea_ptr_ea; +__ea ea_ea_ptr_t ea_ea_ptr_ea; +#endif +#endif + +#if LEVEL3 +typedef __lm lm_lm_ptr_t *lm_lm_lm_ptr_t; +typedef __ea lm_lm_ptr_t *ea_lm_lm_ptr_t; +typedef __lm ea_lm_ptr_t *lm_ea_lm_ptr_t; +typedef __ea ea_lm_ptr_t *ea_ea_lm_ptr_t; +typedef __lm lm_ea_ptr_t *lm_lm_ea_ptr_t; +typedef __ea lm_ea_ptr_t *ea_lm_ea_ptr_t; +typedef __lm ea_ea_ptr_t *lm_ea_ea_ptr_t; +typedef __ea ea_ea_ptr_t *ea_ea_ea_ptr_t; + +#if USE_LOCAL_VAR +__lm lm_lm_lm_ptr_t lm_lm_lm_ptr; +__lm ea_lm_lm_ptr_t ea_lm_lm_ptr; +__lm lm_ea_lm_ptr_t lm_ea_lm_ptr; +__lm ea_ea_lm_ptr_t ea_ea_lm_ptr; +__lm lm_lm_ea_ptr_t lm_lm_ea_ptr; +__lm ea_lm_ea_ptr_t ea_lm_ea_ptr; +__lm lm_ea_ea_ptr_t lm_ea_ea_ptr; +__lm ea_ea_ea_ptr_t ea_ea_ea_ptr; +#endif + +#if USE_EA_VAR +__ea lm_lm_lm_ptr_t lm_lm_lm_ptr_ea; +__ea ea_lm_lm_ptr_t ea_lm_lm_ptr_ea; +__ea lm_ea_lm_ptr_t lm_ea_lm_ptr_ea; +__ea ea_ea_lm_ptr_t ea_ea_lm_ptr_ea; +__ea lm_lm_ea_ptr_t lm_lm_ea_ptr_ea; +__ea ea_lm_ea_ptr_t ea_lm_ea_ptr_ea; +__ea lm_ea_ea_ptr_t lm_ea_ea_ptr_ea; +__ea ea_ea_ea_ptr_t ea_ea_ea_ptr_ea; +#endif +#endif +#endif + +#if USE_COMPLEX +#if LEVEL1 +#if USE_LOCAL_VAR +__lm char *__lm lm_cptr; +__ea char *__lm ea_cptr; +#endif + +#if USE_EA_VAR +__lm char *__ea lm_cptr_ea; +__ea char *__ea ea_cptr_ea; +#endif +#endif + +#if LEVEL2 +#if USE_LOCAL_VAR +__lm char *__lm *__lm lm_lm_cptr; +__lm char *__ea *__lm ea_lm_cptr; +__ea char *__lm *__lm lm_ea_cptr; +__ea char *__ea *__lm ea_ea_cptr; +#endif + +#if USE_EA_VAR +__lm char *__lm *__ea lm_lm_cptr_ea; +__lm char *__ea *__ea ea_lm_cptr_ea; +__ea char *__lm *__ea lm_ea_cptr_ea; +__ea char *__ea *__ea ea_ea_cptr_ea; +#endif +#endif + +#if LEVEL3 +#if USE_LOCAL_VAR +__lm char *__lm *__lm *__lm lm_lm_lm_cptr; +__lm char *__ea *__lm *__lm lm_ea_lm_cptr; +__ea char *__lm *__lm *__lm lm_lm_ea_cptr; +__ea char *__ea *__lm *__lm lm_ea_ea_cptr; +__lm char *__lm *__ea *__lm ea_lm_lm_cptr; +__lm char *__ea *__ea *__lm ea_ea_lm_cptr; +__ea char *__lm *__ea *__lm ea_lm_ea_cptr; +__ea char *__ea *__ea *__lm ea_ea_ea_cptr; +#endif + +#if USE_EA_VAR +__lm char *__lm *__lm *__ea lm_lm_lm_cptr_ea; +__lm char *__ea *__lm *__ea lm_ea_lm_cptr_ea; +__ea char *__lm *__lm *__ea lm_lm_ea_cptr_ea; +__ea char *__ea *__lm *__ea lm_ea_ea_cptr_ea; +__lm char *__lm *__ea *__ea ea_lm_lm_cptr_ea; +__lm char *__ea *__ea *__ea ea_ea_lm_cptr_ea; +__ea char *__lm *__ea *__ea ea_lm_ea_cptr_ea; +__ea char *__ea *__ea *__ea ea_ea_ea_cptr_ea; +#endif +#endif +#endif + +int +main () +{ + PRINT2 ("LEVEL1 = %d\n", LEVEL1); + PRINT2 ("LEVEL2 = %d\n", LEVEL2); + PRINT2 ("LEVEL3 = %d\n", LEVEL3); + PRINT2 ("USE_SIMPLE = %d\n", USE_SIMPLE); + PRINT2 ("USE_COMPLEX = %d\n", USE_COMPLEX); + PRINT2 ("USE_LOCAL_VAR = %d\n", USE_LOCAL_VAR); + PRINT2 ("USE_EA_VAR = %d\n", USE_EA_VAR); + PRINT1 ("\n"); + +#if USE_SIMPLE +#if LEVEL1 +#if USE_LOCAL_VAR + TEST_SIZE ( lm_ptr, 4); + TEST_SIZE (*lm_ptr, 1); + TEST_SIZE ( ea_ptr, EA_PTRSIZE); + TEST_SIZE (*ea_ptr, 1); + PRINT1 ("\n"); +#endif + +#if USE_EA_VAR + TEST_SIZE ( lm_ptr_ea, 4); + TEST_SIZE (*lm_ptr_ea, 1); + TEST_SIZE ( ea_ptr_ea, EA_PTRSIZE); + TEST_SIZE (*ea_ptr_ea, 1); + PRINT1 ("\n"); +#endif +#endif + +#if LEVEL2 +#if USE_LOCAL_VAR + TEST_SIZE ( lm_lm_ptr, 4); + TEST_SIZE ( *lm_lm_ptr, 4); + TEST_SIZE (**lm_lm_ptr, 1); + PRINT1 ("\n"); + + TEST_SIZE ( lm_ea_ptr, 4); + TEST_SIZE ( *lm_ea_ptr, EA_PTRSIZE); + TEST_SIZE (**lm_ea_ptr, 1); + PRINT1 ("\n"); + + TEST_SIZE ( ea_lm_ptr, EA_PTRSIZE); + TEST_SIZE ( *ea_lm_ptr, 4); + TEST_SIZE (**ea_lm_ptr, 1); + PRINT1 ("\n"); + + TEST_SIZE ( ea_ea_ptr, EA_PTRSIZE); + TEST_SIZE ( *ea_ea_ptr, EA_PTRSIZE); + TEST_SIZE (**ea_ea_ptr, 1); + PRINT1 ("\n"); +#endif + +#if USE_EA_VAR + TEST_SIZE ( lm_lm_ptr_ea, 4); + TEST_SIZE ( *lm_lm_ptr_ea, 4); + TEST_SIZE (**lm_lm_ptr_ea, 1); + PRINT1 ("\n"); + + TEST_SIZE ( lm_ea_ptr_ea, 4); + TEST_SIZE ( *lm_ea_ptr_ea, EA_PTRSIZE); + TEST_SIZE (**lm_ea_ptr_ea, 1); + PRINT1 ("\n"); + + TEST_SIZE ( ea_lm_ptr_ea, EA_PTRSIZE); + TEST_SIZE ( *ea_lm_ptr_ea, 4); + TEST_SIZE (**ea_lm_ptr_ea, 1); + PRINT1 ("\n"); + + TEST_SIZE ( ea_ea_ptr_ea, EA_PTRSIZE); + TEST_SIZE ( *ea_ea_ptr_ea, EA_PTRSIZE); + TEST_SIZE (**ea_ea_ptr_ea, 1); + PRINT1 ("\n"); +#endif +#endif + +#if LEVEL3 +#if USE_LOCAL_VAR + TEST_SIZE ( lm_lm_lm_ptr, 4); + TEST_SIZE ( *lm_lm_lm_ptr, 4); + TEST_SIZE ( **lm_lm_lm_ptr, 4); + TEST_SIZE (***lm_lm_lm_ptr, 1); + PRINT1 ("\n"); + + TEST_SIZE ( lm_lm_ea_ptr, 4); + TEST_SIZE ( *lm_lm_ea_ptr, 4); + TEST_SIZE ( **lm_lm_ea_ptr, EA_PTRSIZE); + TEST_SIZE (***lm_lm_ea_ptr, 1); + PRINT1 ("\n"); + + TEST_SIZE ( lm_ea_lm_ptr, 4); + TEST_SIZE ( *lm_ea_lm_ptr, EA_PTRSIZE); + TEST_SIZE ( **lm_ea_lm_ptr, 4); + TEST_SIZE (***lm_ea_lm_ptr, 1); + PRINT1 ("\n"); + + TEST_SIZE ( lm_ea_ea_ptr, 4); + TEST_SIZE ( *lm_ea_ea_ptr, EA_PTRSIZE); + TEST_SIZE ( **lm_ea_ea_ptr, EA_PTRSIZE); + TEST_SIZE (***lm_ea_ea_ptr, 1); + PRINT1 ("\n"); + + TEST_SIZE ( ea_lm_lm_ptr, EA_PTRSIZE); + TEST_SIZE ( *ea_lm_lm_ptr, 4); + TEST_SIZE ( **ea_lm_lm_ptr, 4); + TEST_SIZE (***ea_lm_lm_ptr, 1); + PRINT1 ("\n"); + + TEST_SIZE ( ea_lm_ea_ptr, EA_PTRSIZE); + TEST_SIZE ( *ea_lm_ea_ptr, 4); + TEST_SIZE ( **ea_lm_ea_ptr, EA_PTRSIZE); + TEST_SIZE (***ea_lm_ea_ptr, 1); + PRINT1 ("\n"); + + TEST_SIZE ( ea_ea_lm_ptr, EA_PTRSIZE); + TEST_SIZE ( *ea_ea_lm_ptr, EA_PTRSIZE); + TEST_SIZE ( **ea_ea_lm_ptr, 4); + TEST_SIZE (***ea_ea_lm_ptr, 1); + PRINT1 ("\n"); + + TEST_SIZE ( ea_ea_ea_ptr, EA_PTRSIZE); + TEST_SIZE ( *ea_ea_ea_ptr, EA_PTRSIZE); + TEST_SIZE ( **ea_ea_ea_ptr, EA_PTRSIZE); + TEST_SIZE (***ea_ea_ea_ptr, 1); + PRINT1 ("\n"); +#endif + +#if USE_EA_VAR + TEST_SIZE ( lm_lm_lm_ptr_ea, 4); + TEST_SIZE ( *lm_lm_lm_ptr_ea, 4); + TEST_SIZE ( **lm_lm_lm_ptr_ea, 4); + TEST_SIZE (***lm_lm_lm_ptr_ea, 1); + PRINT1 ("\n"); + + TEST_SIZE ( lm_lm_ea_ptr_ea, 4); + TEST_SIZE ( *lm_lm_ea_ptr_ea, 4); + TEST_SIZE ( **lm_lm_ea_ptr_ea, EA_PTRSIZE); + TEST_SIZE (***lm_lm_ea_ptr_ea, 1); + PRINT1 ("\n"); + + TEST_SIZE ( lm_ea_lm_ptr_ea, 4); + TEST_SIZE ( *lm_ea_lm_ptr_ea, EA_PTRSIZE); + TEST_SIZE ( **lm_ea_lm_ptr_ea, 4); + TEST_SIZE (***lm_ea_lm_ptr_ea, 1); + PRINT1 ("\n"); + + TEST_SIZE ( lm_ea_ea_ptr_ea, 4); + TEST_SIZE ( *lm_ea_ea_ptr_ea, EA_PTRSIZE); + TEST_SIZE ( **lm_ea_ea_ptr_ea, EA_PTRSIZE); + TEST_SIZE (***lm_ea_ea_ptr_ea, 1); + PRINT1 ("\n"); + + TEST_SIZE ( ea_lm_lm_ptr_ea, EA_PTRSIZE); + TEST_SIZE ( *ea_lm_lm_ptr_ea, 4); + TEST_SIZE ( **ea_lm_lm_ptr_ea, 4); + TEST_SIZE (***ea_lm_lm_ptr_ea, 1); + PRINT1 ("\n"); + + TEST_SIZE ( ea_lm_ea_ptr_ea, EA_PTRSIZE); + TEST_SIZE ( *ea_lm_ea_ptr_ea, 4); + TEST_SIZE ( **ea_lm_ea_ptr_ea, EA_PTRSIZE); + TEST_SIZE (***ea_lm_ea_ptr_ea, 1); + PRINT1 ("\n"); + + TEST_SIZE ( ea_ea_lm_ptr_ea, EA_PTRSIZE); + TEST_SIZE ( *ea_ea_lm_ptr_ea, EA_PTRSIZE); + TEST_SIZE ( **ea_ea_lm_ptr_ea, 4); + TEST_SIZE (***ea_ea_lm_ptr_ea, 1); + PRINT1 ("\n"); + + TEST_SIZE ( ea_ea_ea_ptr_ea, EA_PTRSIZE); + TEST_SIZE ( *ea_ea_ea_ptr_ea, EA_PTRSIZE); + TEST_SIZE ( **ea_ea_ea_ptr_ea, EA_PTRSIZE); + TEST_SIZE (***ea_ea_ea_ptr_ea, 1); + PRINT1 ("\n"); +#endif +#endif +#endif + +#if USE_COMPLEX +#if LEVEL1 +#if USE_LOCAL_VAR + TEST_SIZE ( lm_cptr, 4); + TEST_SIZE (*lm_cptr, 1); + TEST_SIZE ( ea_cptr, EA_PTRSIZE); + TEST_SIZE (*ea_cptr, 1); + PRINT1 ("\n"); +#endif + +#if USE_EA_VAR + TEST_SIZE ( lm_cptr_ea, 4); + TEST_SIZE (*lm_cptr_ea, 1); + TEST_SIZE ( ea_cptr_ea, EA_PTRSIZE); + TEST_SIZE (*ea_cptr_ea, 1); + PRINT1 ("\n"); +#endif +#endif + +#if LEVEL2 +#if USE_LOCAL_VAR + TEST_SIZE ( lm_lm_cptr, 4); + TEST_SIZE ( *lm_lm_cptr, 4); + TEST_SIZE (**lm_lm_cptr, 1); + PRINT1 ("\n"); + + TEST_SIZE ( lm_ea_cptr, 4); + TEST_SIZE ( *lm_ea_cptr, EA_PTRSIZE); + TEST_SIZE (**lm_ea_cptr, 1); + PRINT1 ("\n"); + + TEST_SIZE ( ea_lm_cptr, EA_PTRSIZE); + TEST_SIZE ( *ea_lm_cptr, 4); + TEST_SIZE (**ea_lm_cptr, 1); + PRINT1 ("\n"); + + TEST_SIZE ( ea_ea_cptr, EA_PTRSIZE); + TEST_SIZE ( *ea_ea_cptr, EA_PTRSIZE); + TEST_SIZE (**ea_ea_cptr, 1); + PRINT1 ("\n"); +#endif + +#if USE_EA_VAR + TEST_SIZE ( lm_lm_cptr_ea, 4); + TEST_SIZE ( *lm_lm_cptr_ea, 4); + TEST_SIZE (**lm_lm_cptr_ea, 1); + PRINT1 ("\n"); + + TEST_SIZE ( lm_ea_cptr_ea, 4); + TEST_SIZE ( *lm_ea_cptr_ea, EA_PTRSIZE); + TEST_SIZE (**lm_ea_cptr_ea, 1); + PRINT1 ("\n"); + + TEST_SIZE ( ea_lm_cptr_ea, EA_PTRSIZE); + TEST_SIZE ( *ea_lm_cptr_ea, 4); + TEST_SIZE (**ea_lm_cptr_ea, 1); + PRINT1 ("\n"); + + TEST_SIZE ( ea_ea_cptr_ea, EA_PTRSIZE); + TEST_SIZE ( *ea_ea_cptr_ea, EA_PTRSIZE); + TEST_SIZE (**ea_ea_cptr_ea, 1); + PRINT1 ("\n"); +#endif +#endif + +#if LEVEL3 +#if USE_LOCAL_VAR + TEST_SIZE ( lm_lm_lm_cptr, 4); + TEST_SIZE ( *lm_lm_lm_cptr, 4); + TEST_SIZE ( **lm_lm_lm_cptr, 4); + TEST_SIZE (***lm_lm_lm_cptr, 1); + PRINT1 ("\n"); + + TEST_SIZE ( lm_lm_ea_cptr, 4); + TEST_SIZE ( *lm_lm_ea_cptr, 4); + TEST_SIZE ( **lm_lm_ea_cptr, EA_PTRSIZE); + TEST_SIZE (***lm_lm_ea_cptr, 1); + PRINT1 ("\n"); + + TEST_SIZE ( lm_ea_lm_cptr, 4); + TEST_SIZE ( *lm_ea_lm_cptr, EA_PTRSIZE); + TEST_SIZE ( **lm_ea_lm_cptr, 4); + TEST_SIZE (***lm_ea_lm_cptr, 1); + PRINT1 ("\n"); + + TEST_SIZE ( lm_ea_ea_cptr, 4); + TEST_SIZE ( *lm_ea_ea_cptr, EA_PTRSIZE); + TEST_SIZE ( **lm_ea_ea_cptr, EA_PTRSIZE); + TEST_SIZE (***lm_ea_ea_cptr, 1); + PRINT1 ("\n"); + + TEST_SIZE ( ea_lm_lm_cptr, EA_PTRSIZE); + TEST_SIZE ( *ea_lm_lm_cptr, 4); + TEST_SIZE ( **ea_lm_lm_cptr, 4); + TEST_SIZE (***ea_lm_lm_cptr, 1); + PRINT1 ("\n"); + + TEST_SIZE ( ea_lm_ea_cptr, EA_PTRSIZE); + TEST_SIZE ( *ea_lm_ea_cptr, 4); + TEST_SIZE ( **ea_lm_ea_cptr, EA_PTRSIZE); + TEST_SIZE (***ea_lm_ea_cptr, 1); + PRINT1 ("\n"); + + TEST_SIZE ( ea_ea_lm_cptr, EA_PTRSIZE); + TEST_SIZE ( *ea_ea_lm_cptr, EA_PTRSIZE); + TEST_SIZE ( **ea_ea_lm_cptr, 4); + TEST_SIZE (***ea_ea_lm_cptr, 1); + PRINT1 ("\n"); + + TEST_SIZE ( ea_ea_ea_cptr, EA_PTRSIZE); + TEST_SIZE ( *ea_ea_ea_cptr, EA_PTRSIZE); + TEST_SIZE ( **ea_ea_ea_cptr, EA_PTRSIZE); + TEST_SIZE (***ea_ea_ea_cptr, 1); + PRINT1 ("\n"); +#endif + +#if USE_EA_VAR + TEST_SIZE ( lm_lm_lm_cptr_ea, 4); + TEST_SIZE ( *lm_lm_lm_cptr_ea, 4); + TEST_SIZE ( **lm_lm_lm_cptr_ea, 4); + TEST_SIZE (***lm_lm_lm_cptr_ea, 1); + PRINT1 ("\n"); + + TEST_SIZE ( lm_lm_ea_cptr_ea, 4); + TEST_SIZE ( *lm_lm_ea_cptr_ea, 4); + TEST_SIZE ( **lm_lm_ea_cptr_ea, EA_PTRSIZE); + TEST_SIZE (***lm_lm_ea_cptr_ea, 1); + PRINT1 ("\n"); + + TEST_SIZE ( lm_ea_lm_cptr_ea, 4); + TEST_SIZE ( *lm_ea_lm_cptr_ea, EA_PTRSIZE); + TEST_SIZE ( **lm_ea_lm_cptr_ea, 4); + TEST_SIZE (***lm_ea_lm_cptr_ea, 1); + PRINT1 ("\n"); + + TEST_SIZE ( lm_ea_ea_cptr_ea, 4); + TEST_SIZE ( *lm_ea_ea_cptr_ea, EA_PTRSIZE); + TEST_SIZE ( **lm_ea_ea_cptr_ea, EA_PTRSIZE); + TEST_SIZE (***lm_ea_ea_cptr_ea, 1); + PRINT1 ("\n"); + + TEST_SIZE ( ea_lm_lm_cptr_ea, EA_PTRSIZE); + TEST_SIZE ( *ea_lm_lm_cptr_ea, 4); + TEST_SIZE ( **ea_lm_lm_cptr_ea, 4); + TEST_SIZE (***ea_lm_lm_cptr_ea, 1); + PRINT1 ("\n"); + + TEST_SIZE ( ea_lm_ea_cptr_ea, EA_PTRSIZE); + TEST_SIZE ( *ea_lm_ea_cptr_ea, 4); + TEST_SIZE ( **ea_lm_ea_cptr_ea, EA_PTRSIZE); + TEST_SIZE (***ea_lm_ea_cptr_ea, 1); + PRINT1 ("\n"); + + TEST_SIZE ( ea_ea_lm_cptr_ea, EA_PTRSIZE); + TEST_SIZE ( *ea_ea_lm_cptr_ea, EA_PTRSIZE); + TEST_SIZE ( **ea_ea_lm_cptr_ea, 4); + TEST_SIZE (***ea_ea_lm_cptr_ea, 1); + PRINT1 ("\n"); + + TEST_SIZE ( ea_ea_ea_cptr_ea, EA_PTRSIZE); + TEST_SIZE ( *ea_ea_ea_cptr_ea, EA_PTRSIZE); + TEST_SIZE ( **ea_ea_ea_cptr_ea, EA_PTRSIZE); + TEST_SIZE (***ea_ea_ea_cptr_ea, 1); + PRINT1 ("\n"); +#endif +#endif +#endif + + if (errors) + { + PRINT3 ("%d error(s), %d test(s)\n", errors, num_tests); + abort (); + } + else + PRINT2 ("No errors, %d test(s)\n", num_tests); + + return 0; +} -- cgit v1.2.3