#
# i386 tests
#
-proc run_list_test { name opts } {
- global srcdir subdir
- set testname "i386 $name"
- set file $srcdir/$subdir/$name
- gas_run ${name}.s $opts ">&dump.out"
- if { [regexp_diff "dump.out" "${file}.l"] } then {
- fail $testname
- verbose "output is [file_contents "dump.out"]" 2
- return
- }
- pass $testname
-}
-
proc gas_64_check { } {
global NM
global NMFLAGS
- global srcdir
- catch "exec $srcdir/lib/run $NM $NMFLAGS --help" nm_help
- return [regexp "targets:.*x86-64" $nm_help];
+ set status [gas_host_run "$NM $NMFLAGS --help" ""]
+ return [regexp "targets:.*x86-64" [lindex $status 1]];
}
proc gas_32_check { } {
global NM
global NMFLAGS
- global srcdir
- catch "exec $srcdir/lib/run $NM $NMFLAGS --help" nm_help
- return [regexp "targets:.*i386" $nm_help];
+ set status [gas_host_run "$NM $NMFLAGS --help" ""]
+ return [regexp "targets:.*i386" [lindex $status 1]];
}
-
if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_32_check]] then {
global ASFLAGS
set old_ASFLAGS "$ASFLAGS"
set ASFLAGS "$ASFLAGS --32"
- run_list_test "float" "-al"
- run_list_test "general" "-al --listing-lhs-width=2"
+ run_list_test "float" "-al -mmnemonic=att"
+ run_list_test "general" "-al --listing-lhs-width=2 -mold-gcc"
run_list_test "inval" "-al"
+ run_list_test "segment" "-al"
+ run_list_test "inval-seg" "-al"
run_list_test "modrm" "-al --listing-lhs-width=2"
run_dump_test "naked"
run_dump_test "opcode"
+ run_dump_test "opcode-intel"
+ run_dump_test "opcode-suffix"
run_dump_test "intel"
run_dump_test "intel16"
+ run_list_test "intelbad" ""
+ run_dump_test "intelok"
run_dump_test "prefix"
run_dump_test "amd"
run_dump_test "katmai"
run_dump_test "jump"
run_dump_test "ssemmx2"
run_dump_test "sse2"
-
- # PIC is only supported on ELF targets.
- if { ([istarget "*-*-elf*"] || [istarget "*-*-linux*"] )
- && ![istarget *-*-linux*aout*]
- && ![istarget *-*-linux*oldld*] } then {
- run_dump_test "intelpic"
- }
+ run_dump_test "sub"
+ run_dump_test "prescott"
+ run_dump_test "sib"
+ run_dump_test "sib-intel"
+ run_dump_test "vmx"
+ run_dump_test "smx"
+ run_dump_test "suffix"
+ run_dump_test "immed32"
+ run_dump_test "equ"
+ run_dump_test "divide"
+ run_dump_test "padlock"
+ run_dump_test "crx"
+ run_list_test "cr-err" ""
+ run_dump_test "svme"
+ run_dump_test "amdfam10"
+ run_dump_test "merom"
+ run_dump_test "rep"
+ run_dump_test "rep-suffix"
+ run_dump_test "fp"
+ run_dump_test "nops"
+ run_dump_test "nops16-1"
+ run_dump_test "nops-1"
+ run_dump_test "nops-1-i386"
+ run_dump_test "nops-1-i386-i686"
+ run_dump_test "nops-1-i686"
+ run_dump_test "nops-1-k8"
+ run_dump_test "nops-1-merom"
+ run_dump_test "nops-2"
+ run_dump_test "nops-2-i386"
+ run_dump_test "nops-2-merom"
+ run_dump_test "nops-3"
+ run_dump_test "nops-3-i386"
+ run_dump_test "nops-3-i686"
+ run_dump_test "nops-4"
+ run_dump_test "nops-4-i386"
+ run_dump_test "nops-4-i686"
+ run_dump_test "nops-5"
+ run_dump_test "nops-5-i686"
+ run_dump_test "addr16"
+ run_dump_test "addr32"
+ run_dump_test "sse4_1"
+ run_dump_test "sse4_1-intel"
+ run_dump_test "sse4_2"
+ run_dump_test "sse4_2-intel"
+ run_dump_test "crc32"
+ run_dump_test "crc32-intel"
+ run_list_test "inval-crc32" "-al"
+ run_dump_test "simd"
+ run_dump_test "simd-intel"
+ run_dump_test "simd-suffix"
+ run_dump_test "mem"
+ run_dump_test "mem-intel"
+ run_dump_test "reg"
+ run_dump_test "reg-intel"
+ run_dump_test "i386"
+ run_dump_test "compat"
+ run_dump_test "compat-intel"
+ run_dump_test "arch-1"
+ run_dump_test "arch-2"
+ run_dump_test "arch-3"
+ run_dump_test "arch-5"
+ run_dump_test "arch-6"
+ run_dump_test "arch-7"
+ run_dump_test "arch-9"
+ run_dump_test "arch-10"
+ run_list_test "arch-10-1" "-march=generic32 -I${srcdir}/$subdir -al"
+ run_list_test "arch-10-2" "-march=i686 -I${srcdir}/$subdir -al"
+ run_list_test "arch-10-3" "-march=i686+sse4.2 -I${srcdir}/$subdir -al"
+ run_list_test "arch-10-4" "-march=i686+sse4+vmx+smx -I${srcdir}/$subdir -al"
+ run_dump_test "arch-11"
+ run_dump_test "arch-12"
+ run_dump_test "xsave"
+ run_dump_test "xsave-intel"
+ run_dump_test "aes"
+ run_dump_test "aes-intel"
+ run_dump_test "clmul"
+ run_dump_test "clmul-intel"
+ run_dump_test "avx"
+ run_dump_test "avx-intel"
+ run_dump_test "sse2avx"
+ run_list_test "inval-avx" "-al"
+ run_dump_test "sse-check"
+ run_dump_test "sse-check-none"
+ run_dump_test "sse-check-warn"
+ run_list_test "sse-check-error" "-msse-check=error -I${srcdir}/$subdir -al"
+ run_dump_test "sse-noavx"
+ run_dump_test "movbe"
+ run_dump_test "movbe-intel"
+ run_list_test "inval-movbe" "-al"
+ run_dump_test "ept"
+ run_dump_test "ept-intel"
+ run_list_test "inval-ept" "-al"
+ run_dump_test "arch-avx-1"
+ run_list_test "arch-avx-1-1" "-march=generic32+avx -I${srcdir}/$subdir -al"
+ run_list_test "arch-avx-1-2" "-march=generic32+aes -I${srcdir}/$subdir -al"
+ run_list_test "arch-avx-1-3" "-march=generic32+pclmul -I${srcdir}/$subdir -al"
+ run_list_test "arch-avx-1-4" "-march=generic32+avx+aes -I${srcdir}/$subdir -al"
+ run_list_test "arch-avx-1-5" "-march=generic32+avx+pclmul -I${srcdir}/$subdir -al"
+ run_list_test "arch-avx-1-6" "-march=generic32+aes+pclmul -I${srcdir}/$subdir -al"
+ run_dump_test "opts"
+ run_dump_test "opts-intel"
+ run_dump_test "sse2avx-opts"
+ run_dump_test "sse2avx-opts-intel"
+ run_dump_test "fma"
+ run_dump_test "fma-intel"
+ run_dump_test "fma4"
# These tests require support for 8 and 16 bit relocs,
# so we only run them for ELF and COFF targets.
- if {[istarget "*-*-elf*"] || [istarget "*-*-linux*"] || [istarget "*-*-coff*"]} then {
+ if {[is_elf_format] || [istarget "*-*-coff*"]} then {
run_dump_test "reloc"
run_dump_test "jump16"
run_list_test "white" "-al --listing-lhs-width=3"
+
+ # These tests should in theory work for PE targets as well,
+ # but the relocs we currently produce are slightly different
+ # from those produced for ELF/COFF based toolchains.
+ # So for now we ignore PE targets.
+ run_dump_test "pcrel"
+ run_dump_test "absrel"
}
- # Do they only work for ELF?
- if { ([istarget "*-*-elf*"]
- || [istarget "*-*-linux*"]
- && ![istarget *-*-linux*aout*]
- && ![istarget *-*-linux*oldld*])
- } then {
+ # ELF specific tests
+ if [is_elf_format] then {
+ # PIC is only supported on ELF targets.
+ run_dump_test "intelpic"
+
run_dump_test "relax"
+ run_dump_test "gotpc"
run_dump_test "tlsd"
run_dump_test "tlspic"
run_dump_test "tlsnopic"
+ run_dump_test "bss"
+ run_dump_test "reloc32"
+ run_list_test "reloc32" "--defsym _bad_=1"
+ run_dump_test "mixed-mode-reloc32"
+ run_dump_test "att-regs"
+ run_dump_test "intel-regs"
+ run_list_test "inval-equ-1" "-al"
+ run_list_test "inval-equ-2" "-al"
+ run_dump_test "ifunc"
+ }
+
+ # This is a PE specific test.
+ if { [istarget "*-*-cygwin*"] || [istarget "*-*-pe"]
+ || [istarget "*-*-mingw*"]
+ } then {
+ run_dump_test "secrel"
}
set ASFLAGS "$old_ASFLAGS"
}
+if [expr [istarget "i*86-*-*"] || [istarget "x86_64-*-*"]] then {
+ run_dump_test "intel-expr"
+ run_dump_test "string-ok"
+ run_list_test "string-bad" ""
+}
+
if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_64_check]] then {
global ASFLAGS
set ASFLAGS "$ASFLAGS --64"
run_dump_test "x86_64"
+ run_dump_test "x86-64-addr32"
+ run_dump_test "x86-64-addr32-intel"
run_dump_test "x86-64-opcode"
+ run_dump_test "x86-64-intel64"
+ if { ![istarget "*-*-mingw*"] } then {
+ run_dump_test "x86-64-pcrel"
+ } else {
+ run_dump_test "x86-64-w64-pcrel"
+ }
+ run_dump_test "x86-64-rip"
+ run_dump_test "x86-64-rip-intel"
+ run_dump_test "x86-64-stack"
+ run_dump_test "x86-64-stack-intel"
+ run_dump_test "x86-64-stack-suffix"
run_list_test "x86-64-inval" "-al"
+ run_list_test "x86-64-segment" "-al"
+ run_list_test "x86-64-inval-seg" "-al"
+ run_dump_test "x86-64-branch"
+ run_dump_test "svme64"
+ run_dump_test "x86-64-amdfam10"
+ run_dump_test "x86-64-vmx"
+ run_dump_test "immed64"
+ run_dump_test "x86-64-prescott"
+ run_dump_test "x86-64-crx"
+ run_dump_test "x86-64-crx-suffix"
+ run_dump_test "x86-64-drx"
+ run_dump_test "x86-64-drx-suffix"
+ run_dump_test "x86-64-merom"
+ run_dump_test "x86-64-rep"
+ run_dump_test "x86-64-rep-suffix"
+ run_dump_test "x86-64-cbw"
+ run_dump_test "x86-64-cbw-intel"
+ run_dump_test "x86-64-io"
+ run_dump_test "x86-64-io-intel"
+ run_dump_test "x86-64-io-suffix"
+ run_dump_test "x86-64-gidt"
+ run_dump_test "x86-64-nops"
+ run_dump_test "x86-64-nops-1"
+ run_dump_test "x86-64-nops-1-k8"
+ run_dump_test "x86-64-nops-1-nocona"
+ run_dump_test "x86-64-nops-1-merom"
+ run_dump_test "x86-64-nops-2"
+ run_dump_test "x86-64-nops-3"
+ run_dump_test "x86-64-nops-4"
+ run_dump_test "x86-64-nops-4-core2"
+ run_dump_test "x86-64-nops-4-k8"
+ run_dump_test "x86-64-nops-5"
+ run_dump_test "x86-64-nops-5-k8"
+ run_dump_test "x86-64-sse4_1"
+ run_dump_test "x86-64-sse4_1-intel"
+ run_dump_test "x86-64-sse4_2"
+ run_dump_test "x86-64-sse4_2-intel"
+ run_dump_test "x86-64-crc32"
+ run_dump_test "x86-64-crc32-intel"
+ run_list_test "x86-64-inval-crc32" "-al"
+ run_dump_test "x86-64-simd"
+ run_dump_test "x86-64-simd-intel"
+ run_dump_test "x86-64-simd-suffix"
+ run_dump_test "x86-64-mem"
+ run_dump_test "x86-64-mem-intel"
+ run_dump_test "x86-64-reg"
+ run_dump_test "x86-64-reg-intel"
+ run_dump_test "x86-64-sib"
+ run_dump_test "x86-64-sib-intel"
+ if { ![istarget "*-*-mingw*"] } then {
+ run_dump_test "x86-64-opcode-inval"
+ run_dump_test "x86-64-opcode-inval-intel"
+ }
+ run_dump_test "rexw"
+ run_dump_test "x86-64-arch-1"
+ run_dump_test "x86-64-arch-2"
+ run_dump_test "x86-64-xsave"
+ run_dump_test "x86-64-xsave-intel"
+ run_dump_test "x86-64-aes"
+ run_dump_test "x86-64-aes-intel"
+ run_dump_test "x86-64-clmul"
+ run_dump_test "x86-64-clmul-intel"
+ run_dump_test "x86-64-avx"
+ run_dump_test "x86-64-avx-intel"
+ run_dump_test "x86-64-sse2avx"
+ run_list_test "x86-64-inval-avx" "-al"
+ run_dump_test "x86-64-sse-check"
+ run_dump_test "x86-64-sse-check-none"
+ run_dump_test "x86-64-sse-check-warn"
+ run_list_test "x86-64-sse-check-error" "-msse-check=error -I${srcdir}/$subdir -al"
+ run_dump_test "x86-64-sse-noavx"
+ run_dump_test "x86-64-movbe"
+ run_dump_test "x86-64-movbe-intel"
+ run_list_test "x86-64-inval-movbe" "-al"
+ run_dump_test "x86-64-ept"
+ run_dump_test "x86-64-ept-intel"
+ run_list_test "x86-64-inval-ept" "-al"
+ run_dump_test "x86-64-opts"
+ run_dump_test "x86-64-opts-intel"
+ run_dump_test "x86-64-sse2avx-opts"
+ run_dump_test "x86-64-sse2avx-opts-intel"
+ run_dump_test "x86-64-avx-swap"
+ run_dump_test "x86-64-avx-swap-intel"
+ run_dump_test "x86-64-fma"
+ run_dump_test "x86-64-fma-intel"
+ run_dump_test "x86-64-fma4"
+
+ if { ![istarget "*-*-aix*"]
+ && ![istarget "*-*-beos*"]
+ && ![istarget "*-*-*bsd*"]
+ && ![istarget "*-*-chaos*"]
+ && ![istarget "*-*-kaos*"]
+ && ![istarget "*-*-lynx*"]
+ && ![istarget "*-*-moss*"]
+ && ![istarget "*-*-nto-qnx*"]
+ && ![istarget "*-*-rtems*"]
+ && ![istarget "*-*-sco*"]
+ && ![istarget "*-*-solaris*"]
+ && ![istarget "*-*-sysv*"] } then {
+ run_dump_test "rex"
+ }
+
+ # For ELF targets verify that @unwind works.
+ if { ([istarget "*-*-elf*"] || [istarget "*-*-linux*"]
+ || [istarget "*-*-solaris2.*"])
+ && ![istarget *-*-linux*aout*]
+ && ![istarget *-*-linux*oldld*] } then {
+ run_dump_test "x86-64-unwind"
+ }
+
+ # ELF specific tests
+ if [is_elf_format] then {
+ run_dump_test "reloc64"
+ run_list_test "reloc64" "--defsym _bad_=1"
+ run_dump_test "mixed-mode-reloc64"
+ run_dump_test "x86-64-ifunc"
+ }
set ASFLAGS "$old_ASFLAGS"
}