]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - binutils/testsuite/binutils-all/arc/objdump.exp
Update year range in copyright notice of binutils files
[thirdparty/binutils-gdb.git] / binutils / testsuite / binutils-all / arc / objdump.exp
CommitLineData
250d07de 1# Copyright (C) 2016-2021 Free Software Foundation, Inc.
37fd5ef3
CZ
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 3 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
16
17if {![istarget "arc*-*-*"]} then {
18 return
19}
20
21if {[which $OBJDUMP] == 0} then {
22 perror "$OBJDUMP does not exist"
23 return
24}
25
26send_user "Version [binutil_version $OBJDUMP]"
27
e1e94c49 28# Helper functions
37fd5ef3 29
e1e94c49
AK
30# Create object file from the assembly source.
31proc do_objfile { srcfile } {
32 global srcdir
33 global subdir
34
35 set objfile [regsub -- "\.s$" $srcfile ".o"]
36
37 if {![binutils_assemble $srcdir/$subdir/$srcfile tmpdir/$objfile]} then {
38 return
39 }
40
41 if [is_remote host] {
42 set objfile [remote_download host tmpdir/$objfile]
43 } else {
44 set objfile tmpdir/$objfile
45 }
46
47 return $objfile
37fd5ef3
CZ
48}
49
e1e94c49
AK
50# Ensure that disassembler output includes EXPECTED lines.
51proc check_assembly { testname objfile expected { disas_flags "" } } {
52 global OBJDUMP
53 global OBJDUMPFLAGS
54
f795c494
AM
55 if [string equal "" $objfile] then {
56 fail $testname
57 return
58 }
e1e94c49
AK
59 set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS --disassemble $disas_flags \
60 $objfile"]
61
62 if [regexp $expected $got] then {
63 pass $testname
64 } else {
65 fail $testname
66 }
37fd5ef3
CZ
67}
68
69# Make sure that a warning message is generated (because the disassembly does
70# not match the assembled instructions, which has happened because the user
71# has not specified a -M option on the disassembler command line, and so the
72# disassembler has had to guess as the instruction class in use).
ee881e5d 73set want "Warning: disassembly.*vmac2hnfr\[ \t\]*r0,r2,r4.*dmulh12.f\[ \t\]*r0,r2,r4.*dmulh11.f"
e1e94c49 74check_assembly "Warning test" [do_objfile dsp.s] $want
570b0ed6
CZ
75set warn_double_reg "Warning: illegal use of double register pair."
76check_assembly "Warning faulty double regs" [do_objfile double_regs.s] \
77 $warn_double_reg
e1e94c49
AK
78
79set double_store_hs_expected {std\s*r0r1,\[r3\]}
80set objfile [do_objfile double_store.s]
81check_assembly "arc double_store default -M" $objfile \
82 $double_store_hs_expected
83check_assembly "arc double_store -Mcpu=hs" $objfile \
84 $double_store_hs_expected "-Mcpu=hs"
85check_assembly "arc double_store -Mcpu=hs38_linux" $objfile \
86 $double_store_hs_expected "-Mcpu=hs38_linux"
bd560f57 87set double_store_em_expected {word\s*0x1b000006}
e1e94c49
AK
88check_assembly "arc double_store -Mcpu=em" $objfile \
89 $double_store_em_expected "-Mcpu=em"
90check_assembly "arc double_store -Mcpu=em4_dmips" $objfile \
91 $double_store_em_expected "-Mcpu=em4_dmips"
92# Test to ensure that only value up to the next `,' is checked. There used to
93# be a bug, where whole `em,fpus' was compared against known CPU values, and
94# that comparison would fail. When this bug is present, whole cpu= option will
95# be ignored and instruction will be disassembled as ARC HS.
96check_assembly "arc double_store -Mcpu=em,fpus" $objfile \
97 $double_store_em_expected "-Mcpu=em,fpus"
98# Make sure that the last cpu= value is used.
99check_assembly "arc double_store -Mcpu=hs,cpu=em" $objfile \
100 $double_store_em_expected "-Mcpu=hs,cpu=em"
fdddd290 101# Check the hex printing for short immediates.
102set thexobj [do_objfile hexprint.s]
103check_assembly "arc hex printing" $thexobj \
104 {st\s*r0,\[r1,0xfffffff7\]} "-Mhex"
105check_assembly "arc normal printing" $thexobj \
106 {st\s*r0,\[r1,-9\]}