Commit dbb29a2a by Andrew Bennett Committed by Matthew Fortune

MIPS: Check for sysroot support when upgrading/downgrading test options

gcc/testsuite/

	* gcc.target/mips/inline-memcpy-1.c (dg-options): Add
	(REQUIRES_STDLIB).
	* gcc.target/mips/inline-memcpy-2.c: Ditto.
	* gcc.target/mips/inline-memcpy-3.c: Ditto.
	* gcc.target/mips/inline-memcpy-4.c: Ditto.
	* gcc.target/mips/inline-memcpy-5.c: Ditto.
	* gcc.target/mips/loongson-shift-count-truncated-1.c: Ditto.
	* gcc.target/mips/loongson-simd.c: Ditto.
	* gcc.target/mips/memcpy-1.c: Ditto.
	* gcc.target/mips/mips-3d-1.c: Ditto.
	* gcc.target/mips/mips-3d-2.c: Ditto.
	* gcc.target/mips/mips-3d-3.c: Ditto.
	* gcc.target/mips/mips-3d-4.c: Ditto.
	* gcc.target/mips/mips-3d-5.c: Ditto.
	* gcc.target/mips/mips-3d-6.c: Ditto.
	* gcc.target/mips/mips-3d-7.c: Ditto.
	* gcc.target/mips/mips-3d-8.c: Ditto.
	* gcc.target/mips/mips-3d-9.c: Ditto.
	* gcc.target/mips/mips-ps-1.c: Ditto.
	* gcc.target/mips/mips-ps-2.c: Ditto.
	* gcc.target/mips/mips-ps-3.c: Ditto.
	* gcc.target/mips/mips-ps-4.c: Ditto.
	* gcc.target/mips/mips-ps-6.c: Ditto.
	* gcc.target/mips/mips16-attributes.c: Ditto.
	* gcc.target/mips/mips32-dsp-run.c: Ditto.
	* gcc.target/mips/mips32-dsp.c: Ditto.
	* gcc.target/mips/save-restore-1.c: Ditto.
	* gcc.target/mips/mips.exp (mips_option_groups): Add stdlib.
	(mips_preprocess): Add ignore_output argument that when set
	will not return the pre-processed output.
	(mips_arch_info): Update arguments for the call to
	mips_preprocess.
	(mips-dg-init): Ditto.
	(mips-dg-options): Check if a test having test option
	(REQUIRES_STDLIB) has the required sysroot support for
	the current test options.

Co-Authored-By: Toma Tabacu <toma.tabacu@imgtec.com>

From-SVN: r242587
parent f079167a
2016-11-18 Andrew Bennett <andrew.bennett@imgtec.com>
Toma Tabacu <toma.tabacu@imgtec.com>
* gcc.target/mips/inline-memcpy-1.c (dg-options): Add
(REQUIRES_STDLIB).
* gcc.target/mips/inline-memcpy-2.c: Ditto.
* gcc.target/mips/inline-memcpy-3.c: Ditto.
* gcc.target/mips/inline-memcpy-4.c: Ditto.
* gcc.target/mips/inline-memcpy-5.c: Ditto.
* gcc.target/mips/loongson-shift-count-truncated-1.c: Ditto.
* gcc.target/mips/loongson-simd.c: Ditto.
* gcc.target/mips/memcpy-1.c: Ditto.
* gcc.target/mips/mips-3d-1.c: Ditto.
* gcc.target/mips/mips-3d-2.c: Ditto.
* gcc.target/mips/mips-3d-3.c: Ditto.
* gcc.target/mips/mips-3d-4.c: Ditto.
* gcc.target/mips/mips-3d-5.c: Ditto.
* gcc.target/mips/mips-3d-6.c: Ditto.
* gcc.target/mips/mips-3d-7.c: Ditto.
* gcc.target/mips/mips-3d-8.c: Ditto.
* gcc.target/mips/mips-3d-9.c: Ditto.
* gcc.target/mips/mips-ps-1.c: Ditto.
* gcc.target/mips/mips-ps-2.c: Ditto.
* gcc.target/mips/mips-ps-3.c: Ditto.
* gcc.target/mips/mips-ps-4.c: Ditto.
* gcc.target/mips/mips-ps-6.c: Ditto.
* gcc.target/mips/mips16-attributes.c: Ditto.
* gcc.target/mips/mips32-dsp-run.c: Ditto.
* gcc.target/mips/mips32-dsp.c: Ditto.
* gcc.target/mips/save-restore-1.c: Ditto.
* gcc.target/mips/mips.exp (mips_option_groups): Add stdlib.
(mips_preprocess): Add ignore_output argument that when set
will not return the pre-processed output.
(mips_arch_info): Update arguments for the call to
mips_preprocess.
(mips-dg-init): Ditto.
(mips-dg-options): Check if a test having test option
(REQUIRES_STDLIB) has the required sysroot support for
the current test options.
2016-11-17 Jeff Law <law@redhat.com>
PR middle-end/38219
......
/* { dg-options "-fno-common isa_rev>=6" } */
/* { dg-options "-fno-common isa_rev>=6 (REQUIRES_STDLIB)" } */
/* { dg-skip-if "code quality test" { *-*-* } { "-O0" "-Os" } { "" } } */
/* { dg-final { scan-assembler-not "\tmemcpy" } } */
......
/* { dg-options "-fno-common isa_rev>=6" } */
/* { dg-options "-fno-common isa_rev>=6 (REQUIRES_STDLIB)" } */
/* { dg-skip-if "code quality test" { *-*-* } { "-O0" "-Os"} { "" } } */
/* { dg-final { scan-assembler-not "\tmemcpy" } } */
/* { dg-final { scan-assembler-times "\tsh\t" 16 } } */
......
/* { dg-options "-fno-common isa_rev<=5" } */
/* { dg-options "-fno-common isa_rev<=5 (REQUIRES_STDLIB)" } */
/* { dg-skip-if "code quality test" { *-*-* } { "-O0" "-Os"} { "" } } */
/* { dg-final { scan-assembler-not "\tmemcpy" } } */
/* { dg-final { scan-assembler-times "swl" 8 } } */
......
/* { dg-options "-fno-common isa_rev<=5 -mabi=64" } */
/* { dg-options "-fno-common isa_rev<=5 -mabi=64 (REQUIRES_STDLIB)" } */
/* { dg-skip-if "code quality test" { *-*-* } { "-O0" "-Os"} { "" } } */
/* { dg-final { scan-assembler-not "\tmemcpy" } } */
/* { dg-final { scan-assembler-times "sdl" 4 } } */
......
/* { dg-options "-fno-common isa_rev<=5 -mabi=n32" } */
/* { dg-options "-fno-common isa_rev<=5 -mabi=n32 (REQUIRES_STDLIB)" } */
/* { dg-skip-if "code quality test" { *-*-* } { "-O0" "-Os"} { "" } } */
/* { dg-final { scan-assembler-not "\tmemcpy" } } */
/* { dg-final { scan-assembler-times "sdl" 4 } } */
......
......@@ -4,7 +4,7 @@
/* loongson.h does not handle or check for MIPS16ness. There doesn't
seem any good reason for it to, given that the Loongson processors
do not support MIPS16. */
/* { dg-options "isa=loongson -mhard-float -mno-mips16" } */
/* { dg-options "isa=loongson -mhard-float -mno-mips16 (REQUIRES_STDLIB)" } */
/* See PR 52155. */
/* { dg-options "isa=loongson -mhard-float -mno-mips16 -mlong64" { mips*-*-elf* && ilp32 } } */
......
......@@ -26,7 +26,7 @@ along with GCC; see the file COPYING3. If not see
because inclusion of some system headers e.g. stdint.h will fail due to not
finding stubs-o32_hard.h. */
/* { dg-require-effective-target mips_nanlegacy } */
/* { dg-options "isa=loongson -mhard-float -mno-micromips -mno-mips16 -flax-vector-conversions" } */
/* { dg-options "isa=loongson -mhard-float -mno-micromips -mno-mips16 -flax-vector-conversions (REQUIRES_STDLIB)" } */
#include "loongson.h"
#include <stdio.h>
......
/* { dg-options "-fno-common" } */
/* { dg-options "-fno-common (REQUIRES_STDLIB)" } */
/* { dg-skip-if "code quality test" { *-*-* } { "-O0" } { "" } } */
/* { dg-final { scan-assembler-not "\tlbu\t" } } */
......
/* { dg-do run } */
/* { dg-options "-mips3d forbid_cpu=octeon.*" } */
/* { dg-options "-mips3d forbid_cpu=octeon.* (REQUIRES_STDLIB)" } */
/* Test MIPS-3D builtin functions */
#include <stdlib.h>
......
/* { dg-do run } */
/* { dg-options "-mips3d forbid_cpu=octeon.*" } */
/* { dg-options "-mips3d forbid_cpu=octeon.* (REQUIRES_STDLIB)" } */
/* Test MIPS-3D branch-if-any-two builtin functions */
#include <stdlib.h>
......
/* { dg-do run } */
/* { dg-options "-mips3d forbid_cpu=octeon.*" } */
/* { dg-options "-mips3d forbid_cpu=octeon.* (REQUIRES_STDLIB)" } */
/* Test MIPS-3D absolute compare builtin functions */
#include <stdlib.h>
......
/* { dg-do run } */
/* { dg-options "-mips3d forbid_cpu=octeon.*" } */
/* { dg-options "-mips3d forbid_cpu=octeon.* (REQUIRES_STDLIB)" } */
/* Test MIPS-3D branch-if-any-four builtin functions */
#include <stdlib.h>
......
/* { dg-do run } */
/* { dg-options "-mips3d forbid_cpu=octeon.*" } */
/* { dg-options "-mips3d forbid_cpu=octeon.* (REQUIRES_STDLIB)" } */
/* Test MIPS-3D absolute-compare & branch-if-any-four builtin functions */
#include <stdlib.h>
......
/* { dg-do run } */
/* { dg-options "-mips3d forbid_cpu=octeon.*" } */
/* { dg-options "-mips3d forbid_cpu=octeon.* (REQUIRES_STDLIB)" } */
/* Test MIPS-3D absolute compare (floats) builtin functions */
#include <stdlib.h>
......
/* { dg-do run } */
/* { dg-options "-mips3d forbid_cpu=octeon.*" } */
/* { dg-options "-mips3d forbid_cpu=octeon.* (REQUIRES_STDLIB)" } */
/* Test MIPS-3D absolute compare (doubles) builtin functions */
#include <stdlib.h>
......
/* { dg-do run } */
/* { dg-options "-mips3d forbid_cpu=octeon.*" } */
/* { dg-options "-mips3d forbid_cpu=octeon.* (REQUIRES_STDLIB)" } */
/* Test MIPS-3D absolute compare and conditional move builtin functions */
#include <stdlib.h>
......
/* { dg-do run } */
/* { dg-options "-mips3d forbid_cpu=octeon.*" } */
/* { dg-options "-mips3d forbid_cpu=octeon.* (REQUIRES_STDLIB)" } */
/* Matrix Multiplications */
#include <stdlib.h>
......
/* { dg-do run } */
/* { dg-options "-mpaired-single forbid_cpu=octeon.*" } */
/* { dg-options "-mpaired-single forbid_cpu=octeon.* (REQUIRES_STDLIB)" } */
/* Test v2sf calculations */
#include <stdlib.h>
......
/* { dg-do run } */
/* { dg-options "-mpaired-single forbid_cpu=octeon.*" } */
/* { dg-options "-mpaired-single forbid_cpu=octeon.* (REQUIRES_STDLIB)" } */
/* Test MIPS paired-single builtin functions */
#include <stdlib.h>
......
/* { dg-do run } */
/* { dg-options "-mpaired-single forbid_cpu=octeon.*" } */
/* { dg-options "-mpaired-single forbid_cpu=octeon.* (REQUIRES_STDLIB)" } */
/* Test MIPS paired-single conditional move */
#include <stdlib.h>
......
/* { dg-do run } */
/* { dg-options "-mpaired-single forbid_cpu=octeon.*" } */
/* { dg-options "-mpaired-single forbid_cpu=octeon.* (REQUIRES_STDLIB)" } */
/* Test MIPS paired-single comparisons */
#include <stdlib.h>
......
/* mips-ps-2.c with an extra -ffinite-math-only option. This option
changes the way that abs.ps is handled. */
/* { dg-do run } */
/* { dg-options "-mpaired-single -ffinite-math-only forbid_cpu=octeon.*" } */
/* { dg-options "-mpaired-single -ffinite-math-only forbid_cpu=octeon.* (REQUIRES_STDLIB)" } */
/* Test MIPS paired-single builtin functions */
#include <stdlib.h>
......
......@@ -261,6 +261,7 @@ set mips_option_groups {
section_start "-Wl,--section-start=.*"
frame-header "-mframe-header-opt|-mno-frame-header-opt"
stack-protector "-fstack-protector"
stdlib "REQUIRES_STDLIB"
}
for { set option 0 } { $option < 32 } { incr option } {
......@@ -447,14 +448,19 @@ proc mips_same_option_p { option1 option2 } {
# Preprocess CODE using target_compile options OPTIONS. Return the
# compiler output.
proc mips_preprocess { options code } {
proc mips_preprocess { options code ignore_output } {
global tool
set src dummy[pid].c
set f [open $src "w"]
puts $f $code
close $f
set output [${tool}_target_compile $src "" preprocess $options]
if { $ignore_output } {
set output [${tool}_target_compile $src dummy[pid].i preprocess $options]
file delete dummy[pid].i
} else {
set output [${tool}_target_compile $src "" preprocess $options]
}
file delete $src
return $output
......@@ -504,7 +510,7 @@ proc mips_arch_info { arch prop } {
#else
int isa_rev = 0;
#endif
}]
} 0]
foreach lhs { isa isa_rev } {
regsub ".*$lhs = (\[^;\]*).*" $output {\1} rhs
verbose -log "Architecture $arch has $lhs $rhs"
......@@ -863,7 +869,7 @@ proc mips-dg-init {} {
0
};
}]
} 0]
foreach line [split $output "\r\n"] {
# Poor man's string concatenation.
regsub -all {" "} $line "" line
......@@ -1454,6 +1460,28 @@ proc mips-dg-options { args } {
}
}
# If the test is marked as requiring standard libraries check
# that the sysroot has support for the current set of test options.
if { [mips_have_test_option_p options "REQUIRES_STDLIB"] } {
mips_push_test_options saved_options $extra_tool_flags
set output [mips_preprocess "" {
#include <stdlib.h>
} 1]
mips_pop_test_options saved_options
# If the preprocessing of the stdlib.h file produced errors,
# mark the test as unsupported by changing the second element of
# do_what to "N".
# The second element of do_what holds information about test selection
# and it can have one of two values:
# "S" - the test is selected and will be run
# "N" - the test is not selected and will not be run
# This mirrors the format of dg-do-what from lib/dg.exp in DejaGNU.
if { ![string equal $output ""] } {
set do_what [lreplace $do_what 1 1 "N"]
}
}
# If the test is MIPS16-compatible, provide a counterpart to the
# NOMIPS16 convenience macro.
if { [mips_have_test_option_p options "-mips16"] } {
......
......@@ -2,7 +2,7 @@
of calling a nomips16/mips16/default function from a nomips16/mips16/default
function. */
/* { dg-do run } */
/* { dg-options "(-mips16)" } */
/* { dg-options "(-mips16) (REQUIRES_STDLIB)" } */
/* { dg-skip-if "" { *-*-* } { "-mmicromips" } { "" } } */
#include <stdlib.h>
......
/* Test MIPS32 DSP instructions */
/* { dg-do run } */
/* { dg-options "-mdsp" } */
/* { dg-options "-mdsp (REQUIRES_STDLIB)" } */
#include <stdlib.h>
#include <stdio.h>
......
/* Test MIPS32 DSP instructions */
/* { dg-do compile } */
/* { dg-options "-mgp32 -mdsp" } */
/* { dg-options "-mgp32 -mdsp (REQUIRES_STDLIB)" } */
/* { dg-final { scan-assembler "\taddq.ph\t" } } */
/* { dg-final { scan-assembler "\taddq_s.ph\t" } } */
/* { dg-final { scan-assembler "\taddq_s.w\t" } } */
......
/* Check that we can use the save instruction to save varargs. */
/* { dg-options "(-mips16) isa_rev>=1 -mabi=32" } */
/* { dg-options "(-mips16) isa_rev>=1 -mabi=32 (REQUIRES_STDLIB)" } */
#include <stdarg.h>
......
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