1 # Test literal coaslescing for Xtensa targets.
2 # By David Heine, Tensilica, Inc.
3 # Copyright (C) 2002-2017 Free Software Foundation, Inc.
5 # This file is part of the GNU Binutils.
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
22 if ![istarget "xtensa*-*-*"] {
26 set testname "COALESCE"
28 set OBJDUMPFLAGS "-dr"
32 # run objdump on a file
34 proc default_ld_objdump { objdump object outputfile } {
39 if {[which $objdump] == 0} then {
40 perror "$objdump does not exist"
44 if ![info exists OBJDUMPFLAGS] { set OBJDUMPFLAGS "" }
46 verbose -log "$objdump $OBJDUMPFLAGS $object >$outputfile"
48 catch "exec $objdump $OBJDUMPFLAGS $object >$outputfile" exec_output
49 set exec_output [prune_warnings $exec_output]
50 if [string match "" $exec_output] then {
53 verbose -log "$exec_output"
54 perror "$object: objdump failed"
60 if ![ld_assemble $as $srcdir/$subdir/coalesce1.s tmpdir/coalesce1.o] {
64 if ![ld_assemble $as $srcdir/$subdir/coalesce2.s tmpdir/coalesce2.o] {
69 set object "tmpdir/coalesce"
70 set outputfile "$object.txt"
72 if ![ld_simple_link $ld $object "-T $srcdir/$subdir/coalesce.t tmpdir/coalesce1.o tmpdir/coalesce2.o"] {
73 verbose -log "failure in ld"
78 if ![default_ld_objdump $objdump $object $outputfile ] {
79 verbose -log "failure in objdump"
84 set file [open $outputfile r]
87 while { [gets $file line] != -1 } {
89 if [regexp "^0000000c <main>:" $line] {