* [patch] test for altivec h/w on PowerPC
@ 2005-03-01 23:23 Paul Gilliam
2005-03-01 23:28 ` Daniel Jacobowitz
0 siblings, 1 reply; 12+ messages in thread
From: Paul Gilliam @ 2005-03-01 23:23 UTC (permalink / raw)
To: gdb-patches
[-- 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.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch] test for altivec h/w on PowerPC
2005-03-01 23:23 [patch] test for altivec h/w on PowerPC Paul Gilliam
@ 2005-03-01 23:28 ` Daniel Jacobowitz
2005-03-02 0:36 ` Paul Gilliam
0 siblings, 1 reply; 12+ messages in thread
From: Daniel Jacobowitz @ 2005-03-01 23:28 UTC (permalink / raw)
To: Paul Gilliam; +Cc: gdb-patches
On Tue, Mar 01, 2005 at 03:19:39PM -0800, Paul Gilliam wrote:
> 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?
Not quite.
- You've missed a changelog entry.
- You're running a test on the build system instead of the target
system.
- This code is based on Janis's check_vmx_hw_available from GCC, so you
might want to give credit. Incidentally, the original version runs the
test on $target...
--
Daniel Jacobowitz
CodeSourcery, LLC
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch] test for altivec h/w on PowerPC
2005-03-01 23:28 ` Daniel Jacobowitz
@ 2005-03-02 0:36 ` Paul Gilliam
2005-03-02 1:56 ` Daniel Jacobowitz
0 siblings, 1 reply; 12+ messages in thread
From: Paul Gilliam @ 2005-03-02 0:36 UTC (permalink / raw)
To: gdb-patches
Daniel,
Thanks a lot for your speedy review!
I didn't know Janis wrote it, she didn't say so when she showed it to me.
(Her cube is right next to mine: we are in the same group)
On Tuesday 01 March 2005 15:28, Daniel Jacobowitz wrote:
> On Tue, Mar 01, 2005 at 03:19:39PM -0800, Paul Gilliam wrote:
> > Ok to commit?
>
> Not quite.
>
> - You've missed a changelog entry.
>
Oops. Got it this time.
> - You're running a test on the build system instead of the target
> system.
>
Ok.
> - This code is based on Janis's check_vmx_hw_available from GCC, so you
> might want to give credit. Incidentally, the original version runs the
> test on $target...
Ok.
I also added a line to delete the exe file after we run it.
Ok to commit?
-=# Paul Gilliam #=-
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch] test for altivec h/w on PowerPC
2005-03-02 0:36 ` Paul Gilliam
@ 2005-03-02 1:56 ` Daniel Jacobowitz
2005-03-02 18:14 ` Paul Gilliam
0 siblings, 1 reply; 12+ messages in thread
From: Daniel Jacobowitz @ 2005-03-02 1:56 UTC (permalink / raw)
To: gdb-patches
On Tue, Mar 01, 2005 at 04:32:17PM -0800, Paul Gilliam wrote:
> Daniel,
>
> Thanks a lot for your speedy review!
>
> I didn't know Janis wrote it, she didn't say so when she showed it to me.
> (Her cube is right next to mine: we are in the same group)
She's too modest :-) Or my memory is bad.
> Ok to commit?
No patch attached? :-)
--
Daniel Jacobowitz
CodeSourcery, LLC
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch] test for altivec h/w on PowerPC
2005-03-02 1:56 ` Daniel Jacobowitz
@ 2005-03-02 18:14 ` Paul Gilliam
2005-03-02 21:50 ` Paul Gilliam
0 siblings, 1 reply; 12+ messages in thread
From: Paul Gilliam @ 2005-03-02 18:14 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 619 bytes --]
On Tuesday 01 March 2005 17:56, Daniel Jacobowitz wrote:
> On Tue, Mar 01, 2005 at 04:32:17PM -0800, Paul Gilliam wrote:
> > Daniel,
> >
> > Thanks a lot for your speedy review!
> >
> > I didn't know Janis wrote it, she didn't say so when she showed it to me.
> > (Her cube is right next to mine: we are in the same group)
>
> She's too modest :-) Or my memory is bad.
I just talked to her. She doesn't think she needs the atribution and it came
from Aldy Hernandez anyway. 8-)
>
> > Ok to commit?
>
> No patch attached? :-)
I CAN'T BELEAVE IT ! FUDGE!
Here it is:
(This time for sure, I hope 8-)
-=# Paul #=-
[-- Attachment #2: my.patch --]
[-- Type: text/x-diff, Size: 3554 bytes --]
diff -Naur testsuite.old/ChangeLog testsuite/ChangeLog
--- testsuite.old/ChangeLog 2005-03-01 14:56:21.439229400 -0800
+++ testsuite/ChangeLog 2005-03-01 15:59:49.052246512 -0800
@@ -1,3 +1,10 @@
+2004-03-01 Paul Gilliam <pgilliam@us.ibm.com>
+
+ * lib/gdb.exp: added 'skip_altivec_tests', a modification of
+ Janis Johnson's 'check_vmx_hw_available' from GCC testsuite
+ * lib/gdb.arch/altivec-abi.exp: use new 'skip_altivec_tests'
+ * lib/gdb.arch/altivec-regs.exp: Likewise
+
2004-02-24 Joel Brobecker <brobecker@adacore.com>
* gdb.ada/fixed_points.exp: Create compilation object directory
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-02 10:09:13.241270112 -0800
@@ -1142,6 +1142,59 @@
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.
+
+# This code is based on 'check_vmx_hw_available' from the GCC testsuite.
+
+proc skip_altivec_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 target "./$exe"]
+ remote_file build delete "$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.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch] test for altivec h/w on PowerPC
2005-03-02 18:14 ` Paul Gilliam
@ 2005-03-02 21:50 ` Paul Gilliam
2005-03-03 17:27 ` Daniel Jacobowitz
0 siblings, 1 reply; 12+ messages in thread
From: Paul Gilliam @ 2005-03-02 21:50 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 955 bytes --]
Murphy got me....
Here is yet another version of the patch, this time with out a 'verbose 0'
left in.
-=# Paul #=-
PS: I have another altivec related testsuite patch coming... that one will
let the compiles in altivec-*.exp succeed.
On Wednesday 02 March 2005 10:10, Paul Gilliam wrote:
> On Tuesday 01 March 2005 17:56, Daniel Jacobowitz wrote:
> > On Tue, Mar 01, 2005 at 04:32:17PM -0800, Paul Gilliam wrote:
> > > Daniel,
> > >
> > > Thanks a lot for your speedy review!
> > >
> > > I didn't know Janis wrote it, she didn't say so when she showed it to
> > > me. (Her cube is right next to mine: we are in the same group)
> >
> > She's too modest :-) Or my memory is bad.
>
> I just talked to her. She doesn't think she needs the atribution and it
> came from Aldy Hernandez anyway. 8-)
>
> > > Ok to commit?
> >
> > No patch attached? :-)
>
> I CAN'T BELEAVE IT ! FUDGE!
>
> Here it is:
> (This time for sure, I hope 8-)
>
> -=# Paul #=-
[-- Attachment #2: altivec.patch --]
[-- Type: text/x-diff, Size: 3554 bytes --]
diff -Naur testsuite.old/ChangeLog testsuite/ChangeLog
--- testsuite.old/ChangeLog 2005-03-01 14:56:21.439229400 -0800
+++ testsuite/ChangeLog 2005-03-01 15:59:49.052246512 -0800
@@ -1,3 +1,10 @@
+2004-03-01 Paul Gilliam <pgilliam@us.ibm.com>
+
+ * lib/gdb.exp: added 'skip_altivec_tests', a modification of
+ Janis Johnson's 'check_vmx_hw_available' from GCC testsuite
+ * lib/gdb.arch/altivec-abi.exp: use new 'skip_altivec_tests'
+ * lib/gdb.arch/altivec-regs.exp: Likewise
+
2004-02-24 Joel Brobecker <brobecker@adacore.com>
* gdb.ada/fixed_points.exp: Create compilation object directory
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-02 10:09:13.241270112 -0800
@@ -1142,6 +1142,59 @@
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.
+
+# This code is based on 'check_vmx_hw_available' from the GCC testsuite.
+
+proc skip_altivec_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" 1
+ 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 target "./$exe"]
+ remote_file build delete "$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.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch] test for altivec h/w on PowerPC
2005-03-02 21:50 ` Paul Gilliam
@ 2005-03-03 17:27 ` Daniel Jacobowitz
2005-03-10 0:43 ` Paul Gilliam
0 siblings, 1 reply; 12+ messages in thread
From: Daniel Jacobowitz @ 2005-03-03 17:27 UTC (permalink / raw)
To: Paul Gilliam; +Cc: gdb-patches
On Wed, Mar 02, 2005 at 01:46:35PM -0800, Paul Gilliam wrote:
> +2004-03-01 Paul Gilliam <pgilliam@us.ibm.com>
> +
> + * lib/gdb.exp: added 'skip_altivec_tests', a modification of
> + Janis Johnson's 'check_vmx_hw_available' from GCC testsuite
> + * lib/gdb.arch/altivec-abi.exp: use new 'skip_altivec_tests'
> + * lib/gdb.arch/altivec-regs.exp: Likewise
> +
First, please don't include changelogs as diffs. And be careful of
tabs.
Secondly, this should be:
* 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.
Caps, final periods.
> 2004-02-24 Joel Brobecker <brobecker@adacore.com>
>
> * gdb.ada/fixed_points.exp: Create compilation object directory
> 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] {
How about ![istarget "powerpc*-*-*"] || [skip_altivec_tests]? No point
compiling the test on i386!
> + # Some simulators are known to not support VMX instructions.
> + if { [istarget powerpc-*-eabi] || [istarget powerpc*-*-eabispe] } {
> + verbose "check_hw_available returning 0" 2
Please either update the error message, or leave the function named
check_vmx_hw_available :-)
> + verbose "skip_altivec_testing compiling testfile $src" 1
> + set lines [gdb_compile $src $exe executable {debug additional_flags=-maltivec}]
> + file delete $src
This is a GCC-only option. Will the tests ever be useful with a
non-GCC compiler? If not, please make them fail gracefully before they
try to invoke another compiler with -maltivec. See test_compiler_info.
> +
> + 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 target "./$exe"]
> + remote_file build delete "$exe"
You just compiled a binary on the build machine and tried to use
remote_exec on a target... you're probably not in the same current
directory. Have you tried just doing it the same way the GCC testsuite
does, using ${tool}_load?
--
Daniel Jacobowitz
CodeSourcery, LLC
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch] test for altivec h/w on PowerPC
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
0 siblings, 2 replies; 12+ messages in thread
From: Paul Gilliam @ 2005-03-10 0:43 UTC (permalink / raw)
To: gdb-patches; +Cc: Daniel Jacobowitz
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.
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 ${binfile}] {
+ 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.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch] test for altivec h/w on PowerPC
2005-03-10 0:43 ` Paul Gilliam
@ 2005-03-28 23:45 ` Paul Gilliam
2005-03-29 20:43 ` Daniel Jacobowitz
1 sibling, 0 replies; 12+ messages in thread
From: Paul Gilliam @ 2005-03-28 23:45 UTC (permalink / raw)
To: gdb-patches; +Cc: Daniel Jacobowitz
(ping!)
It's been a while.
ok to commit?
-=# Paul #=-
On Wednesday 09 March 2005 16:38, 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.
>
> 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 ${binfile}] {
> + 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.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch] test for altivec h/w on PowerPC
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
1 sibling, 1 reply; 12+ messages in thread
From: Daniel Jacobowitz @ 2005-03-29 20:43 UTC (permalink / raw)
To: Paul Gilliam; +Cc: gdb-patches
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.
--
Daniel Jacobowitz
CodeSourcery, LLC
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch] test for altivec h/w on PowerPC
2005-03-29 20:43 ` Daniel Jacobowitz
@ 2005-04-30 19:47 ` Daniel Jacobowitz
2005-05-03 0:48 ` [commit] " Paul Gilliam
0 siblings, 1 reply; 12+ messages in thread
From: Daniel Jacobowitz @ 2005-04-30 19:47 UTC (permalink / raw)
To: Paul Gilliam, gdb-patches
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.
--
Daniel Jacobowitz
CodeSourcery, LLC
^ permalink raw reply [flat|nested] 12+ messages in thread
* [commit] test for altivec h/w on PowerPC
2005-04-30 19:47 ` Daniel Jacobowitz
@ 2005-05-03 0:48 ` Paul Gilliam
0 siblings, 0 replies; 12+ messages in thread
From: Paul Gilliam @ 2005-05-03 0:48 UTC (permalink / raw)
To: gdb-patches; +Cc: Daniel Jacobowitz
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.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2005-05-03 0:48 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-01 23:23 [patch] test for altivec h/w on PowerPC 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 ` [commit] " Paul Gilliam
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox