OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [binutils-2.18.50/] [ld/] [testsuite/] [ld-xtensa/] [lcall.exp] - Diff between revs 38 and 156

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 38 Rev 156
# Test Xtensa longcall optimization.
# Test Xtensa longcall optimization.
# By David Heine, Tensilica, Inc.
# By David Heine, Tensilica, Inc.
#   Copyright 2002, 2003, 2007
#   Copyright 2002, 2003, 2007
#   Free Software Foundation, Inc.
#   Free Software Foundation, Inc.
#
#
# This file is part of the GNU Binutils.
# This file is part of the GNU Binutils.
#
#
# This program is free software; you can redistribute it and/or modify
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
# (at your option) any later version.
#
#
# This program is distributed in the hope that it will be useful,
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# GNU General Public License for more details.
#
#
# You should have received a copy of the GNU General Public License
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
# MA 02110-1301, USA.
# MA 02110-1301, USA.
if ![istarget "xtensa*-*-*"] {
if ![istarget "xtensa*-*-*"] {
    return
    return
}
}
set testname "LCALL"
set testname "LCALL"
set OBJDUMPFLAGS "-dr"
set OBJDUMPFLAGS "-dr"
#
#
# default_ld_objdump
# default_ld_objdump
#       run objdump on a file
#       run objdump on a file
#
#
proc default_ld_objdump { objdump object outputfile } {
proc default_ld_objdump { objdump object outputfile } {
    global OBJDUMPFLAGS
    global OBJDUMPFLAGS
    global objdump_output
    global objdump_output
    global host_triplet
    global host_triplet
    if {[which $objdump] == 0} then {
    if {[which $objdump] == 0} then {
        perror "$objdump does not exist"
        perror "$objdump does not exist"
        return 0
        return 0
    }
    }
    if ![info exists OBJDUMPFLAGS] { set OBJDUMPFLAGS "" }
    if ![info exists OBJDUMPFLAGS] { set OBJDUMPFLAGS "" }
    verbose -log "$objdump $OBJDUMPFLAGS $object >$outputfile"
    verbose -log "$objdump $OBJDUMPFLAGS $object >$outputfile"
    catch "exec $objdump $OBJDUMPFLAGS $object >$outputfile" exec_output
    catch "exec $objdump $OBJDUMPFLAGS $object >$outputfile" exec_output
    set exec_output [prune_warnings $exec_output]
    set exec_output [prune_warnings $exec_output]
    if [string match "" $exec_output] then {
    if [string match "" $exec_output] then {
        return 1
        return 1
    } else {
    } else {
        verbose -log "$exec_output"
        verbose -log "$exec_output"
        perror "$object: objdump failed"
        perror "$object: objdump failed"
        return 0
        return 0
    }
    }
}
}
if ![ld_assemble $as $srcdir/$subdir/lcall1.s tmpdir/lcall1.o] {
if ![ld_assemble $as $srcdir/$subdir/lcall1.s tmpdir/lcall1.o] {
    unresolved $testname
    unresolved $testname
    return
    return
}
}
if ![ld_assemble $as $srcdir/$subdir/lcall2.s tmpdir/lcall2.o] {
if ![ld_assemble $as $srcdir/$subdir/lcall2.s tmpdir/lcall2.o] {
    unresolved $testname
    unresolved $testname
    return
    return
}
}
set object "tmpdir/lcall"
set object "tmpdir/lcall"
set outputfile "$object.txt"
set outputfile "$object.txt"
if ![ld_simple_link $ld $object "-T $srcdir/$subdir/lcall.t tmpdir/lcall1.o tmpdir/lcall2.o"] {
if ![ld_simple_link $ld $object "-T $srcdir/$subdir/lcall.t tmpdir/lcall1.o tmpdir/lcall2.o"] {
    verbose -log "failure in ld"
    verbose -log "failure in ld"
    fail $testname
    fail $testname
    return
    return
}
}
if ![default_ld_objdump $objdump $object $outputfile ] {
if ![default_ld_objdump $objdump $object $outputfile ] {
    verbose -log "failure in objdump"
    verbose -log "failure in objdump"
    fail $testname
    fail $testname
    return
    return
}
}
set file [open $outputfile r]
set file [open $outputfile r]
while { [gets $file line] != -1 } {
while { [gets $file line] != -1 } {
    #   verbose "$line" 2
    #   verbose "$line" 2
    if [regexp "l32r" $line] {
    if [regexp "l32r" $line] {
        verbose -log "Found an l32r in the linked object"
        verbose -log "Found an l32r in the linked object"
        verbose -log "$line"
        verbose -log "$line"
        fail $testname
        fail $testname
    }
    }
}
}
close $file
close $file
pass $testname
pass $testname
set testname "LCALL2"
set testname "LCALL2"
set file [open $outputfile r]
set file [open $outputfile r]
set found 0
set found 0
while { [gets $file line] != -1 } {
while { [gets $file line] != -1 } {
    #   verbose "$line" 2
    #   verbose "$line" 2
    if [regexp "^00000004 :" $line] {
    if [regexp "^00000004 :" $line] {
        set found 1
        set found 1
    }
    }
}
}
close $file
close $file
if  $found  {
if  $found  {
   pass $testname
   pass $testname
} else {
} else {
   fail $testname
   fail $testname
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.