Commit | Line | Data |
---|---|---|
5bf135a7 NC |
1 | # Copyright 2012 |
2 | # Free Software Foundation, Inc. | |
3 | ||
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. | |
8 | # | |
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. | |
13 | # | |
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. | |
17 | ||
a99bcdd0 SC |
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) | |
21 | ||
22 | # Run GAS and check that it emits the desired warning for the test case. | |
23 | # Arguments: | |
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. | |
29 | ||
30 | proc iq2000_warning_test { file testname {warnpattern ""} } { | |
31 | global comp_output | |
32 | ||
33 | gas_run $file "" ">/dev/null" | |
34 | verbose "output was $comp_output" 2 | |
35 | ||
36 | if {$warnpattern == ""} { | |
37 | if {$comp_output == ""} { pass $testname } else { fail $testname } | |
38 | return | |
39 | } | |
40 | ||
41 | if {[regexp "Warning: $warnpattern" $comp_output]} { | |
42 | pass $testname | |
43 | } else { | |
44 | fail $testname | |
45 | } | |
46 | } | |
47 | ||
48 | if [istarget iq2000*-*-*] { | |
4287f8de | 49 | foreach file [lsort [glob -nocomplain -- $srcdir/$subdir/hazard*.s]] { |
a99bcdd0 SC |
50 | set file [file tail $file] |
51 | switch -- $file { | |
52 | "hazard0.s" { | |
53 | set warnpattern "operand references R10 of previous load" | |
54 | } | |
55 | "hazard1.s" { | |
56 | set warnpattern "operand references R1 of previous load" | |
57 | } | |
58 | "hazard2.s" { | |
59 | set warnpattern "operand references R2 of previous load" | |
60 | } | |
61 | "hazard3.s" { | |
62 | set warnpattern "instruction implicitly accesses R31 of previous load" | |
63 | } | |
64 | "hazard4.s" { | |
65 | set warnpattern "operand references R10 of previous load" | |
66 | } | |
67 | "hazard5.s" { | |
68 | set warnpattern "operand references R8 of previous load" | |
69 | } | |
70 | default { | |
71 | error "no expected result specified for $file" | |
72 | return | |
73 | } | |
74 | } | |
75 | iq2000_warning_test $file "assembler emits load hazard warning for $file" $warnpattern | |
76 | } | |
77 | ||
78 | set testname "assembler emits no warnings when there are no load hazards" | |
79 | iq2000_warning_test nohazard.s $testname | |
80 | } |