OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-7.1/] [gdb/] [testsuite/] [gdb.arch/] [altivec-abi.exp] - Blame information for rev 842

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 227 jeremybenn
# Copyright (C) 2002, 2003, 2005, 2007, 2008, 2009, 2010
2
# Free Software Foundation, Inc.
3
#
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; either version 3 of the License, or
7
# (at your option) any later version.
8
#
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
# GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License
15
# along with this program.  If not, see .
16
#
17
 
18
# Tests for Powerpc AltiVec ABI
19
 
20
 
21
if $tracelevel then {
22
    strace $tracelevel
23
}
24
 
25
#
26
# This file uses altivec-abi.c for input.
27
#
28
 
29
if {![istarget "powerpc*"] || [skip_altivec_tests]} then {
30
    verbose "Skipping altivec abi tests."
31
    return
32
}
33
 
34
set testfile "altivec-abi"
35
set binfile ${objdir}/${subdir}/${testfile}
36
set srcfile ${testfile}.c
37
 
38
if [get_compiler_info $binfile] {
39
    warning "get_compiler failed"
40
    return -1
41
}
42
 
43
proc altivec_abi_tests { extra_flags force_abi } {
44
    global testfile binfile srcfile srcdir subdir
45
    global gdb_prompt
46
 
47
    set compile_flags "debug nowarnings $extra_flags"
48
 
49
    if  { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile} executable $compile_flags] != "" } {
50
        untested altivec-abi.exp
51
        return -1
52
    }
53
 
54
    if { "$force_abi" == "auto" } {
55
        # If the toolchain does not record attributes, skip auto-ABI tests.
56
        set readelf_program [transform readelf]
57
        set result [catch "exec $readelf_program -A $binfile" output]
58
 
59
        if {$result == 0 && ![regexp Tag_GNU_Power_ABI_Vector $output]} {
60
            untested "ABI not marked"
61
            return
62
        }
63
    }
64
 
65
    gdb_exit
66
    gdb_start
67
    gdb_reinitialize_dir $srcdir/$subdir
68
    gdb_load ${binfile}
69
 
70
    # Run to `main' where we begin our tests.
71
    if ![runto_main] then {
72
        untested altivec-abi.exp
73
        return -1
74
    }
75
 
76
    gdb_test "set print frame-arguments all"
77
    gdb_test "set powerpc vector-abi $force_abi"
78
 
79
    gdb_test "b marker" "Breakpoint 2 at.*file.*altivec-abi.c, line \[0-9\]+." "break marker"
80
    gdb_test "continue" "Breakpoint 2.*marker.*altivec-abi.c.*" "continue to marker"
81
    gdb_test "finish" "Run till exit from .0.*marker.*at.*altivec-abi.c.*main \\(\\) at.*altivec-abi.c.*result = vec_func \\(vshort,.*goes in v2.*" "back to main (1)"
82
 
83
    # now all the arguments of vec_fun are initialized
84
 
85
    set 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.."
86
 
87
    set pattern1 $pattern
88
    append pattern1 " at.*altivec-abi.c.*vint_res  = vec_add.*vint_f, intv_on_stack_f.;"
89
 
90
    # Now let's call the function.  This function has > 12 args,
91
    # the last one will go on the stack.
92
    set msg "call inferior function with vectors (1)"
93
    gdb_test "p vec_func(vshort,vushort,vint,vuint,vchar,vuchar,vfloat,x,y,a,b,c,intv_on_stack)" \
94
        ".\[0-9\]+ = .2, 2, 2, 2." "call inferior function with vectors (1)"
95
 
96
    # Let's call the function again with dummy arguments.  This is to clean
97
    # up the contents of the vector registers before the next call.
98
    gdb_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)" \
99
        ".\[0-9\]+ = .0, 0, 0, 0." "call inferior function with vectors (2)"
100
 
101
    # Let's step into the function, to see if the args are printed correctly.
102
    gdb_test "step" \
103
        $pattern1 \
104
        "step into vec_fun"
105
 
106
    set pattern2 $pattern
107
    append pattern2 " at.*altivec-abi.c.*main.*result = vec_func .vshort,.*goes in v2.*Value returned is.*= .2, 2, 2, 2."
108
 
109
    # Let's see if the result is returned correctly.
110
    gdb_test "finish" "Run till exit from .0.*$pattern2" \
111
        "vector value returned correctly"
112
 
113
    # can we print the args correctly for this function?
114
    gdb_test "break struct_of_vector_func" "" ""
115
 
116
    set 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.*"
117
 
118
    gdb_test "continue" \
119
        "Breakpoint 3, $pattern.*vector_struct.vshort1 = vec_add .vector_struct.vshort1, vector_struct.vshort2.;" \
120
        "continue to struct_of_vector_func"
121
 
122
    gdb_test "finish" \
123
        "Run till exit from .0  $pattern\[ \r\n\]+main.*altivec-abi.c.*array_of_vector_func.*" \
124
        "back to main (2)"
125
 
126
    gdb_test "step" "" "step into array_of_vector_func"
127
    gdb_test "p matrix\[0\]" ".*= .1, 2, 3, 4, 5, 6, 7, 8." "print first vector"
128
    gdb_test "p matrix\[1\]" ".*= .11, 12, 13, 14, 15, 16, 17, 18." "print second vector"
129
    gdb_test "p matrix\[2\]" ".*= .21, 22, 23, 24, 25, 26, 27, 28." "print third vector"
130
    gdb_test "p matrix\[3\]" ".*= .31, 32, 33, 34, 35, 36, 37, 38." "print fourth vector"
131
}
132
 
133
if [test_compiler_info gcc*] {
134
    set saved_prefix $pf_prefix
135
 
136
    set pf_prefix "${saved_prefix} default ABI, auto:"
137
    altivec_abi_tests "additional_flags=-maltivec" "auto"
138
 
139
    # On GNU/Linux, we can mix -mabi=no-altivec and -mabi=altivec.
140
    # So test some combinations.
141
    if { [istarget "powerpc*-linux*"] } {
142
        set binfile ${objdir}/${subdir}/${testfile}-ge-ge
143
        set pf_prefix "${saved_prefix} generic ABI, forced:"
144
        altivec_abi_tests "additional_flags=-maltivec additional_flags=-mabi=no-altivec" "generic"
145
 
146
        set binfile ${objdir}/${subdir}/${testfile}-av-av
147
        set pf_prefix "${saved_prefix} AltiVec ABI, forced:"
148
        altivec_abi_tests "additional_flags=-maltivec additional_flags=-mabi=altivec" "altivec"
149
 
150
        set binfile ${objdir}/${subdir}/${testfile}-av-auto
151
        set pf_prefix "${saved_prefix} AltiVec ABI, auto:"
152
        altivec_abi_tests "additional_flags=-maltivec additional_flags=-mabi=altivec" "auto"
153
    }
154
} elseif [test_compiler_info xlc*] {
155
    altivec_abi_tests "additional_flags=-qaltivec" "auto"
156
} else {
157
    warning "unknown compiler"
158
    return -1
159
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.