From: Paul Gilliam <pgilliam@us.ibm.com>
To: gdb-patches@sources.redhat.com
Cc: Daniel Jacobowitz <drow@false.org>
Subject: [commit] test for altivec h/w on PowerPC
Date: Tue, 03 May 2005 00:48:00 -0000 [thread overview]
Message-ID: <200505021751.46772.pgilliam@us.ibm.com> (raw)
In-Reply-To: <20050430194716.GA6713@nevyn.them.org>
On Saturday 30 April 2005 12:47, Daniel Jacobowitz wrote:
> On Tue, Mar 29, 2005 at 03:44:49PM -0500, Daniel Jacobowitz wrote:
> > On Wed, Mar 09, 2005 at 04:38:16PM -0800, Paul Gilliam wrote:
> > > Ok, I have made all the requested chanages and tested it on powerpc with and with out altivec.
> > >
> > > NOTE: this patch depends on a previous patch so that gdb.arch/altivec-*.exp can compile their test programs. The previous patch is here:
> > > http://sources.redhat.com/ml/gdb-patches/2005-03/msg00157.html
> > >
> > > 2005-03-09 Paul Gilliam <pgilliam@us.ibm.com>
> > >
> > > * lib/gdb.exp: New proc 'skip_altivec_tests'
> > > * gdb.arch/altivec-abi.exp, gdb.arch/altivec-regs.exp: Use the new proc.
> >
> > OK. Some more adjustment may be needed but let's wait and see.
>
> Paul, you may have missed these approvals. Going to commit these
> patches?
>
> BTW, please use the ChangeLog I suggested earlier in this thread; the
> above is wrong.
>
Here is the patch as committed. It is slightly different due to an error in the original: in 'skip_altivec_tests',
get_compiler_info was called with an argument of '${binfile}' but there was no variable by that name.
So I changed it to 'get_compiler_info not-used' which worked fine.
-=# Paul #=-
2004-05-02 Paul Gilliam <pgilliam@us.ibm.com>
* lib/gdb.exp (skip_altivec_tests): New function, based on
check_vmx_hw_available from the GCC testsuite.
* lib/gdb.arch/altivec-abi.exp: Use skip_altivec_tests.
* lib/gdb.arch/altivec-regs.exp: Likewise.
Index: gdb.arch/altivec-abi.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.arch/altivec-abi.exp,v
retrieving revision 1.3
diff -c -3 -p -r1.3 altivec-abi.exp
*** gdb.arch/altivec-abi.exp 20 Jan 2003 15:40:07 -0000 1.3
--- gdb.arch/altivec-abi.exp 10 Mar 2005 00:19:27 -0000
*************** if $tracelevel then {
*** 32,39 ****
set prms_id 0
set bug_id 0
! if ![istarget "powerpc-*altivec"] then {
verbose "Skipping altivec abi tests."
return
}
--- 32,40 ----
set prms_id 0
set bug_id 0
! if {![istarget "powerpc*"] || [skip_altivec_tests]} then {
verbose "Skipping altivec abi tests."
+ verbose -log "Skipping altivec abi tests."
return
}
Index: gdb.arch/altivec-regs.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.arch/altivec-regs.exp,v
retrieving revision 1.2
diff -c -3 -p -r1.2 altivec-regs.exp
*** gdb.arch/altivec-regs.exp 20 Jan 2003 15:40:07 -0000 1.2
--- gdb.arch/altivec-regs.exp 10 Mar 2005 00:19:27 -0000
*************** if $tracelevel then {
*** 32,39 ****
set prms_id 0
set bug_id 0
! if ![istarget "powerpc-*altivec"] then {
verbose "Skipping altivec register tests."
return
}
--- 32,40 ----
set prms_id 0
set bug_id 0
! if {![istarget "powerpc*"] || [skip_altivec_tests]} then {
verbose "Skipping altivec register tests."
+ verbose -log "Skipping altivec register tests."
return
}
Index: lib/gdb.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v
retrieving revision 1.58
diff -c -3 -p -r1.58 gdb.exp
*** lib/gdb.exp 10 Sep 2004 01:04:59 -0000 1.58
--- lib/gdb.exp 10 Mar 2005 00:19:28 -0000
*************** proc skip_fortran_tests {} {
*** 1142,1147 ****
--- 1142,1235 ----
return 0
}
+ # Run a test on the target to see if it supports vmx hardware. Return 0 if so,
+ # 1 if it does not. Based on 'check_vmx_hw_available' from the GCC testsuite.
+
+ proc skip_altivec_tests {} {
+ global skip_vmx_tests_saved
+ global srcdir subdir gdb_prompt
+
+ # Use the cached value, if it exists.
+ set me "skip_altivec_tests"
+ if [info exists skip_vmx_tests_saved] {
+ verbose "$me: 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 "$me: target known to not support VMX, returning 1" 2
+ return [set $skip_vmx_tests_saved 1]
+ }
+
+ # Make sure we have a compiler that understands altivec.
+ set compile_flags {debug additional_flags=-w}
+ if [get_compiler_info not-used] {
+ warning "Could not get compiler info"
+ return 1
+ }
+ if [test_compiler_info gcc*] {
+ set compile_flags "$compile_flags additional_flags=-maltivec"
+ } elseif [test_compiler_info xlc*] {
+ set compile_flags "$compile_flags additional_flags=-qaltivec"
+ } else {
+ verbose "Could not compile with altivec support, returning 1" 2
+ return 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 "$me: compiling testfile $src" 2
+ set lines [gdb_compile $src $exe executable $compile_flags]
+ file delete $src
+
+ if ![string match "" $lines] then {
+ verbose "$me: testfile compilation failed, returning 1" 2
+ return [set skip_vmx_tests_saved 1]
+ }
+
+ # No error message, compilation succeeded so now run it via gdb.
+
+ gdb_exit
+ gdb_start
+ gdb_reinitialize_dir $srcdir/$subdir
+ gdb_load "$exe"
+ gdb_run_cmd
+ gdb_expect {
+ -re ".*Illegal instruction.*${gdb_prompt} $" {
+ verbose -log "\n$me altivec hardware not detected"
+ set skip_vmx_tests_saved 1
+ }
+ -re ".*Program exited normally.*${gdb_prompt} $" {
+ verbose -log "\n$me: altivec hardware detected"
+ set skip_vmx_tests_saved 0
+ }
+ default {
+ warning "\n$me: default case taken"
+ set skip_vmx_tests_saved 1
+ }
+ }
+ gdb_exit
+ remote_file build delete $exe
+
+ verbose "$me: returning $skip_vmx_tests_saved" 2
+ return $skip_vmx_tests_saved
+ }
+
# Skip all the tests in the file if you are not on an hppa running
# hpux target.
prev parent reply other threads:[~2005-05-03 0:48 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-01 23:23 [patch] " Paul Gilliam
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 ` Paul Gilliam [this message]
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=200505021751.46772.pgilliam@us.ibm.com \
--to=pgilliam@us.ibm.com \
--cc=drow@false.org \
--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