* dwarf2dbg.c (process_entries): Fix uninitialized variable warning.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.arch / altivec-abi.exp
CommitLineData
c761af65 1# Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
57680a24
EZ
2#
3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by
5# the Free Software Foundation; either version 2 of the License, or
6# (at your option) any later version.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program; if not, write to the Free Software
15# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16#
17# Please email any bugs, comments, and/or additions to this file to:
18# bug-gdb@prep.ai.mit.edu
19#
20
21# Tests for Powerpc AltiVec ABI
22
23
24if $tracelevel then {
25 strace $tracelevel
26}
27
28#
dd039bc4 29# This file uses altivec-abi.c for input.
57680a24
EZ
30#
31
32set prms_id 0
33set bug_id 0
34
3c95e6af 35if {![istarget "powerpc*"] || [skip_altivec_tests]} then {
57680a24 36 verbose "Skipping altivec abi tests."
3c95e6af 37 verbose -log "Skipping altivec abi tests."
57680a24
EZ
38 return
39}
40
dd039bc4 41set testfile "altivec-abi"
57680a24 42set binfile ${objdir}/${subdir}/${testfile}
f2dd3617 43set srcfile ${testfile}.c
57680a24 44
d1779be4
PG
45set compile_flags {debug additional_flags=-w}
46if [get_compiler_info $binfile] {
47 warning "get_compiler failed"
48 return -1
49}
50
51if [test_compiler_info gcc*] {
52 set compile_flags "$compile_flags additional_flags=-maltivec"
53} elseif [test_compiler_info xlc*] {
54 set compile_flags "$compile_flags additional_flags=-qaltivec"
55} else {
56 warning "unknown compiler"
57 return -1
58}
59
60if { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile} executable $compile_flags] != "" } {
57680a24
EZ
61 gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
62}
63
64gdb_start
65gdb_reinitialize_dir $srcdir/$subdir
66gdb_load ${binfile}
67
68#
69# Run to `main' where we begin our tests.
70#
71
72if ![runto_main] then {
73 gdb_suppress_tests
74}
75
dd039bc4
EZ
76gdb_test "b marker" "Breakpoint 2 at.*file.*altivec-abi.c, line \[0-9\]+." "break marker"
77gdb_test "continue" "Breakpoint 2.*marker.*altivec-abi.c.*" "continue to marker"
78gdb_test "finish" "Run till exit from .0.*in marker.*at.*altivec-abi.c.*main \\(\\) at.*altivec-abi.c.*result = vec_func \\(vshort,.*goes in v2.*" "back to main (1)"
57680a24
EZ
79
80# now all the arguments of vec_fun are initialized
81
82set pattern "vec_func .vshort_f=.111, 222, 333, 444, 555, 666, 777, 888., vushort_f=.100, 200, 300, 400, 500, 600, 700, 800., vint_f=.-10, -20, -30, -40., vuint_f=.1111, 2222, 3333, 4444., vchar_f=.abcdefghilmnopqr., vuchar_f=.ABCDEFGHILMNOPQR., vfloat_f=.1.25, 3.75, 5.5, 1.25., x_f=.1, 2, 3, 4, 5, 6, 7, 8., y_f=.12, 22, 32, 42., a_f=.vector of chars.., b_f=.5.5, 4.5, 3.75, 2.25., c_f=.1.25, 3.5, 5.5, 7.75., intv_on_stack_f=.12, 34, 56, 78.."
83
84set pattern1 $pattern
dd039bc4 85append pattern1 " at.*altivec-abi.c.*vint_res = vec_add.*vint_f, intv_on_stack_f.;"
57680a24
EZ
86
87# Now let's call the function. This function has > 12 args,
88# the last one will go on the stack.
89gdb_test "p vec_func(vshort,vushort,vint,vuint,vchar,vuchar,vfloat,x,y,a,b,c,intv_on_stack)" \
90".\[0-9\]+ = .2, 2, 2, 2." "call inferior function with vectors (1) "
91
92# Let's call the function again with dummy arguments. This is to clean
93# up the contents of the vector registers before the next call.
94gdb_test "p vec_func(vshort_d,vushort_d,vint_d,vuint_d,vchar_d,vuchar_d,vfloat_d,x_d,y_d,a_d,b_d,c_d,intv_on_stack_d)" \
95".\[0-9\]+ = .0, 0, 0, 0." "call inferior function with vectors (2) "
96
97# Let's step into the function, to see if the args are printed correctly.
98gdb_test "step" \
99 $pattern1 \
100 "step into vec_fun"
101
102set pattern2 $pattern
dd039bc4 103append pattern2 " at.*altivec-abi.c.*in main.*result = vec_func .vshort,.*goes in v2.*Value returned is.*= .2, 2, 2, 2."
57680a24
EZ
104
105# Let's see if the result is returned correctly.
106gdb_test "finish" \
107 "Run till exit from .0.*$pattern2" \
108 "vector value returned correctly"
109
110# can we print the args correctly for this function?
111gdb_test "break struct_of_vector_func" "" ""
112
dd039bc4 113set pattern "struct_of_vector_func .vector_struct=.vshort1 = .1, 2, 3, 4, 5, 6, 7, 8., vshort2 = .11, 12, 13, 14, 15, 16, 17, 18., vshort3 = .21, 22, 23, 24, 25, 26, 27, 28., vshort4 = .31, 32, 33, 34, 35, 36, 37, 38... at.*altivec-abi.c.*"
57680a24
EZ
114
115gdb_test "continue" \
116 "Breakpoint 3, $pattern.*vector_struct.vshort1 = vec_add .vector_struct.vshort1, vector_struct.vshort2.;" \
117 "continue to struct_of_vector_func"
118
119gdb_test "finish" \
dd039bc4 120 "Run till exit from .0 $pattern\[ \r\n\]+main.*altivec-abi.c.*array_of_vector_func.*" \
57680a24
EZ
121 "back to main (2)"
122
123gdb_test "step" "" "step into array_of_vector_func"
124gdb_test "p matrix\[0\]" ".*= .1, 2, 3, 4, 5, 6, 7, 8." "print first vector"
125gdb_test "p matrix\[1\]" ".*= .11, 12, 13, 14, 15, 16, 17, 18." "print second vector"
126gdb_test "p matrix\[2\]" ".*= .21, 22, 23, 24, 25, 26, 27, 28." "print third vector"
127gdb_test "p matrix\[3\]" ".*= .31, 32, 33, 34, 35, 36, 37, 38." "print fourth vector"
128
This page took 0.369801 seconds and 4 git commands to generate.