From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- gcc/testsuite/gcc.target/avr/avr.exp | 41 +++++++ .../gcc.target/avr/torture/avr-torture.exp | 61 ++++++++++ gcc/testsuite/gcc.target/avr/torture/pr41885.c | 123 +++++++++++++++++++++ gcc/testsuite/gcc.target/avr/torture/pr51374-1.c | 15 +++ gcc/testsuite/gcc.target/avr/torture/trivial.c | 14 +++ gcc/testsuite/gcc.target/avr/trivial.c | 14 +++ 6 files changed, 268 insertions(+) create mode 100644 gcc/testsuite/gcc.target/avr/avr.exp create mode 100644 gcc/testsuite/gcc.target/avr/torture/avr-torture.exp create mode 100644 gcc/testsuite/gcc.target/avr/torture/pr41885.c create mode 100644 gcc/testsuite/gcc.target/avr/torture/pr51374-1.c create mode 100644 gcc/testsuite/gcc.target/avr/torture/trivial.c create mode 100644 gcc/testsuite/gcc.target/avr/trivial.c (limited to 'gcc/testsuite/gcc.target/avr') diff --git a/gcc/testsuite/gcc.target/avr/avr.exp b/gcc/testsuite/gcc.target/avr/avr.exp new file mode 100644 index 000000000..90aeed41e --- /dev/null +++ b/gcc/testsuite/gcc.target/avr/avr.exp @@ -0,0 +1,41 @@ +# Copyright (C) 2008 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 AVR target. +if ![istarget avr-*-*] 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/*.\[cCS\]]] \ + "" $DEFAULT_CFLAGS + +# All done. +dg-finish diff --git a/gcc/testsuite/gcc.target/avr/torture/avr-torture.exp b/gcc/testsuite/gcc.target/avr/torture/avr-torture.exp new file mode 100644 index 000000000..355b3ad88 --- /dev/null +++ b/gcc/testsuite/gcc.target/avr/torture/avr-torture.exp @@ -0,0 +1,61 @@ +# Copyright (C) 2008 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 `gcc-dg.exp' driver, looping over +# optimization options. + +# Exit immediately if this isn't a AVR target. +if { ![istarget avr-*-*] } 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 + + set AVR_TORTURE_OPTIONS [list \ + { -O0 } \ + { -O1 } \ + { -O2 } \ + { -O2 -mcall-prologues } \ + { -Os -fomit-frame-pointer } \ + { -Os -fomit-frame-pointer -finline-functions } \ + { -O3 -g } \ + { -Os -mcall-prologues} ] + + +#Initialize use of torture lists. +torture-init + +set-torture-options $AVR_TORTURE_OPTIONS + + +# Main loop. +gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] $DEFAULT_CFLAGS + +# Finalize use of torture lists. +torture-finish + +# All done. +dg-finish diff --git a/gcc/testsuite/gcc.target/avr/torture/pr41885.c b/gcc/testsuite/gcc.target/avr/torture/pr41885.c new file mode 100644 index 000000000..90d001212 --- /dev/null +++ b/gcc/testsuite/gcc.target/avr/torture/pr41885.c @@ -0,0 +1,123 @@ +/* { dg-options "-w -std=c99" } */ +/* { dg-do run } */ + +#include +#include +#include + + +uint16_t rotl_16a (uint16_t x) +{ + return (x << 8) | (x >> 8); +} +uint16_t rotl_16b (short dummy, uint16_t x) +{ + return (x << 8) | (x >> 8); +} + +uint32_t rotl_32a (uint32_t x) +{ + return (x << 8) | (x >> 24); +} +uint32_t rotl_32b (short dummy, uint32_t x) +{ + return (x << 8) | (x >> 24); +} +uint32_t rotl_32c (short dummy, uint32_t x) +{ + return (x << 16) | (x >> 16); +} +uint32_t rotl_32d (short dummy, uint32_t x) +{ + return (x << 24) | (x >> 8); +} +uint32_t rotl_32e (long dummy, uint32_t x) +{ + return (x << 24) | (x >> 8); +} + +uint64_t rotl_64 (uint64_t x) +{ + return (x << 56) | (x >> 8); +} + +uint64_t rotl_64a (short dummy, uint64_t x) +{ + return (x << 56) | (x >> 8); +} +uint64_t rotl_64b (short dummy, uint64_t x) +{ + return (x << 48) | (x >> 16); +} +uint64_t rotl_64c (short dummy, uint64_t x) +{ + return (x << 40) | (x >> 24); +} +uint64_t rotl_64d (short dummy, uint64_t x) +{ + return (x << 32) | (x >> 32); +} +uint64_t rotl_64e (short dummy, uint64_t x) +{ + return (x << 24) | (x >> 40); +} +uint64_t rotl_64f (short dummy, uint64_t x) +{ + return (x << 16) | (x >> 48); +} +uint64_t rotl_64g (short dummy, uint64_t x) +{ + return (x << 8) | (x >> 56); +} +uint64_t rotl_64h (long dummy, uint64_t x) +{ + return (x << 16) | (x >> 48); +} + + + + +int main (void) +{ + if (rotl_16a(0x1234) != 0x3412) + abort(); + if (rotl_16b(0xAA55,0x1234) != 0x3412) + abort(); + +uint32_t num32 = 0x12345678; + + if (rotl_32a(num32) != 0x34567812) + abort(); + if (rotl_32b(0xAA55,num32) != 0x34567812) + abort(); + if (rotl_32c(0xAA55,num32) != 0x56781234) + abort(); + if (rotl_32d(0xAA55,num32) != 0x78123456) + abort(); + if (rotl_32e(0x1122AA55,num32) != 0x78123456) + abort(); + +uint64_t num = 0x123456789ABCDEF0ULL; + + if (rotl_64(num) != 0xF0123456789ABCDEULL) + abort(); + if (rotl_64a(0xAA55,num) != 0xF0123456789ABCDEULL) + abort(); + if (rotl_64b(0xAA55,num) != 0xDEF0123456789ABCULL) + abort(); + if (rotl_64c(0xAA55,num) != 0xBCDEF0123456789AULL) + abort(); + if (rotl_64d(0xAA55,num) != 0x9ABCDEF012345678ULL) + abort(); + if (rotl_64e(0xAA55,num) != 0x789ABCDEF0123456ULL) + abort(); + if (rotl_64f(0xAA55,num) != 0x56789ABCDEF01234ULL) + abort(); + if (rotl_64g(0xAA55,num) != 0x3456789ABCDEF012ULL) + abort(); + if (rotl_64h(0x1122AA55,num) != 0x56789ABCDEF01234ULL) + abort(); + + exit (0); +} + diff --git a/gcc/testsuite/gcc.target/avr/torture/pr51374-1.c b/gcc/testsuite/gcc.target/avr/torture/pr51374-1.c new file mode 100644 index 000000000..9c98ea5f8 --- /dev/null +++ b/gcc/testsuite/gcc.target/avr/torture/pr51374-1.c @@ -0,0 +1,15 @@ +/* PR rtl-optimization/51374 */ +/* { dg-do compile } */ + +void vector_18 (void) +{ + extern char slot; + unsigned char status = (*(volatile unsigned char*) 0x2B); + unsigned char data = (*(volatile unsigned char*) 0x2C); + + if (status & 0x10) + slot = 0; +} + +/* { dg-final { scan-assembler-not "\tsbic " } } */ +/* { dg-final { scan-assembler-not "\tsbis " } } */ diff --git a/gcc/testsuite/gcc.target/avr/torture/trivial.c b/gcc/testsuite/gcc.target/avr/torture/trivial.c new file mode 100644 index 000000000..91163f922 --- /dev/null +++ b/gcc/testsuite/gcc.target/avr/torture/trivial.c @@ -0,0 +1,14 @@ +/* { dg-do run } */ +#include + +#define __ATTR_PROGMEM__ __attribute__((__progmem__)) + +#define PROGMEM __ATTR_PROGMEM__ +char PROGMEM a1 = 0x12; +int PROGMEM a2 = 0x2345; +long PROGMEM a3 = 0x12345678; +int main(void) +{ + printf("Hello World\n"); + return 0; +} diff --git a/gcc/testsuite/gcc.target/avr/trivial.c b/gcc/testsuite/gcc.target/avr/trivial.c new file mode 100644 index 000000000..91163f922 --- /dev/null +++ b/gcc/testsuite/gcc.target/avr/trivial.c @@ -0,0 +1,14 @@ +/* { dg-do run } */ +#include + +#define __ATTR_PROGMEM__ __attribute__((__progmem__)) + +#define PROGMEM __ATTR_PROGMEM__ +char PROGMEM a1 = 0x12; +int PROGMEM a2 = 0x2345; +long PROGMEM a3 = 0x12345678; +int main(void) +{ + printf("Hello World\n"); + return 0; +} -- cgit v1.2.3