1 1.1.1.2 christos # Copyright (C) 2008-2024 Free Software Foundation, Inc. 2 1.1 christos # 3 1.1 christos # This program is free software; you can redistribute it and/or modify 4 1.1 christos # it under the terms of the GNU General Public License as published by 5 1.1 christos # the Free Software Foundation; either version 3 of the License, or 6 1.1 christos # (at your option) any later version. 7 1.1 christos # 8 1.1 christos # This program is distributed in the hope that it will be useful, 9 1.1 christos # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 1.1 christos # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 1.1 christos # GNU General Public License for more details. 12 1.1 christos # 13 1.1 christos # You should have received a copy of the GNU General Public License 14 1.1 christos # along with this program. If not, see <http://www.gnu.org/licenses/>. 15 1.1 christos # 16 1.1 christos 17 1.1 christos # 18 1.1 christos # Test the vsr registers print values in float128 bit format. 19 1.1 christos # 20 1.1 christos 21 1.1.1.2 christos require {istarget "powerpc*"} allow_vsx_tests 22 1.1 christos 23 1.1 christos standard_testfile 24 1.1 christos 25 1.1 christos set compile_flags {debug nowarnings quiet} 26 1.1 christos if [test_compiler_info gcc*] { 27 1.1 christos set compile_flags "$compile_flags additional_flags=-maltivec additional_flags=-mabi=altivec" 28 1.1 christos } elseif [test_compiler_info xlc*] { 29 1.1 christos set compile_flags "$compile_flags additional_flags=-qaltivec" 30 1.1 christos } else { 31 1.1 christos warning "unknown compiler" 32 1.1 christos return -1 33 1.1 christos } 34 1.1 christos 35 1.1 christos if { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile} executable $compile_flags] != "" } { 36 1.1 christos untested "failed to compile" 37 1.1 christos return -1 38 1.1 christos } 39 1.1 christos 40 1.1 christos gdb_start 41 1.1 christos gdb_reinitialize_dir $srcdir/$subdir 42 1.1 christos gdb_load ${binfile} 43 1.1 christos 44 1.1 christos # Run to `main' where we begin our tests. 45 1.1 christos 46 1.1 christos if {![runto_main]} { 47 1.1 christos return 0 48 1.1 christos } 49 1.1 christos 50 1.1 christos set endianness [get_endianness] 51 1.1 christos 52 1.1 christos # Data sets used throughout the test 53 1.1 christos 54 1.1 christos set vector_field ".*float128 = -2.25,.*" 55 1.1 christos 56 1.1 christos # The vsx registers now contain a 128-bit floating point field. The following tests 57 1.1 christos # setting a vsr register with a 128-bit floating point value and then printing the 58 1.1 christos # register contents using the float format to verify the value is correctly printed 59 1.1 christos # as a 128-bit value. 60 1.1 christos 61 1.1 christos # the following corresponds to a 128-bit float value of -2.25 62 1.1 christos if {$endianness == "big"} { 63 1.1 christos gdb_test_no_output "set \$vs1.v4_int32\[3\] = 0x0" 64 1.1 christos gdb_test_no_output "set \$vs1.v4_int32\[2\] = 0x0" 65 1.1 christos gdb_test_no_output "set \$vs1.v4_int32\[1\] = 0x0" 66 1.1 christos gdb_test_no_output "set \$vs1.v4_int32\[0\] = 0xc0002000" 67 1.1 christos } else { 68 1.1 christos gdb_test_no_output "set \$vs1.v4_int32\[0\] = 0x0" 69 1.1 christos gdb_test_no_output "set \$vs1.v4_int32\[1\] = 0x0" 70 1.1 christos gdb_test_no_output "set \$vs1.v4_int32\[2\] = 0x0" 71 1.1 christos gdb_test_no_output "set \$vs1.v4_int32\[3\] = 0xc0002000" 72 1.1 christos } 73 1.1 christos 74 1.1 christos # check the contents of the register 75 1.1 christos gdb_test "p/f \$vs1" "$vector_field" 76 1.1 christos 77 1.1 christos gdb_exit 78 1.1 christos 79 1.1 christos 80 1.1 christos 81