/* The type we're building is this
type = union __ppc_builtin_type_vec128 {
+ float128_t float128;
uint128_t uint128;
double v2_double[2];
float v4_float[4];
}
*/
+ /* PPC specific type for IEEE 128-bit float field */
+ struct type *t_float128
+ = arch_float_type (gdbarch, 128, "float128_t", floatformats_ia64_quad);
+
struct type *t;
t = arch_composite_type (gdbarch,
"__ppc_builtin_type_vec128", TYPE_CODE_UNION);
+ append_composite_type_field (t, "float128", t_float128);
append_composite_type_field (t, "uint128", bt->builtin_uint128);
append_composite_type_field (t, "v2_double",
init_vector_type (bt->builtin_double, 2));
--- /dev/null
+/* This file is part of GDB, the GNU debugger.
+
+ Copyright 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/>. */
+
+#include <altivec.h>
+#include <stdio.h>
+
+int
+main ()
+{
+ __float128 x, y, z;
+
+ x = -2.25;
+ y = 3.5;
+ z = x * y;
+
+ return 0;
+}
--- /dev/null
+# 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 {
+ fail "can't run to main"
+ 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
+
+
+