From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6789 invoked by alias); 28 Mar 2005 23:45:24 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 6767 invoked from network); 28 Mar 2005 23:45:19 -0000 Received: from unknown (HELO e35.co.us.ibm.com) (32.97.110.133) by sourceware.org with SMTP; 28 Mar 2005 23:45:19 -0000 Received: from westrelay01.boulder.ibm.com (westrelay01.boulder.ibm.com [9.17.195.10]) by e35.co.us.ibm.com (8.12.10/8.12.9) with ESMTP id j2SNjILg319564 for ; Mon, 28 Mar 2005 18:45:18 -0500 Received: from d03av01.boulder.ibm.com (d03av01.boulder.ibm.com [9.17.195.167]) by westrelay01.boulder.ibm.com (8.12.10/NCO/VER6.6) with ESMTP id j2SNjIIh117336 for ; Mon, 28 Mar 2005 16:45:18 -0700 Received: from d03av01.boulder.ibm.com (loopback [127.0.0.1]) by d03av01.boulder.ibm.com (8.12.11/8.12.11) with ESMTP id j2SNjHrL010200 for ; Mon, 28 Mar 2005 16:45:17 -0700 Received: from dyn9047022123.beaverton.ibm.com (dyn9047022123.beaverton.ibm.com [9.47.22.123]) by d03av01.boulder.ibm.com (8.12.11/8.12.11) with ESMTP id j2SNjH39010189; Mon, 28 Mar 2005 16:45:17 -0700 From: Paul Gilliam Reply-To: pgilliam@us.ibm.com To: gdb-patches@sources.redhat.com Subject: Re: [patch] test for altivec h/w on PowerPC Date: Mon, 28 Mar 2005 23:45:00 -0000 User-Agent: KMail/1.6.2 Cc: Daniel Jacobowitz References: <200503011519.39739.pgilliam@us.ibm.com> <20050303172642.GB18681@nevyn.them.org> <200503091638.16585.pgilliam@us.ibm.com> In-Reply-To: <200503091638.16585.pgilliam@us.ibm.com> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200503281540.44821.pgilliam@us.ibm.com> X-SW-Source: 2005-03/txt/msg00369.txt.bz2 (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 > > * 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.