* gas/sh/*: New tests for the hitachi-sh.
[external/binutils.git] / gas / testsuite / gas / sh / basic.exp
1 # Copyright (C) 1995 Free Software Foundation, Inc.
2
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 # GNU General Public License for more details.
12
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
16
17 # Please email any bugs, comments, and/or additions to this file to:
18 # DejaGnu@cygnus.com
19
20 # Written by Cygnus Support.
21
22 proc do_fp {} {
23     set testname "fp.s: floating point tests (sh3e)"
24     set x 0
25
26     gas_start "fp.s" "-al"
27
28     # Check the assembled instruction against a table built by the HP assembler
29     # Any differences should be checked by hand -- with the number of problems
30     # I've seen in the HP assembler I don't completely trust it.
31     #
32     # Instead of having a variable for each match string just increment the
33     # total number of matches seen.  That's simpler when testing large numbers
34     # of instructions (as these tests to).
35     while 1 {
36         expect {
37             -re "^ +\[0-9\]+ 0000 F008\[^\n\]*\n"       { set x [expr $x+1] }
38             -re "^ +\[0-9\]+ 0002 F00A\[^\n\]*\n"       { set x [expr $x+1] }
39             -re "^ +\[0-9\]+ 0004 F009\[^\n\]*\n"       { set x [expr $x+1] }
40             -re "^ +\[0-9\]+ 0006 F00B\[^\n\]*\n"       { set x [expr $x+1] }
41             -re "^ +\[0-9\]+ 0008 F006\[^\n\]*\n"       { set x [expr $x+1] }
42             -re "^ +\[0-9\]+ 000a F007\[^\n\]*\n"       { set x [expr $x+1] }
43             -re "^ +\[0-9\]+ 000c F10C\[^\n\]*\n"       { set x [expr $x+1] }
44             -re "^ +\[0-9\]+ 000e F08D\[^\n\]*\n"       { set x [expr $x+1] }
45             -re "^ +\[0-9\]+ 0010 F09D\[^\n\]*\n"       { set x [expr $x+1] }
46             -re "^ +\[0-9\]+ 0012 F100\[^\n\]*\n"       { set x [expr $x+1] }
47             -re "^ +\[0-9\]+ 0014 F101\[^\n\]*\n"       { set x [expr $x+1] }
48             -re "^ +\[0-9\]+ 0016 F102\[^\n\]*\n"       { set x [expr $x+1] }
49             -re "^ +\[0-9\]+ 0018 F103\[^\n\]*\n"       { set x [expr $x+1] }
50             -re "^ +\[0-9\]+ 001a F10E\[^\n\]*\n"       { set x [expr $x+1] }
51             -re "^ +\[0-9\]+ 001c F104\[^\n\]*\n"       { set x [expr $x+1] }
52             -re "^ +\[0-9\]+ 001e F105\[^\n\]*\n"       { set x [expr $x+1] }
53             -re "^ +\[0-9\]+ 0020 F07D\[^\n\]*\n"       { set x [expr $x+1] }
54             -re "^ +\[0-9\]+ 0022 F04D\[^\n\]*\n"       { set x [expr $x+1] }
55             -re "^ +\[0-9\]+ 0024 F05D\[^\n\]*\n"       { set x [expr $x+1] }
56             -re "^ +\[0-9\]+ 0026 F06D\[^\n\]*\n"       { set x [expr $x+1] }
57             -re "^ +\[0-9\]+ 0028 F02D\[^\n\]*\n"       { set x [expr $x+1] }
58             -re "^ +\[0-9\]+ 002a F03D\[^\n\]*\n"       { set x [expr $x+1] }
59             -re "^ +\[0-9\]+ 002c F00D\[^\n\]*\n"       { set x [expr $x+1] }
60             -re "^ +\[0-9\]+ 002e F01D\[^\n\]*\n"       { set x [expr $x+1] }
61             -re "^ +\[0-9\]+ 0030 435A\[^\n\]*\n"       { set x [expr $x+1] }
62             -re "^ +\[0-9\]+ 0032 4356\[^\n\]*\n"       { set x [expr $x+1] }
63             -re "^ +\[0-9\]+ 0034 436A\[^\n\]*\n"       { set x [expr $x+1] }
64             -re "^ +\[0-9\]+ 0036 4366\[^\n\]*\n"       { set x [expr $x+1] }
65             -re "^ +\[0-9\]+ 0038 435A\[^\n\]*\n"       { set x [expr $x+1] }
66             -re "^ +\[0-9\]+ 003a 4356\[^\n\]*\n"       { set x [expr $x+1] }
67             -re "^ +\[0-9\]+ 003c 436A\[^\n\]*\n"       { set x [expr $x+1] }
68             -re "^ +\[0-9\]+ 003e 4366\[^\n\]*\n"       { set x [expr $x+1] }
69             -re "\[^\n\]*\n"                            { }
70             timeout                             { perror "timeout\n"; break }
71             eof                                 { break }
72         }
73     }
74
75     # This was intended to do any cleanup necessary.  It kinda looks like it
76     # isn't needed, but just in case, please keep it in for now.
77     gas_finish
78
79     # Did we find what we were looking for?  If not, flunk it.
80     if [expr $x==32] then { pass $testname } else { fail $testname }
81 }
82
83
84 if [istarget sh*-*-*] then {
85     # Test the basic instruction parser.
86     do_fp
87 }