Commit f5682f01 by Andre Vieira

Add missing testcases from previous patch revision r240379, failed to svn add.

From-SVN: r240746
parent 078b5aab
/* { dg-do compile } */
/* { dg-skip-if "" { *-*-* } { "-fpic" "-fPIC" } { "" } } */
/* { dg-options "-ffunction-sections -mpure-code" } */
#include <limits.h>
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\"} } } */
/* { 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\"" } } */
/* { 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\"" } } */
# 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
# <http://www.gnu.org/licenses/>.
# 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
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment