Index: gcc/config/rs6000/rs6000-c.c
===================================================================
--- gcc/config/rs6000/rs6000-c.c	(revision 261341)
+++ gcc/config/rs6000/rs6000-c.c	(working copy)
@@ -2425,7 +2425,7 @@ const struct altivec_builtin_types altivec_overloa
     RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
   { ALTIVEC_BUILTIN_VEC_PACK, P8V_BUILTIN_VPKUDUM,
     RS6000_BTI_bool_V4SI, RS6000_BTI_bool_V2DI, RS6000_BTI_bool_V2DI, 0 },
-  { ALTIVEC_BUILTIN_VEC_PACK, P8V_BUILTIN_VPKUDUM,
+  { ALTIVEC_BUILTIN_VEC_PACK, P8V_BUILTIN_FLOAT2_V2DF,
     RS6000_BTI_V4SF, RS6000_BTI_V2DF, RS6000_BTI_V2DF, 0 },
 
   { P8V_BUILTIN_VEC_NEG, P8V_BUILTIN_NEG_V16QI,
Index: gcc/testsuite/gcc.target/powerpc/builtins-3-p8.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/builtins-3-p8.c	(revision 261341)
+++ gcc/testsuite/gcc.target/powerpc/builtins-3-p8.c	(working copy)
@@ -11,12 +11,6 @@ test_eq_long_long (vector bool long long x, vector
 	return vec_cmpeq (x, y);
 }
 
-vector float
-test_pack_float (vector double x, vector double y)
-{
-  return vec_pack (x, y);
-}
-
 vector unsigned char
 test_vsi_packs_vusi_vusi (vector unsigned short x,
                           vector unsigned short y)
@@ -214,7 +208,6 @@ test_neg_double (vector double x)
 /* Expected test results:
 
      test_eq_long_long                         1 vcmpequd inst
-     test_pack_float                           1 vpkudum inst
      test_vsi_packs_vsll_vsll                  1 vpksdss
      test_vui_packs_vull_vull                  1 vpkudus
      test_vui_packs_vssi_vssi                  1 vpkshss
@@ -239,7 +232,6 @@ test_neg_double (vector double x)
  */
 
 /* { dg-final { scan-assembler-times "vcmpequd" 1 } } */
-/* { dg-final { scan-assembler-times "vpkudum"  1 } } */
 /* { dg-final { scan-assembler-times "vpksdss"  1 } } */
 /* { dg-final { scan-assembler-times "vpkudus"  1 } } */  
 /* { dg-final { scan-assembler-times "vpkuhus"  2 } } */
Index: gcc/testsuite/gcc.target/powerpc/builtins-9-p8-be.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/builtins-9-p8-be.c	(nonexistent)
+++ gcc/testsuite/gcc.target/powerpc/builtins-9-p8-be.c	(working copy)
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_p8vector_ok } */
+/* { dg-require-effective-target be } */ /* Require big-endian.  */
+/* { dg-options "-O3 -maltivec -mcpu=power8" } */
+/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */
+
+#include <altivec.h>
+
+vector float
+test_pack_float (vector double x, vector double y)
+{
+  return vec_pack (x, y);
+}
+
+/* { dg-final { scan-assembler-times "vmrgew"  1 } } */
+/* { dg-final { scan-assembler-times "xvcvdpsp"  2 } } */
+/* { dg-final { scan-assembler-times "xxpermdi"  2 } } */
+
Index: gcc/testsuite/gcc.target/powerpc/builtins-9-p8-le.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/builtins-9-p8-le.c	(nonexistent)
+++ gcc/testsuite/gcc.target/powerpc/builtins-9-p8-le.c	(working copy)
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_p8vector_ok } */
+/* { dg-require-effective-target le } */ /* Require little-endian.  */
+/* { dg-options "-O3 -maltivec -mcpu=power8" } */
+/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */
+
+#include <altivec.h>
+
+vector float
+test_pack_float (vector double x, vector double y)
+{
+  return vec_pack (x, y);
+}
+
+/* { dg-final { scan-assembler-times "vmrgow"  1 } } */
+/* { dg-final { scan-assembler-times "xvcvdpsp"  2 } } */
+/* { dg-final { scan-assembler-times "xxpermdi"  2 } } */
+
Index: gcc/testsuite/gcc.target/powerpc/builtins-9-p9-le.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/builtins-9-p9-le.c	(nonexistent)
+++ gcc/testsuite/gcc.target/powerpc/builtins-9-p9-le.c	(working copy)
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_p9vector_ok } */
+/* { dg-require-effective-target le } */ /* Require little-endian.  */
+/* { dg-options "-O3 -maltivec -mcpu=power9" } */
+/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */
+
+#include <altivec.h>
+
+vector float
+test_pack_float (vector double x, vector double y)
+{
+  return vec_pack (x, y);
+}
+
+/* { dg-final { scan-assembler-times "vmrgow"  1 } } */
+/* { dg-final { scan-assembler-times "xvcvdpsp"  2 } } */
+/* { dg-final { scan-assembler-times "xxpermdi"  2 } } */
+
Index: gcc/testsuite/gcc.target/powerpc/fold-vec-pack-double-p8-be.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/fold-vec-pack-double-p8-be.c	(nonexistent)
+++ gcc/testsuite/gcc.target/powerpc/fold-vec-pack-double-p8-be.c	(working copy)
@@ -0,0 +1,20 @@
+/* Verify that overloaded built-ins for vec_pack with
+   double inputs produce the right results.  */
+
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_p8vector_ok } */
+/* { dg-require-effective-target be } */ /* Require big-endian.  */
+/* { dg-options "-mvsx -mcpu=power8 -O2" } */
+/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */
+
+#include <altivec.h>
+
+// vector float vec_pack (vector double, vector double);
+
+vector float
+test_pack (vector double vd2, vector double vd3)
+{
+  return vec_pack (vd2, vd3);
+}
+
+/* { dg-final { scan-assembler-times "vmrgew" 1 } } */
Index: gcc/testsuite/gcc.target/powerpc/fold-vec-pack-double-p8-le.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/fold-vec-pack-double-p8-le.c	(nonexistent)
+++ gcc/testsuite/gcc.target/powerpc/fold-vec-pack-double-p8-le.c	(working copy)
@@ -0,0 +1,20 @@
+/* Verify that overloaded built-ins for vec_pack with
+   double inputs produce the right results.  */
+
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_p8vector_ok } */
+/* { dg-require-effective-target le } */ /* Require little-endian.  */
+/* { dg-options "-mvsx -mcpu=power8r -O2" } */
+/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */
+
+#include <altivec.h>
+
+// vector float vec_pack (vector double, vector double);
+
+vector float
+test_pack (vector double vd2, vector double vd3)
+{
+  return vec_pack (vd2, vd3);
+}
+
+/* { dg-final { scan-assembler-times "vmrgow"  1 } } */
Index: gcc/testsuite/gcc.target/powerpc/fold-vec-pack-double.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/fold-vec-pack-double.c	(revision 261341)
+++ gcc/testsuite/gcc.target/powerpc/fold-vec-pack-double.c	(working copy)
@@ -2,8 +2,10 @@
    double inputs produce the right results.  */
 
 /* { dg-do compile } */
-/* { dg-require-effective-target powerpc_p8vector_ok } */
-/* { dg-options "-mvsx -mpower8-vector -O2" } */
+/* { dg-require-effective-target powerpc_p9vector_ok } */
+/* { dg-require-effective-target le } */ /* Require little-endian.  */
+/* { dg-options "-mvsx -mcpu=power9 -O2" } */
+/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */
 
 #include <altivec.h>
 
@@ -15,4 +17,4 @@ test_pack (vector double vd2, vector double vd3)
   return vec_pack (vd2, vd3);
 }
 
-/* { dg-final { scan-assembler-times "vpkudum" 1 } } */
+/* { dg-final { scan-assembler-times "vmrgow" 1 } } */
