1 1.1 christos # Copyright (C) 2008-2023 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 christos 22 1.1 christos if {![istarget "powerpc*"] || [skip_vsx_tests]} { 23 1.1 christos verbose "Skipping vsr float128 field tests." 24 1.1 christos return 25 1.1 christos } 26 1.1 christos 27 1.1 christos standard_testfile 28 1.1 christos 29 1.1 christos set compile_flags {debug nowarnings quiet} 30 1.1 christos if [test_compiler_info gcc*] { 31 1.1 christos set compile_flags "$compile_flags additional_flags=-maltivec additional_flags=-mabi=altivec" 32 1.1 christos } elseif [test_compiler_info xlc*] { 33 1.1 christos set compile_flags "$compile_flags additional_flags=-qaltivec" 34 1.1 christos } else { 35 1.1 christos warning "unknown compiler" 36 1.1 christos return -1 37 1.1 christos } 38 1.1 christos 39 1.1 christos if { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile} executable $compile_flags] != "" } { 40 1.1 christos untested "failed to compile" 41 1.1 christos return -1 42 1.1 christos } 43 1.1 christos 44 1.1 christos gdb_start 45 1.1 christos gdb_reinitialize_dir $srcdir/$subdir 46 1.1 christos gdb_load ${binfile} 47 1.1 christos 48 1.1 christos # Run to `main' where we begin our tests. 49 1.1 christos 50 1.1 christos if {![runto_main]} { 51 1.1 christos return 0 52 1.1 christos } 53 1.1 christos 54 1.1 christos set endianness [get_endianness] 55 1.1 christos 56 1.1 christos # Data sets used throughout the test 57 1.1 christos 58 1.1 christos set vector_field ".*float128 = -2.25,.*" 59 1.1 christos 60 1.1 christos # The vsx registers now contain a 128-bit floating point field. The following tests 61 1.1 christos # setting a vsr register with a 128-bit floating point value and then printing the 62 1.1 christos # register contents using the float format to verify the value is correctly printed 63 1.1 christos # as a 128-bit value. 64 1.1 christos 65 1.1 christos # the following corresponds to a 128-bit float value of -2.25 66 1.1 christos if {$endianness == "big"} { 67 1.1 christos gdb_test_no_output "set \$vs1.v4_int32\[3\] = 0x0" 68 1.1 christos gdb_test_no_output "set \$vs1.v4_int32\[2\] = 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\[0\] = 0xc0002000" 71 1.1 christos } else { 72 1.1 christos gdb_test_no_output "set \$vs1.v4_int32\[0\] = 0x0" 73 1.1 christos gdb_test_no_output "set \$vs1.v4_int32\[1\] = 0x0" 74 1.1 christos gdb_test_no_output "set \$vs1.v4_int32\[2\] = 0x0" 75 1.1 christos gdb_test_no_output "set \$vs1.v4_int32\[3\] = 0xc0002000" 76 1.1 christos } 77 1.1 christos 78 1.1 christos # check the contents of the register 79 1.1 christos gdb_test "p/f \$vs1" "$vector_field" 80 1.1 christos 81 1.1 christos gdb_exit 82 1.1 christos 83 1.1 christos 84 1.1 christos 85