2 # Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 3 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
18 # Test for warnings when producing load hazards (instructions that
19 # reference the target of load one stage further down the pipeline.
20 # Written by Ben Elliston (bje@redhat.com)
22 # Run GAS and check that it emits the desired warning for the test case.
24 # file -- name of the test case to assemble.
25 # testname -- a string describing the test.
26 # warnpattern -- a regular expression, suitable for use by the Tcl
27 # regexp command, to decide if the warning string was emitted by
28 # the assembler to stderr.
30 proc iq2000_warning_test { file testname {warnpattern ""} } {
33 gas_run $file "" ">/dev/null"
34 verbose "output was $comp_output" 2
36 if {$warnpattern == ""} {
37 if {$comp_output == ""} { pass $testname } else { fail $testname }
41 if {[regexp "Warning: $warnpattern" $comp_output]} {
48 if [istarget iq2000*-*-*] {
49 foreach file [lsort [glob -nocomplain -- $srcdir/$subdir/hazard*.s]] {
50 set file [file tail $file]
53 set warnpattern "operand references R10 of previous load"
56 set warnpattern "operand references R1 of previous load"
59 set warnpattern "operand references R2 of previous load"
62 set warnpattern "instruction implicitly accesses R31 of previous load"
65 set warnpattern "operand references R10 of previous load"
68 set warnpattern "operand references R8 of previous load"
71 error "no expected result specified for $file"
75 iq2000_warning_test $file "assembler emits load hazard warning for $file" $warnpattern
78 set testname "assembler emits no warnings when there are no load hazards"
79 iq2000_warning_test nohazard.s $testname