Automatic Copyright Year update after running gdb/copyright.py
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.arch / vsx-vsr-float28.exp
1 # Copyright (C) 2008-2022 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 <http://www.gnu.org/licenses/>.
15 #
16
17 #
18 # Test the vsr registers print values in float128 bit format.
19 #
20
21
22 if {![istarget "powerpc*"] || [skip_vsx_tests]} then {
23 verbose "Skipping vsr float128 field tests."
24 return
25 }
26
27 standard_testfile
28
29 set compile_flags {debug nowarnings quiet}
30 if [get_compiler_info] {
31 warning "get_compiler failed"
32 return -1
33 }
34
35 if [test_compiler_info gcc*] {
36 set compile_flags "$compile_flags additional_flags=-maltivec additional_flags=-mabi=altivec"
37 } elseif [test_compiler_info xlc*] {
38 set compile_flags "$compile_flags additional_flags=-qaltivec"
39 } else {
40 warning "unknown compiler"
41 return -1
42 }
43
44 if { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile} executable $compile_flags] != "" } {
45 untested "failed to compile"
46 return -1
47 }
48
49 gdb_start
50 gdb_reinitialize_dir $srcdir/$subdir
51 gdb_load ${binfile}
52
53 # Run to `main' where we begin our tests.
54
55 if ![runto_main] then {
56 fail "can't run to main"
57 return 0
58 }
59
60 set endianness [get_endianness]
61
62 # Data sets used throughout the test
63
64 set vector_field ".*float128 = -2.25,.*"
65
66 # The vsx registers now contain a 128-bit floating point field. The following tests
67 # setting a vsr register with a 128-bit floating point value and then printing the
68 # register contents using the float format to verify the value is correctly printed
69 # as a 128-bit value.
70
71 # the following corresponds to a 128-bit float value of -2.25
72 if {$endianness == "big"} {
73 gdb_test_no_output "set \$vs1.v4_int32\[3\] = 0x0"
74 gdb_test_no_output "set \$vs1.v4_int32\[2\] = 0x0"
75 gdb_test_no_output "set \$vs1.v4_int32\[1\] = 0x0"
76 gdb_test_no_output "set \$vs1.v4_int32\[0\] = 0xc0002000"
77 } else {
78 gdb_test_no_output "set \$vs1.v4_int32\[0\] = 0x0"
79 gdb_test_no_output "set \$vs1.v4_int32\[1\] = 0x0"
80 gdb_test_no_output "set \$vs1.v4_int32\[2\] = 0x0"
81 gdb_test_no_output "set \$vs1.v4_int32\[3\] = 0xc0002000"
82 }
83
84 # check the contents of the register
85 gdb_test "p/f \$vs1" "$vector_field"
86
87 gdb_exit
88
89
90
This page took 0.031583 seconds and 4 git commands to generate.