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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-6.8/] [gdb/] [testsuite/] [gdb.arch/] [altivec-abi.exp] - Blame information for rev 157

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 24 jeremybenn
# Copyright (C) 2002, 2003, 2005, 2007, 2008 Free Software Foundation, Inc.
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 3 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, see .
15
#
16
 
17
# Tests for Powerpc AltiVec ABI
18
 
19
 
20
if $tracelevel then {
21
    strace $tracelevel
22
}
23
 
24
#
25
# This file uses altivec-abi.c for input.
26
#
27
 
28
if {![istarget "powerpc*"] || [skip_altivec_tests]} then {
29
    verbose "Skipping altivec abi tests."
30
    verbose -log "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 powerpc vector-abi $force_abi"
77
 
78
    gdb_test "b marker" "Breakpoint 2 at.*file.*altivec-abi.c, line \[0-9\]+." "break marker"
79
    gdb_test "continue" "Breakpoint 2.*marker.*altivec-abi.c.*" "continue to marker"
80
    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)"
81
 
82
    # now all the arguments of vec_fun are initialized
83
 
84
    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.."
85
 
86
    set pattern1 $pattern
87
    append pattern1 " at.*altivec-abi.c.*vint_res  = vec_add.*vint_f, intv_on_stack_f.;"
88
 
89
    # Now let's call the function.  This function has > 12 args,
90
    # the last one will go on the stack.
91
    set msg "call inferior function with vectors (1)"
92
    gdb_test "p vec_func(vshort,vushort,vint,vuint,vchar,vuchar,vfloat,x,y,a,b,c,intv_on_stack)" \
93
        ".\[0-9\]+ = .2, 2, 2, 2." "call inferior function with vectors (1)"
94
 
95
    # Let's call the function again with dummy arguments.  This is to clean
96
    # up the contents of the vector registers before the next call.
97
    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)" \
98
        ".\[0-9\]+ = .0, 0, 0, 0." "call inferior function with vectors (2)"
99
 
100
    # Let's step into the function, to see if the args are printed correctly.
101
    gdb_test "step" \
102
        $pattern1 \
103
        "step into vec_fun"
104
 
105
    set pattern2 $pattern
106
    append pattern2 " at.*altivec-abi.c.*main.*result = vec_func .vshort,.*goes in v2.*Value returned is.*= .2, 2, 2, 2."
107
 
108
    # Let's see if the result is returned correctly.
109
    gdb_test "finish" "Run till exit from .0.*$pattern2" \
110
        "vector value returned correctly"
111
 
112
    # can we print the args correctly for this function?
113
    gdb_test "break struct_of_vector_func" "" ""
114
 
115
    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.*"
116
 
117
    gdb_test "continue" \
118
        "Breakpoint 3, $pattern.*vector_struct.vshort1 = vec_add .vector_struct.vshort1, vector_struct.vshort2.;" \
119
        "continue to struct_of_vector_func"
120
 
121
    gdb_test "finish" \
122
        "Run till exit from .0  $pattern\[ \r\n\]+main.*altivec-abi.c.*array_of_vector_func.*" \
123
        "back to main (2)"
124
 
125
    gdb_test "step" "" "step into array_of_vector_func"
126
    gdb_test "p matrix\[0\]" ".*= .1, 2, 3, 4, 5, 6, 7, 8." "print first vector"
127
    gdb_test "p matrix\[1\]" ".*= .11, 12, 13, 14, 15, 16, 17, 18." "print second vector"
128
    gdb_test "p matrix\[2\]" ".*= .21, 22, 23, 24, 25, 26, 27, 28." "print third vector"
129
    gdb_test "p matrix\[3\]" ".*= .31, 32, 33, 34, 35, 36, 37, 38." "print fourth vector"
130
}
131
 
132
if [test_compiler_info gcc*] {
133
    set saved_prefix $pf_prefix
134
 
135
    set pf_prefix "${saved_prefix} default ABI, auto:"
136
    altivec_abi_tests "additional_flags=-maltivec" "auto"
137
 
138
    # On GNU/Linux, we can mix -mabi=no-altivec and -mabi=altivec.
139
    # So test some combinations.
140
    if { [istarget "powerpc*-linux*"] } {
141
        set binfile ${objdir}/${subdir}/${testfile}-ge-ge
142
        set pf_prefix "${saved_prefix} generic ABI, forced:"
143
        altivec_abi_tests "additional_flags=-maltivec additional_flags=-mabi=no-altivec" "generic"
144
 
145
        set binfile ${objdir}/${subdir}/${testfile}-av-av
146
        set pf_prefix "${saved_prefix} AltiVec ABI, forced:"
147
        altivec_abi_tests "additional_flags=-maltivec additional_flags=-mabi=altivec" "altivec"
148
 
149
        set binfile ${objdir}/${subdir}/${testfile}-av-auto
150
        set pf_prefix "${saved_prefix} AltiVec ABI, auto:"
151
        altivec_abi_tests "additional_flags=-maltivec additional_flags=-mabi=altivec" "auto"
152
    }
153
} elseif [test_compiler_info xlc*] {
154
    altivec_abi_tests "additional_flags=-qaltivec" "auto"
155
} else {
156
    warning "unknown compiler"
157
    return -1
158
}

powered by: WebSVN 2.1.0

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