From: Paul Gilliam <pgilliam@us.ibm.com>
To: gdb-patches@sources.redhat.com
Subject: [patch] test for altivec h/w on PowerPC
Date: Tue, 01 Mar 2005 23:23:00 -0000 [thread overview]
Message-ID: <200503011519.39739.pgilliam@us.ibm.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 711 bytes --]
testsuite/gdb.arch/altivec-abi.exp and testsuite/gdb.arch/altivec-regs.exp
test for relivance by checking if the configuration string ends in 'altivec'.
This wasn't working for me and doesn't seem like the right way to do this.
So I replaced it by adding a new routine to testsuit/lib/gdb.exp that compiles
and runs a tiny little program. If we are on any machine that doesn't have
altivec hardware, then either the compile fails or the tiny little program
gets an illegal instruction trap when run. This is a modification of a
similar routine in the gcc testsuite. (cut-and-paste code re-use)
I then changed the two tests mentioned above to use the new routine.
Ok to commit?
-=# Paul Gilliam #=-
[-- Attachment #2: my.patch --]
[-- Type: text/x-diff, Size: 2813 bytes --]
diff -Naur testsuite.old/gdb.arch/altivec-abi.exp testsuite/gdb.arch/altivec-abi.exp
--- testsuite.old/gdb.arch/altivec-abi.exp 2005-03-01 14:56:21.484222560 -0800
+++ testsuite/gdb.arch/altivec-abi.exp 2005-03-01 15:01:49.451289288 -0800
@@ -32,7 +32,7 @@
set prms_id 0
set bug_id 0
-if ![istarget "powerpc-*altivec"] then {
+if [skip_altivec_tests] {
verbose "Skipping altivec abi tests."
return
}
diff -Naur testsuite.old/gdb.arch/altivec-regs.exp testsuite/gdb.arch/altivec-regs.exp
--- testsuite.old/gdb.arch/altivec-regs.exp 2005-03-01 14:56:21.485222408 -0800
+++ testsuite/gdb.arch/altivec-regs.exp 2005-03-01 15:02:41.869176744 -0800
@@ -32,7 +32,7 @@
set prms_id 0
set bug_id 0
-if ![istarget "powerpc-*altivec"] then {
+if [skip_altivec_tests] then {
verbose "Skipping altivec register tests."
return
}
diff -Naur testsuite.old/lib/gdb.exp testsuite/lib/gdb.exp
--- testsuite.old/lib/gdb.exp 2005-03-01 14:56:22.127258976 -0800
+++ testsuite/lib/gdb.exp 2005-03-01 15:00:18.199183888 -0800
@@ -1142,6 +1142,57 @@
return 0
}
+# Run a test on the target to see if it supports vmx hardware.
+# Return 1 if it does not, 0 if it does.
+
+proc skip_atltivec_tests {} {
+ global skip_vmx_tests_saved
+
+ if [info exists skip_vmx_tests_saved] {
+ verbose "check_hw_available: returning saved $skip_vmx_tests_saved" 2
+ return $skip_vmx_tests_saved
+ }
+
+ # Some simulators are known to not support VMX instructions.
+ if { [istarget powerpc-*-eabi] || [istarget powerpc*-*-eabispe] } {
+ verbose "check_hw_available returning 0" 2
+ return [set $skip_vmx_tests_saved 1]
+ }
+
+ # Set up, compile, and execute a test program containing VMX
+ # instructions. Include the current process ID in the file
+ # names to prevent conflicts with invocations for multiple
+ # testsuites.
+ set src vmx[pid].c
+ set exe vmx[pid].x
+
+ set f [open $src "w"]
+ puts $f "int main() {"
+ puts $f "#ifdef __MACH__"
+ puts $f " asm volatile (\"vor v0,v0,v0\");"
+ puts $f "#else"
+ puts $f " asm volatile (\"vor 0,0,0\");"
+ puts $f "#endif"
+ puts $f " return 0; }"
+ close $f
+
+ verbose "skip_altivec_testing compiling testfile $src" 0
+ set lines [gdb_compile $src $exe executable {debug additional_flags=-maltivec}]
+ file delete $src
+
+ if ![string match "" $lines] then {
+ verbose "check_vmx_hw_availalble testfile compilation failed" 2
+ return [set skip_vmx_tests_saved 1]
+ }
+
+ # No error message, compilation succeeded so now run it.
+
+ set exec_result [remote_exec build "./$exe"]
+
+ return [set skip_vmx_tests_saved [lindex $exec_result 0]]
+}
+
+
# Skip all the tests in the file if you are not on an hppa running
# hpux target.
next reply other threads:[~2005-03-01 23:23 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-01 23:23 Paul Gilliam [this message]
2005-03-01 23:28 ` Daniel Jacobowitz
2005-03-02 0:36 ` Paul Gilliam
2005-03-02 1:56 ` Daniel Jacobowitz
2005-03-02 18:14 ` Paul Gilliam
2005-03-02 21:50 ` Paul Gilliam
2005-03-03 17:27 ` Daniel Jacobowitz
2005-03-10 0:43 ` Paul Gilliam
2005-03-28 23:45 ` Paul Gilliam
2005-03-29 20:43 ` Daniel Jacobowitz
2005-04-30 19:47 ` Daniel Jacobowitz
2005-05-03 0:48 ` [commit] " Paul Gilliam
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200503011519.39739.pgilliam@us.ibm.com \
--to=pgilliam@us.ibm.com \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox