blob: 0eaddce5e4a86ec67a60a27348930d1986ef4c50 [file] [log] [blame]
# Copyright (C) 2008-2021 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 [get_compiler_info] {
warning "get_compiler failed"
return -1
}
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