* gas/mips/ld.s: Adjust to let data objects be only
[binutils-gdb.git] / gas / testsuite / gas / mips / mips.exp
index 537487546225112a137000a4335f2da1323a12e3..9e274ad93bc5f7c3bf58072d651cceca1c4cb29b 100644 (file)
@@ -146,6 +146,19 @@ proc mips_arch_create {arch gprsize extends props as_flags objdump_flags
     }
 }
 
+# mips_arch_destroy ARCH
+#
+# The opposite of the above.  This function removes an entry from
+# the architecture data array, for the architecture or CPU named ARCH.
+
+proc mips_arch_destroy {arch} {
+    global mips_arches
+
+    if { [info exists mips_arches($arch)] } {
+       unset mips_arches($arch)
+    }
+}
+
 # mips_arch_list_all
 #
 # This function returns the list of all names of entries in the
@@ -181,9 +194,12 @@ proc mips_arch_displayname {arch} {
 # mips_arch_properties ARCH (optional:) INCLUDE_GPRSIZE
 #
 # This function returns the property list associated with ARCH in the
-# architecture data array.  If INCLUDE_GPRSIZE is non-zero, an additional
-# "gpr32" or "gpr64" property will be returned as part of the list based
-# on the architecture's GPR size.
+# architecture data array, including the "canonical" target name as the
+# first element.
+#
+# If INCLUDE_GPRSIZE is non-zero, an additional "gpr32" or "gpr64"
+# property will be returned as part of the list based on the
+# architecture's GPR size.
 proc mips_arch_properties {arch {include_gprsize 1}} {
     array set archdata [mips_arch_data $arch]
     set props $archdata(props)
@@ -270,8 +286,31 @@ proc mips_arch_list_matching {args} {
 #
 # Invoke "run_dump_test" for test NAME, with extra assembler and
 # disassembler flags to test architecture ARCH.
+#
+# You can override the expected output for particular architectures
+# and file formats.  The possible test names are, in order of preference:
+#
+# 1. CARCH@FORMAT@NAME.d
+# 2. CARCH@NAME.d
+# 3. FORMAT@NAME.d
+# 4. NAME.d
+#
+# where CARCH is the "canonical" name of architecture ARCH as recorded
+# in its associated property list, and where FORMAT is the target's
+# file format (one of "elf", "ecoff" or "aout").
 proc run_dump_test_arch { name arch } {
-    global subdir
+    upvar elf elf ecoff ecoff aout aout
+    global subdir srcdir
+
+    set format [expr { $elf ? "elf" : $ecoff ? "ecoff" : "aout" }]
+    set proparch [lindex [mips_arch_properties $arch 0] 0]
+    foreach prefix [list ${proparch}@${format}@ ${proparch}@ ${format}@] {
+       set archname ${prefix}${name}
+       if { [file exists "$srcdir/$subdir/${archname}.d"] } {
+           set name $archname
+           break
+       }
+    }
 
     if [catch {run_dump_test $name \
                             "{name    {([mips_arch_displayname $arch])}}
@@ -287,6 +326,7 @@ proc run_dump_test_arch { name arch } {
 # Invoke "run_dump_test_arch" for test NAME, for each architecture
 # listed in ARCH_LIST.
 proc run_dump_test_arches { name arch_list } {
+    upvar elf elf ecoff ecoff aout aout
     foreach arch $arch_list {
        run_dump_test_arch "$name" "$arch"
     }
@@ -349,6 +389,8 @@ mips_arch_create mips64r2 64        mips64  { mips32r2 ror } \
                        { -march=mips64r2 -mtune=mips64r2 } \
                        { -mmips:isa64r2 } \
                        { mipsisa64r2-*-* mipsisa64r2el-*-* }
+mips_arch_create mips16        32      {}      {} \
+                       { -march=mips1 -mips16 } { -mmips:16 }
 mips_arch_create r3000         32      mips1   {} \
                        { -march=r3000 -mtune=r3000 } { -mmips:3000 }
 mips_arch_create r3900         32      mips1   { gpr_ilocks } \
@@ -381,7 +423,6 @@ if { [istarget mips*-*-vxworks*] } {
     set elf [expr [istarget *-*-elf*] || [istarget *-*-irix5*] || [istarget *-*-irix6* ] || [istarget *-*-linux*] || [istarget *-*-netbsd*] ]
     set ecoff [expr [istarget *-*-ecoff*] || [istarget *-*-ultrix*] || [istarget *-*-irix\[1-4\]*] ]
     set aout [expr [istarget *-*-bsd*] || [istarget *-*-openbsd*] ]
-    set gpr_ilocks [expr [istarget mipstx39*-*-*]]
     set addr32 [expr [istarget mipstx39*-*-*] || [istarget mips-*-linux*] || [istarget mipsel-*-linux*] || [istarget mips*-*-ecoff]]
     set has_newabi [expr [istarget *-*-irix6*] || [istarget mips64*-*-linux*]]
 
@@ -398,6 +439,9 @@ if { [istarget mips*-*-vxworks*] } {
     if { $ecoff } {
        set no_mips16 1
     }
+    if { $no_mips16 } {
+       mips_arch_destroy mips16
+    }
     
     run_dump_test_arches "abs"         [mips_arch_list_matching mips1]
     run_dump_test_arches "add"         [mips_arch_list_matching mips1]
@@ -439,7 +483,12 @@ if { [istarget mips*-*-vxworks*] } {
     run_dump_test "eret-2"
     run_dump_test "eret-3"
 
-    if $elf { run_dump_test "jal-svr4pic" }
+    if $elf {
+       run_dump_test_arches "jal-svr4pic" \
+                                       [mips_arch_list_matching mips1]
+       run_dump_test_arches "jal-svr4pic-noreorder" \
+                                       [mips_arch_list_matching mips1]
+    }
     if $elf { run_dump_test "jal-xgot" }
     run_list_test_arches "jal-range" "-32" [mips_arch_list_matching mips1]
     if $has_newabi { run_dump_test "jal-newabi" }
@@ -451,10 +500,11 @@ if { [istarget mips*-*-vxworks*] } {
     if !$aout {
        # XXX FIXME: Has mips2 and later insns with mips1 disassemblies.
        # (Should split and then use appropriate arch lists.)
-       run_dump_test_arches "lb"       [mips_arch_list_matching !mips2]
+       run_dump_test_arches "lb"       [mips_arch_list_matching mips1 !mips2]
     }
     if $elf {
-       run_dump_test_arches "lb-svr4pic" [mips_arch_list_matching !gpr_ilocks]
+       run_dump_test_arches "lb-svr4pic" \
+                               [mips_arch_list_matching mips1 !gpr_ilocks]
        run_dump_test_arches "lb-svr4pic-ilocks" [mips_arch_list_matching gpr_ilocks]
     }
     if $elf {
@@ -464,15 +514,19 @@ if { [istarget mips*-*-vxworks*] } {
        run_dump_test "lb-xgot-ilocks"
     }
     if !$aout {
-        if !$gpr_ilocks {
-            run_dump_test "ld"
-        } else { 
-            if !$addr32 {
-                run_dump_test "ld-ilocks"
-            } else {
-                run_dump_test "ld-ilocks-addr32"
-            }
-        }
+       run_dump_test_arches "ld"       [mips_arch_list_matching mips1]
+       run_dump_test_arches "ld-forward" \
+                                       [mips_arch_list_matching mips1]
+       if $has_newabi {
+           run_dump_test_arches "ld-n32" \
+                                       [mips_arch_list_matching mips3]
+           run_dump_test_arches "ld-forward-n32" \
+                                       [mips_arch_list_matching mips3]
+           run_dump_test_arches "ld-n64" \
+                                       [mips_arch_list_matching mips3]
+           run_dump_test_arches "ld-forward-n64" \
+                                       [mips_arch_list_matching mips3]
+       }
     }
     if $elf { run_dump_test "ld-svr4pic" }
     if $elf { run_dump_test "ld-xgot" }
@@ -484,10 +538,14 @@ if { [istarget mips*-*-vxworks*] } {
     run_dump_test_arches "mips4-fp"    [mips_arch_list_matching mips4]
     run_list_test_arches "mips4-fp" "-32 -msoft-float" \
                                        [mips_arch_list_matching mips4]
+    run_dump_test_arches "mips4-branch-likely" \
+                                       [mips_arch_list_matching mips4]
+    run_list_test_arches "mips4-branch-likely" "-32 -msoft-float" \
+                                       [mips_arch_list_matching mips4]
     run_dump_test_arches "mips5"       [mips_arch_list_matching mips5]
     run_dump_test "mul"
 
-    run_dump_test_arches "rol"         [mips_arch_list_matching !ror]
+    run_dump_test_arches "rol"         [mips_arch_list_matching mips1 !ror]
     run_dump_test_arches "rol-hw"      [mips_arch_list_matching ror]
 
     run_dump_test_arches "rol64"       [mips_arch_list_matching gpr64 !ror]
@@ -507,9 +565,11 @@ if { [istarget mips*-*-vxworks*] } {
        run_dump_test "usw"
        run_dump_test "usd"
     }
-    run_dump_test_arches "ulw2-eb"     [mips_arch_list_matching !gpr_ilocks]
+    run_dump_test_arches "ulw2-eb" \
+                               [mips_arch_list_matching mips1 !gpr_ilocks]
     run_dump_test_arches "ulw2-eb-ilocks" [mips_arch_list_matching gpr_ilocks]
-    run_dump_test_arches "ulw2-el"     [mips_arch_list_matching !gpr_ilocks]
+    run_dump_test_arches "ulw2-el" \
+                               [mips_arch_list_matching mips1 !gpr_ilocks]
     run_dump_test_arches "ulw2-el-ilocks" [mips_arch_list_matching gpr_ilocks]
 
     run_dump_test_arches "uld2-eb" [mips_arch_list_matching mips3]
@@ -696,6 +756,8 @@ if { [istarget mips*-*-vxworks*] } {
        run_dump_test "elf-rel25a"
        run_dump_test "elf-rel26"
 
+       run_dump_test_arches "elf-rel27" [mips_arch_list_all]
+
        if { !$no_mips16 } {
            run_dump_test "${tmips}mips${el}16-e"
            run_dump_test "${tmips}mips${el}16-f"
@@ -794,6 +856,7 @@ if { [istarget mips*-*-vxworks*] } {
     run_dump_test_arches "octeon"      [mips_arch_list_matching octeon]
     run_list_test_arches "octeon-ill" "" \
                                        [mips_arch_list_matching octeon]
+    run_dump_test_arches "octeon-pref" [mips_arch_list_matching octeon]
 
     run_dump_test "smartmips"
     run_dump_test "mips32-dsp"
@@ -840,6 +903,8 @@ if { [istarget mips*-*-vxworks*] } {
     run_dump_test "mips16-vis-1"
     run_dump_test "call-nonpic-1"
     run_dump_test "mips32-sync"
+    run_dump_test_arches "mips32r2-sync" \
+                                       [mips_arch_list_matching mips32r2]
 
     if $has_newabi { run_dump_test "cfi-n64-1" }