During code review, an inconsistency was noticed in some
of the prototypes defined for the vec_ldl built-in function.
In particular, the vector fetched from an address declare
to be long long * was returned as "vector int". In
addressing this problem, certain other inconsistencies
and omissions were discovered. This patch tidies up
the implementation of this function. A separate patch
is in preparation to address the documentation for this
and all other PowerPC built-in functions.
In summary, this patch removes two prototypes:
vector int vec_ldl (int, long int *)
vector unsigned int vec_ldl (int, unsigned long int *)
and adds eight:
vector bool char vec_ldl (int, bool char *)
vector bool short vec_ldl (int, bool short *)
vector bool int vec_ldl (int, bool int *)
vector bool long long vec_ldl (int, bool long long *)
vector pixel vec_ldl (int, pixel *)
vector long long vec_ldl (int, long long *)
vector unsigned long long vec_ldl (int, unsigned long long *)
This patch has been bootstrapped and tested without
regressions on both powerpc64le-unknown-linux (P8)
and on powerpc-linux (P7 big-endian, with both -m32
and -m64 target options).
Is this ok for trunk?
gcc/ChangeLog:
2018-03-29 Kelvin Nilsen
* config/rs6000/rs6000-c.c (altivec_overloaded_builtins): Remove
erroneous entries for
"vector int vec_ldl (int, long int *)", and
"vector unsigned int vec_ldl (int, unsigned long int *)".
Add comments and entries for
"vector bool char vec_ldl (int, bool char *)",
"vector bool short vec_ldl (int, bool short *)",
"vector bool int vec_ldl (int, bool int *)",
"vector bool long long vec_ldl (int, bool long long *)",
"vector pixel vec_ldl (int, pixel *)",
"vector long long vec_ldl (int, long long *)",
"vector unsigned long long vec_ldl (int, unsigned long long *)".
* config/rs6000/rs6000.c (rs6000_init_builtins): Initialize new
type tree bool_long_long_type_node and correct definition of
bool_V2DI_type_node to make reference to this new type tree.
(rs6000_mangle_type): Replace erroneous reference to
bool_long_type_node with bool_long_long_type_node.
* config/rs6000/rs6000.h (enum rs6000_builtin_type_index): Add
comments to emphasize sign distinctions for char and int types and
replace RS6000_BTI_bool_long constant with
RS6000_BTI_bool_long_long constant.
(bool_long_type_node): Remove this macro definition.
(bool_long_long_type_node): New macro definition
gcc/testsuite/ChangeLog:
2018-03-29 Kelvin Nilsen
* gcc.target/powerpc/vec-ldl-1.c: New test.
* gcc.dg/vmx/ops-long-1.c: Correct test programs to reflect
corrections to ABI implementation.
Index: gcc/config/rs6000/rs6000.c
===
--- gcc/config/rs6000/rs6000.c (revision 258800)
+++ gcc/config/rs6000/rs6000.c (working copy)
@@ -16947,7 +16947,7 @@ rs6000_init_builtins (void)
bool_char_type_node = build_distinct_type_copy
(unsigned_intQI_type_node);
bool_short_type_node = build_distinct_type_copy
(unsigned_intHI_type_node);
bool_int_type_node = build_distinct_type_copy
(unsigned_intSI_type_node);
- bool_long_type_node = build_distinct_type_copy
(unsigned_intDI_type_node);
+ bool_long_long_type_node = build_distinct_type_copy
(unsigned_intDI_type_node);
pixel_type_node = build_distinct_type_copy (unsigned_intHI_type_node);
long_integer_type_internal_node = long_integer_type_node;
@@ -17064,7 +17064,7 @@ rs6000_init_builtins (void)
bool_V2DI_type_node = rs6000_vector_type (TARGET_POWERPC64
? "__vector __bool long"
: "__vector __bool long long",
- bool_long_type_node, 2);
+ bool_long_long_type_node, 2);
pixel_V8HI_type_node = rs6000_vector_type ("__vector __pixel",
pixel_type_node, 8);
@@ -32855,7 +32855,7 @@ rs6000_mangle_type (const_tree type)
if (type == bool_short_type_node) return "U6__bools";
if (type == pixel_type_node) return "u7__pixel";
if (type == bool_int_type_node) return "U6__booli";
- if (type == bool_long_type_node) return "U6__booll";
+ if (type == bool_long_long_type_node) return "U6__booll";
/* Use a unique name for __float128 rather than trying to use "e" or
"g". Use
"g" for IBM extended double, no matter whether it is long double
(using
Index: gcc/config/rs6000/rs6000.h
===
--- gcc/config/rs6000/rs6000.h (revision 258800)
+++ gcc/config/rs6000/rs6000.h (working copy)
@@ -2578,7 +2578,7 @@ enum rs6000_builtin_type_index
RS6000_BTI_opaque_V2SF,
RS6000_BTI_opaque_p_V2SI,
RS6000_BTI_opaque_V4SI,
- RS6000_BTI_V16QI,
+ RS6000_BTI_V16QI, /* __vector signed char */
RS6000_BTI_V1TI,
RS6000_BTI_V2SI,
RS6000_BTI_V2SF,
@@ -2588,7 +2588,7 @@ enum rs6000_builtin_type_index
RS6000_BTI_