diff mbox series

[rs6000] Tidy implementation of vec_ldl

Message ID 4c2f94d7-f1fe-078e-d5cf-6f106caebaba@linux.vnet.ibm.com
State New
Headers show
Series [rs6000] Tidy implementation of vec_ldl | expand

Commit Message

Kelvin Nilsen March 29, 2018, 2:47 p.m. UTC
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 <kelvin@gcc.gnu.org>

     * 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 <kelvin@gcc.gnu.org>

     * 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.

+  return 0;
+}

Comments

Segher Boessenkool March 30, 2018, 10:52 p.m. UTC | #1
Hi!

On Thu, Mar 29, 2018 at 09:47:42AM -0500, Kelvin Nilsen wrote:
> 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 *)

Is "pixel" a type?  "vector pixel" is, but plain "pixel"?

>   vector long long vec_ldl (int, long long *)
>   vector unsigned long long vec_ldl (int, unsigned long long *)

>     * 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 *)".

Whitespace is weird.  I'll just assume this is how you pasted it into
the mail and it will be correct in the changelog you commit.

> @@ -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";

The mangled name now still says it is "bool long", not "bool long long".
Can you do this?  At the very least it needs a comment.

> --- gcc/config/rs6000/rs6000-c.c    (revision 258800)
> +++ gcc/config/rs6000/rs6000-c.c    (working copy)
> @@ -1656,29 +1656,50 @@ const struct altivec_builtin_types altivec_overloa
>      RS6000_BTI_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_INTQI, 0 },
>    { ALTIVEC_BUILTIN_VEC_LVEBX, ALTIVEC_BUILTIN_LVEBX,
>      RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTQI, 0 
> },
> +
> +  /*     vector float vec_ldl (int, vector float *);
> +   *     vector float vec_ldl (int, float *); */

No leading * on comment continuation lines.

> --- gcc/testsuite/gcc.target/powerpc/vec-ldl-1.c (nonexistent)
> +++ gcc/testsuite/gcc.target/powerpc/vec-ldl-1.c    (revision 258889)
> @@ -0,0 +1,214 @@
> +/* { dg-do run { target powerpc*-*-* } } */
> +/* { dg-require-effective-target vmx_hw } */
> +/* { dg-require-effective-target lp64 } */
> +/* { dg-options "-maltivec -O0 -Wall" } */

Does this need lp64?  Same question for the other tests.


Segher
diff mbox series

Patch

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_V4SI,
    RS6000_BTI_V4SF,
    RS6000_BTI_V8HI,
-  RS6000_BTI_unsigned_V16QI,
+  RS6000_BTI_unsigned_V16QI,     /* __vector unsigned char */
    RS6000_BTI_unsigned_V1TI,
    RS6000_BTI_unsigned_V8HI,
    RS6000_BTI_unsigned_V4SI,
@@ -2596,7 +2596,7 @@  enum rs6000_builtin_type_index
    RS6000_BTI_bool_char,          /* __bool char */
    RS6000_BTI_bool_short,         /* __bool short */
    RS6000_BTI_bool_int,           /* __bool int */
-  RS6000_BTI_bool_long,         /* __bool long */
+  RS6000_BTI_bool_long_long,     /* __bool long long */
    RS6000_BTI_pixel,              /* __pixel */
    RS6000_BTI_bool_V16QI,         /* __vector __bool char */
    RS6000_BTI_bool_V8HI,          /* __vector __bool short */
@@ -2607,11 +2607,11 @@  enum rs6000_builtin_type_index
    RS6000_BTI_unsigned_long,      /* long_unsigned_type_node */
    RS6000_BTI_long_long,             /* long_long_integer_type_node */
    RS6000_BTI_unsigned_long_long, /* long_long_unsigned_type_node */
-  RS6000_BTI_INTQI,             /* intQI_type_node */
+  RS6000_BTI_INTQI,             /* (signed) intQI_type_node */
    RS6000_BTI_UINTQI,         /* unsigned_intQI_type_node */
    RS6000_BTI_INTHI,             /* intHI_type_node */
    RS6000_BTI_UINTHI,         /* unsigned_intHI_type_node */
-  RS6000_BTI_INTSI,         /* intSI_type_node */
+  RS6000_BTI_INTSI,         /* intSI_type_node (signed) */
    RS6000_BTI_UINTSI,         /* unsigned_intSI_type_node */
    RS6000_BTI_INTDI,         /* intDI_type_node */
    RS6000_BTI_UINTDI,         /* unsigned_intDI_type_node */
@@ -2652,7 +2652,7 @@  enum rs6000_builtin_type_index
  #define bool_char_type_node (rs6000_builtin_types[RS6000_BTI_bool_char])
  #define bool_short_type_node 
(rs6000_builtin_types[RS6000_BTI_bool_short])
  #define bool_int_type_node (rs6000_builtin_types[RS6000_BTI_bool_int])
-#define bool_long_type_node (rs6000_builtin_types[RS6000_BTI_bool_long])
+#define bool_long_long_type_node 
(rs6000_builtin_types[RS6000_BTI_bool_long_long])
  #define pixel_type_node (rs6000_builtin_types[RS6000_BTI_pixel])
  #define bool_V16QI_type_node 
(rs6000_builtin_types[RS6000_BTI_bool_V16QI])
  #define bool_V8HI_type_node (rs6000_builtin_types[RS6000_BTI_bool_V8HI])
Index: gcc/config/rs6000/rs6000-c.c
===================================================================
--- gcc/config/rs6000/rs6000-c.c    (revision 258800)
+++ gcc/config/rs6000/rs6000-c.c    (working copy)
@@ -1656,29 +1656,50 @@  const struct altivec_builtin_types altivec_overloa
      RS6000_BTI_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_INTQI, 0 },
    { ALTIVEC_BUILTIN_VEC_LVEBX, ALTIVEC_BUILTIN_LVEBX,
      RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTQI, 0 },
+
+  /*     vector float vec_ldl (int, vector float *);
+   *     vector float vec_ldl (int, float *); */
    { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V4SF,
      RS6000_BTI_V4SF, RS6000_BTI_INTSI, ~RS6000_BTI_V4SF, 0 },
    { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V4SF,
      RS6000_BTI_V4SF, RS6000_BTI_INTSI, ~RS6000_BTI_float, 0 },
+
+  /*     vector bool int vec_ldl (int, vector bool int *);
+   *     vector bool int vec_ldl (int, bool int *);
+   *          vector int vec_ldl (int, vector int *);
+   *          vector int vec_ldl (int, int *);
+   * vector unsigned int vec_ldl (int, vector unsigned int *);
+   * vector unsigned int vec_ldl (int, unsigned int *); */
    { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V4SI,
      RS6000_BTI_bool_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V4SI, 0 },
    { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V4SI,
+    RS6000_BTI_bool_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_int, 0 },
+  { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V4SI,
      RS6000_BTI_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_V4SI, 0 },
    { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V4SI,
      RS6000_BTI_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_INTSI, 0 },
    { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V4SI,
-    RS6000_BTI_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_long, 0 },
-  { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V4SI,
      RS6000_BTI_unsigned_V4SI, RS6000_BTI_INTSI, 
~RS6000_BTI_unsigned_V4SI, 0 },
    { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V4SI,
      RS6000_BTI_unsigned_V4SI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTSI, 0 },
-  { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V4SI,
-    RS6000_BTI_unsigned_V4SI, RS6000_BTI_INTSI, 
~RS6000_BTI_unsigned_long, 0 },
+
+  /*     vector bool short vec_ldl (int, vector bool short *);
+   *     vector bool short vec_ldl (int, bool short *);
+   *          vector pixel vec_ldl (int, vector pixel *);
+   *          vector pixel vec_ldl (int, pixel *);
+   *          vector short vec_ldl (int, vector short *);
+   *          vector short vec_ldl (int, short *);
+   * vector unsigned short vec_ldl (int, vector unsigned short *);
+   * vector unsigned short vec_ldl (int, unsigned short *); */
    { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V8HI,
      RS6000_BTI_bool_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V8HI, 0 },
    { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V8HI,
+    RS6000_BTI_bool_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_short, 0 },
+  { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V8HI,
      RS6000_BTI_pixel_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_pixel_V8HI, 0 },
    { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V8HI,
+    RS6000_BTI_pixel_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_pixel, 0 },
+  { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V8HI,
      RS6000_BTI_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_V8HI, 0 },
    { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V8HI,
      RS6000_BTI_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_INTHI, 0 },
@@ -1686,9 +1707,18 @@  const struct altivec_builtin_types altivec_overloa
      RS6000_BTI_unsigned_V8HI, RS6000_BTI_INTSI, 
~RS6000_BTI_unsigned_V8HI, 0 },
    { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V8HI,
      RS6000_BTI_unsigned_V8HI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTHI, 0 },
+
+  /*     vector bool char vec_ldl (int, vector bool char *);
+   *     vector bool char vec_ldl (int, bool char *);
+   *          vector char vec_ldl (int, vector char *);
+   *          vector char vec_ldl (int, char *);
+   * vector unsigned char vec_ldl (int, vector unsigned char *);
+   * vector unsigned char vec_ldl (int, unsigned char *); */
    { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V16QI,
      RS6000_BTI_bool_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V16QI, 0 },
    { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V16QI,
+    RS6000_BTI_bool_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_char, 0 },
+  { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V16QI,
      RS6000_BTI_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_V16QI, 0 },
    { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V16QI,
      RS6000_BTI_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_INTQI, 0 },
@@ -1697,15 +1727,35 @@  const struct altivec_builtin_types altivec_overloa
      ~RS6000_BTI_unsigned_V16QI, 0 },
    { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V16QI,
      RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTQI, 0 },
+
+  /*     vector double vec_ldl (int, vector double *);
+   *     vector double vec_ldl (int, double *); */
    { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V2DF,
      RS6000_BTI_V2DF, RS6000_BTI_INTSI, ~RS6000_BTI_V2DF, 0 },
+  { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V2DF,
+    RS6000_BTI_V2DF, RS6000_BTI_INTSI, ~RS6000_BTI_double, 0 },
+
+  /*          vector long long vec_ldl (int, vector long long *);
+   *          vector long long vec_ldl (int, long long *);
+   * vector unsigned long long vec_ldl (int, vector unsigned long long *);
+   * vector unsigned long long vec_ldl (int, unsigned long long *);
+   *     vector bool long long vec_ldl (int, vector bool long long *);
+   *     vector bool long long vec_ldl (int, bool long long *); */
    { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V2DI,
      RS6000_BTI_V2DI, RS6000_BTI_INTSI, ~RS6000_BTI_V2DI, 0 },
    { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V2DI,
+    RS6000_BTI_V2DI, RS6000_BTI_INTSI, ~RS6000_BTI_long_long, 0 },
+  { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V2DI,
      RS6000_BTI_unsigned_V2DI, RS6000_BTI_INTSI,
      ~RS6000_BTI_unsigned_V2DI, 0 },
    { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V2DI,
+    RS6000_BTI_unsigned_V2DI, RS6000_BTI_INTSI,
+    ~RS6000_BTI_unsigned_long_long, 0 },
+  { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V2DI,
      RS6000_BTI_bool_V2DI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_V2DI, 0 },
+  { ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V2DI,
+    RS6000_BTI_bool_V2DI, RS6000_BTI_INTSI, ~RS6000_BTI_bool_long_long, 
0 },
+
    { ALTIVEC_BUILTIN_VEC_LVSL, ALTIVEC_BUILTIN_LVSL,
      RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTQI, 0 },
    { ALTIVEC_BUILTIN_VEC_LVSL, ALTIVEC_BUILTIN_LVSL,
Index: gcc/testsuite/gcc.dg/vmx/ops-long-1.c
===================================================================
--- gcc/testsuite/gcc.dg/vmx/ops-long-1.c    (revision 258800)
+++ gcc/testsuite/gcc.dg/vmx/ops-long-1.c    (working copy)
@@ -1,5 +1,6 @@ 
  /* { dg-do compile } */
-/* { dg-options "-maltivec -mabi=altivec -std=gnu99 -mno-vsx 
-Wno-deprecated" } */
+/* { dg-require-effective-target vmx_hw } */
+/* { dg-options "-maltivec -mabi=altivec -std=gnu99 -mvsx 
-Wno-deprecated" } */

  /* Checks from the original ops.c that pass pointers to long or
     unsigned long for operations that support that in released versions
@@ -10,6 +11,8 @@ 
  extern int *var_int;
  extern long * *var_long_ptr;
  extern unsigned long * *var_unsigned_long_ptr;
+extern long long int * *var_long_long_ptr;
+extern unsigned long long int * *var_unsigned_long_long_ptr;
  extern vector signed int * *var_vec_s32_ptr;
  extern vector signed int *var_vec_s32;
  extern vector unsigned char * *var_vec_u8_ptr;
@@ -16,22 +19,25 @@  extern vector unsigned char * *var_vec_u8_ptr;
  extern vector unsigned char *var_vec_u8;
  extern vector unsigned int * *var_vec_u32_ptr;
  extern vector unsigned int *var_vec_u32;
+/* Use of long long int types requires -mvsx command-line option. */
+extern vector long long int *var_vec_s64;
+extern vector unsigned long long int *var_vec_u64;

  void f13() {
    *var_vec_s32++ = vec_ld(var_int[0], var_long_ptr[1]);
    *var_vec_s32++ = vec_lde(var_int[0], var_long_ptr[1]);
-  *var_vec_s32++ = vec_ldl(var_int[0], var_long_ptr[1]);
+  *var_vec_s64++ = vec_ldl(var_int[0], var_long_long_ptr[1]);
    *var_vec_s32++ = vec_lvewx(var_int[0], var_long_ptr[1]);
    *var_vec_s32++ = vec_lvx(var_int[0], var_long_ptr[1]);
-  *var_vec_s32++ = vec_lvxl(var_int[0], var_long_ptr[1]);
+  *var_vec_s64++ = vec_lvxl(var_int[0], var_long_long_ptr[1]);
  }
  void f22() {
    *var_vec_u32++ = vec_ld(var_int[0], var_unsigned_long_ptr[1]);
    *var_vec_u32++ = vec_lde(var_int[0], var_unsigned_long_ptr[1]);
-  *var_vec_u32++ = vec_ldl(var_int[0], var_unsigned_long_ptr[1]);
+  *var_vec_u64++ = vec_ldl(var_int[0], var_unsigned_long_long_ptr[1]);
    *var_vec_u32++ = vec_lvewx(var_int[0], var_unsigned_long_ptr[1]);
    *var_vec_u32++ = vec_lvx(var_int[0], var_unsigned_long_ptr[1]);
-  *var_vec_u32++ = vec_lvxl(var_int[0], var_unsigned_long_ptr[1]);
+  *var_vec_u64++ = vec_lvxl(var_int[0], var_unsigned_long_long_ptr[1]);
  }
  void f25() {
    *var_vec_u8++ = vec_lvsl(var_int[0], var_long_ptr[1]);
Index: gcc/testsuite/gcc.target/powerpc/vec-ldl-1.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/vec-ldl-1.c (nonexistent)
+++ gcc/testsuite/gcc.target/powerpc/vec-ldl-1.c    (revision 258889)
@@ -0,0 +1,214 @@ 
+/* { dg-do run { target powerpc*-*-* } } */
+/* { dg-require-effective-target vmx_hw } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-options "-maltivec -O0 -Wall" } */
+
+#include <altivec.h>
+#include <stdlib.h>
+
+/* vec_ldl and vec_lvxl (an alias for vec_ldl) do an aligned vector
+ * load from memory, marking the fetched memory as least recently used
+ * (hinting that we do not anticipate a need to fetch this vector
+ * again within the near future.)
+ *
+ * vector <TYPE> result = vec_ldl (int offset, <TYPE> *address)
+ * vector <TYPE> result = vec_ldl (int offset, vector <TYPE> *address)
+ *
+ * The effect of these instructions is to perform the following:
+ *
+ *  resuilt = *((vector <TTYPE> *)((((char *) address) + offset) & ~0x0f))
+ *
+ * This test exercises the following new prototypes of the vec_ldl
+ * service which were added in late March 2018:
+ *
+ *  vector bool int vec_ldl (int, bool int *)
+ *  vector bool short vec_ldl (int, bool short *)
+ *  vector pixel vec_ldl (int, pixel *)
+ *  vector bool char vec_ldl (int, bool char *)
+ *  vector double vec_ldl (int, double *)
+ *  vector long long int vec_ldl (int, long long int *)
+ *  vector unsigned long long int vec_ldl (int, unsigned long long int *)
+ *  vector bool long long vec_ldl (int, bool long long *)
+ */
+
+static signed char ca[64] __attribute__((aligned(16)));
+static unsigned char uca[64] __attribute__((aligned(16)));
+
+static vector signed char *vcp = (vector signed char *) ca;
+static unsigned vector char *vucp = (vector unsigned char *) uca;
+
+static short sa[32] __attribute__((aligned(16)));
+static unsigned short usa[32] __attribute__((aligned(16)));
+
+static vector short *vsp = (vector short *) sa;
+static unsigned vector short *vusp = (vector unsigned short *) usa;
+
+static int ia[16] __attribute__((aligned(16)));
+static unsigned int uia[16] __attribute__((aligned(16)));
+
+static vector int *vip = (vector int *) ia;
+static unsigned vector int *vuip = (vector unsigned int *) uia;
+
+static long long la[8] __attribute__((aligned(16)));
+static unsigned long long ula[8] __attribute__((aligned(16)));
+
+static vector long long *vlp = (vector long long *) la;
+static unsigned vector long long *vulp = (vector unsigned long long *) 
ula;
+
+static double da[8] __attribute__((aligned(16)));
+
+static vector double *vdp = (vector double *) da;
+
+
+void
+doInitialization ()
+{
+  unsigned int i;
+
+  for (i = 0; i < 64; i++)
+    ca[i] = uca[i] = i;
+
+  for (i = 0; i < 32; i++)
+    sa[i] = usa[i] = i;
+
+  for (i = 0; i < 16; i++)
+    ia[i] = uia[i] = i;
+
+  for (i = 0; i < 8; i++)
+    la[i] = ula[i] = i;
+
+  for (i = 0; i < 8; i++)
+    da[i] = 0.125 * i;
+}
+
+int
+main (int argc, char *argv[])
+{
+  vector long long int lv;
+  vector unsigned long long int ulv;
+  vector int iv;
+  vector unsigned int uiv;
+  vector short sv;
+  vector unsigned short usv;
+  vector signed char cv;
+  vector unsigned char ucv;
+  vector double dv;
+
+  doInitialization ();
+
+  /* Do vector of char.  */
+  for (int i = 0; i < 16; i++) {
+    /* Focus on ca[16] ... ca[31].  */
+    cv = vec_ldl (i+16, ca);    /* compiler: invalid parameter 
combination */
+    if (cv[4] != ca[20])
+      abort ();
+    /* Focus on uca[32] ... uca[47].  */
+    ucv = vec_ldl (i+32, uca);
+    if (ucv[7] != uca[39])
+      abort ();
+    /* Focus on ca[0] ... ca[15].  */
+    cv = vec_ldl (i, vcp);
+    if (cv[3] != ca[3])
+      abort ();
+    /* Focus on ca[0] ... ca[15] while i <= 8.
+       Focus on ca[16] ... ca[31] while i > 8.  */
+    ucv = vec_ldl (i+7, vucp);
+    if ((i+7 > 15) && (ucv[13] != uca[29]))
+      abort ();
+    if ((i + 7 <= 15) && (ucv[13] != uca[13]))
+      abort ();
+  }
+
+  /* Do vector of short.  */
+  for (int i = 0; i < 16; i++) {
+    /* Focus on sa[8] ... sa[15].  */
+    sv = vec_ldl (i+16, sa);
+    if (sv[4] != sa[12])
+      abort ();
+    /* Focus on usa[24] ... usa[31].  */
+    usv = vec_ldl (i+48, usa);
+    if (usv[7] != usa[31])
+      abort ();
+    /* Focus on sa[0] ... sa[7].  */
+    sv = vec_ldl (i, vsp);
+    if (sv[3] != sa[3])
+      abort ();
+    /* Focus on usa[0] ... ca[7] while i <= 8.
+       Focus on usa[8] ... ca[15] while i > .  */
+    usv = vec_ldl (i+7, vusp);
+    if ((i+7 > 15) && (usv[5] != usa[13]))
+      abort ();
+    if ((i + 7 <= 15) && (usv[5] != usa[5]))
+      abort ();
+  }
+
+  /* Do vector of int.  */
+  for (int i = 0; i < 16; i++) {
+    /* Focus on ia[8] ... ia[11].  */
+    iv = vec_ldl (i+32, ia);
+    if (iv[3] != ia[11])
+      abort ();
+    /* Focus on uia[12] ... uia[15].  */
+    uiv = vec_ldl (i+48, uia);
+    if (uiv[2] != uia[14])
+      abort ();
+    /* Focus on ia[0] ... ia[3].  */
+    iv = vec_ldl (i, vip);
+    if (iv[3] != ia[3])
+      abort ();
+    /* Focus on uia[0] ... uia[3] while i <= 8.
+       Focus on uia[4] ... uia[7] while i > 8.  */
+    uiv = vec_ldl (i+7, vuip);
+    if ((i+7 > 15) && (uiv[1] != uia[5]))
+      abort ();
+    if ((i + 7 <= 15) && (uiv[1] != uia[1]))
+      abort ();
+  }
+
+  /* Do vector of long long int.  */
+  for (int i = 0; i < 16; i++) {
+    /* Focus on la[4] ... la[5].  */
+    lv = vec_ldl (i+32, la);
+    if (lv[1] != la[5])
+      abort ();
+    /* Focus on ula[6] ... ula[7].  */
+    ulv = vec_ldl (i+48, ula);
+    if (ulv[0] != uia[6])
+      abort ();
+    /* Focus on la[0] ... la[1].  */
+    lv = vec_ldl (i, vlp);
+    if (iv[1] != la[1])
+      abort ();
+    /* Focus on ula[0] ... uia[1] while i <= 8.
+       Focus on uia[2] ... uia[3] while i > 8.  */
+    ulv = vec_ldl (i+7, vulp);
+    if ((i+7 > 15) && (ulv[1] != ula[3]))
+      abort ();
+    if ((i + 7 <= 15) && (ulv[1] != ula[1]))
+      abort ();
+  }
+
+  /* Do vector of double.  */
+  for (int i = 0; i < 16; i++) {
+    /* Focus on da[2] ... da[3].  */
+    dv = vec_ldl (i+16, da);
+    if (dv[1] != da[3])
+      abort ();
+    /* Focus on da[6] ... da[7].  */
+    dv = vec_ldl (i+48, vdp);
+    if (dv[0] != da[6])
+      abort ();
+    /* Focus on da[0] ... da[1].  */
+    dv = vec_ldl (i, da);
+    if (dv[1] != da[1])
+      abort ();
+    /* Focus on da[0] ... da[1] while i <= 8.
+       Focus on da[2] ... da[3] while i > 8.  */
+    dv = vec_ldl (i+7, vdp);
+    if ((i+7 <= 15) && (dv[1] != da[1]))
+      abort ();
+    if ((i + 7 > 15) && (dv[1] != da[3]))
+      abort ();
+  }