2006-12-01 Paul Brook <paul@codesourcery.com>
[deliverable/binutils-gdb.git] / gas / testsuite / gas / iq2000 / load-hazards.exp
1 # Test for warnings when producing load hazards (instructions that
2 # reference the target of load one stage further down the pipeline.
3 # Written by Ben Elliston (bje@redhat.com)
4
5 # Run GAS and check that it emits the desired warning for the test case.
6 # Arguments:
7 # file -- name of the test case to assemble.
8 # testname -- a string describing the test.
9 # warnpattern -- a regular expression, suitable for use by the Tcl
10 # regexp command, to decide if the warning string was emitted by
11 # the assembler to stderr.
12
13 proc iq2000_warning_test { file testname {warnpattern ""} } {
14 global comp_output
15
16 gas_run $file "" ">/dev/null"
17 verbose "output was $comp_output" 2
18
19 if {$warnpattern == ""} {
20 if {$comp_output == ""} { pass $testname } else { fail $testname }
21 return
22 }
23
24 if {[regexp "Warning: $warnpattern" $comp_output]} {
25 pass $testname
26 } else {
27 fail $testname
28 }
29 }
30
31 if [istarget iq2000*-*-*] {
32 foreach file [glob -nocomplain -- $srcdir/$subdir/hazard*.s] {
33 set file [file tail $file]
34 switch -- $file {
35 "hazard0.s" {
36 set warnpattern "operand references R10 of previous load"
37 }
38 "hazard1.s" {
39 set warnpattern "operand references R1 of previous load"
40 }
41 "hazard2.s" {
42 set warnpattern "operand references R2 of previous load"
43 }
44 "hazard3.s" {
45 set warnpattern "instruction implicitly accesses R31 of previous load"
46 }
47 "hazard4.s" {
48 set warnpattern "operand references R10 of previous load"
49 }
50 "hazard5.s" {
51 set warnpattern "operand references R8 of previous load"
52 }
53 default {
54 error "no expected result specified for $file"
55 return
56 }
57 }
58 iq2000_warning_test $file "assembler emits load hazard warning for $file" $warnpattern
59 }
60
61 set testname "assembler emits no warnings when there are no load hazards"
62 iq2000_warning_test nohazard.s $testname
63 }
This page took 0.030742 seconds and 4 git commands to generate.