From: Andre Vieira Date: Tue, 4 Oct 2016 14:13:52 +0000 (+0000) Subject: Add missing testcases from previous patch revision r240379, failed to svn add. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f5682f01d01f8f4f4c6ea47d267d0445e24c220c;p=gcc.git Add missing testcases from previous patch revision r240379, failed to svn add. From-SVN: r240746 --- diff --git a/gcc/testsuite/gcc.target/arm/pure-code/ffunction-sections.c b/gcc/testsuite/gcc.target/arm/pure-code/ffunction-sections.c new file mode 100644 index 00000000000..26fe38c0529 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/pure-code/ffunction-sections.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-skip-if "" { *-*-* } { "-fpic" "-fPIC" } { "" } } */ +/* { dg-options "-ffunction-sections -mpure-code" } */ +#include + +char * foo (void) +{ + return "foo"; +} + +unsigned int bar (unsigned int b) +{ + return UINT_MAX - b; +} + +/* { dg-final { scan-assembler {\.section\t\.text\.foo[^\n]*\"0x20000006\"} } } */ +/* { dg-final { scan-assembler {\.section\t\.text\.bar[^\n]*\"0x20000006\"} } } */ diff --git a/gcc/testsuite/gcc.target/arm/pure-code/no-casesi.c b/gcc/testsuite/gcc.target/arm/pure-code/no-casesi.c new file mode 100644 index 00000000000..ba116a8261b --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/pure-code/no-casesi.c @@ -0,0 +1,29 @@ +/* { dg-do compile } */ +/* { dg-options "-mpure-code" } */ +/* { dg-skip-if "" { *-*-* } { "-g" "-fpic" "-fPIC" } { "" } } */ + +extern int foo (void); +extern int bar (void); +extern int baz (void); +extern int fooz (void); + +int caller (unsigned int reg_type) +{ + switch (reg_type) + { + case 0x80000000: + return (int) foo (); + + case 0x80000003: + return (int) bar (); + + case 0x80000001: + return (int) baz (); + + case 0x80000004: + return (int) fooz (); + } +} + +/* { dg-final { scan-assembler-not "\\.(float|l\\?double|\d?byte|short|int|long|quad|word)\\s+\[^.\]" } } */ +/* { dg-final { scan-assembler "text,\"0x20000006\"" } } */ diff --git a/gcc/testsuite/gcc.target/arm/pure-code/no-literal-pool.c b/gcc/testsuite/gcc.target/arm/pure-code/no-literal-pool.c new file mode 100644 index 00000000000..4b893fd32f7 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/pure-code/no-literal-pool.c @@ -0,0 +1,68 @@ +/* { dg-do compile } */ +/* { dg-options "-mpure-code" } */ +/* { dg-skip-if "" { *-*-* } { "-g" "-fpic" "-fPIC" } { "" } } */ + +float sf; +double df; +long long l; +static char *p = "Hello World"; + +float +testsf (float *p) +{ + if (*p > 1.1234f) + return 2.1234f; + else + return 3.1234f; +} + +double +testdf (double *p) +{ + if (*p > 4.1234) + return 2.1234; + else + return 3.1234; +} + +long long +testll (long long *p) +{ + if (*p > 0x123456789ABCDEFll) + return 0x111111111ll; + else + return 0x222222222ll; +} + +char * +testchar () +{ + return p + 4; +} + +int +foo (int a, int b) +{ + int i; + volatile int *labelref = &&label1; + + if (a > b) + { + while (i < b) + { + a += *labelref; + i += 1; + } + goto *labelref; + } + else + b = b + 3; + + a = a * b; + +label1: + return a + b; +} + +/* { dg-final { scan-assembler-not "\\.(float|l\\?double|\d?byte|short|int|long|quad|word)\\s+\[^.\]" } } */ +/* { dg-final { scan-assembler "text,\"0x20000006\"" } } */ diff --git a/gcc/testsuite/gcc.target/arm/pure-code/pure-code.exp b/gcc/testsuite/gcc.target/arm/pure-code/pure-code.exp new file mode 100644 index 00000000000..1abe7782c0e --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/pure-code/pure-code.exp @@ -0,0 +1,54 @@ +# Copyright (C) 1997-2016 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 for ARM's -mpure-code option, using the `dg.exp' driver. + +# 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" +} + +# The -mpure-code option is only available for M-profile targets that support +# thumb2. +if {[check_effective_target_arm_thumb2_ok] + && ![check_effective_target_arm_arm_ok]} then { +# Initialize `dg'. +dg-init + +set saved-dg-do-what-default ${dg-do-what-default} +set dg-do-what-default "assemble" + +set saved-lto_torture_options ${LTO_TORTURE_OPTIONS} + +# Add -ffat-lto-objects option to all LTO options such that we can do assembly +# scans. +proc add_fat_objects { list } { + set res {} + foreach el $list {set res [lappend res [concat $el " -ffat-lto-objects"]]} + return $res +}; +set LTO_TORTURE_OPTIONS [add_fat_objects ${LTO_TORTURE_OPTIONS}] + +gcc-dg-runtest [lsort [glob $srcdir/$subdir/*.c]] \ + "" $DEFAULT_CFLAGS + +# All done. +dg-finish +}