aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.arch/vsx-vsr-float28.exp
blob: b5b2d5844031a88325e83ed41f6becf14b0de9a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# Copyright (C) 2008-2022 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

#
# Test the vsr registers print values in float128 bit format.
#


if {![istarget "powerpc*"] || [skip_vsx_tests]} then {
    verbose "Skipping vsr float128 field tests."
    return
}

standard_testfile

set compile_flags {debug nowarnings quiet}
if [test_compiler_info gcc*] {
    set compile_flags "$compile_flags additional_flags=-maltivec additional_flags=-mabi=altivec"
} elseif [test_compiler_info xlc*] {
    set compile_flags "$compile_flags additional_flags=-qaltivec"
} else {
    warning "unknown compiler"
    return -1
}

if  { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile} executable $compile_flags] != "" } {
     untested "failed to compile"
     return -1
}

gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}

# Run to `main' where we begin our tests.

if ![runto_main] then {
    return 0
}

set endianness [get_endianness]

# Data sets used throughout the test

set vector_field ".*float128 = -2.25,.*"

# The vsx registers now contain a 128-bit floating point field.  The following tests
# setting a vsr register with a 128-bit floating point value and then printing the
# register contents using the float format to verify the value is correctly printed
# as a 128-bit value.

# the following corresponds to a 128-bit float value of -2.25
if {$endianness == "big"} {
    gdb_test_no_output "set \$vs1.v4_int32\[3\] = 0x0"
    gdb_test_no_output "set \$vs1.v4_int32\[2\] = 0x0"
    gdb_test_no_output "set \$vs1.v4_int32\[1\] = 0x0"
    gdb_test_no_output "set \$vs1.v4_int32\[0\] = 0xc0002000"
} else {
    gdb_test_no_output "set \$vs1.v4_int32\[0\] = 0x0"
    gdb_test_no_output "set \$vs1.v4_int32\[1\] = 0x0"
    gdb_test_no_output "set \$vs1.v4_int32\[2\] = 0x0"
    gdb_test_no_output "set \$vs1.v4_int32\[3\] = 0xc0002000"
}

# check the contents of the register
gdb_test "p/f \$vs1" "$vector_field"

gdb_exit