diff --git a/valgrind-3.13.0-ppc64-check-no-vsx.patch b/valgrind-3.13.0-ppc64-check-no-vsx.patch
new file mode 100644
index 0000000..8a8fe9f
--- /dev/null
+++ b/valgrind-3.13.0-ppc64-check-no-vsx.patch
@@ -0,0 +1,87 @@
+commit 326d53c8378984c50f29bd124d3f2b4a1242306c
+Author: mjw <mjw@a5019735-40e9-0310-863c-91ae7b9d1cf9>
+Date:   Fri Jun 16 09:33:35 2017 +0000
+
+    ppc64 doesn't compile test_isa_2_06_partx.c without VSX support
+    
+    The #ifdef HAS_VSX guard is wrongly placed. It makes the standard
+    include headers not be used. Causing a build failure. Fix by moving
+    the #ifdef HAS_VSX after the standard includes.
+    
+    https://bugs.kde.org/show_bug.cgi?id=381272
+    
+    git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16450 a5019735-40e9-0310-863c-91ae7b9d1cf9
+
+diff --git a/none/tests/ppc32/test_isa_2_06_part1.c b/none/tests/ppc32/test_isa_2_06_part1.c
+index 7cd4930..7a14c6d 100644
+--- a/none/tests/ppc32/test_isa_2_06_part1.c
++++ b/none/tests/ppc32/test_isa_2_06_part1.c
+@@ -20,13 +20,14 @@
+  The GNU General Public License is contained in the file COPYING.
+  */
+ 
+-#ifdef HAS_VSX
+-
+ #include <stdio.h>
+ #include <stdint.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <malloc.h>
++
++#ifdef HAS_VSX
++
+ #include <altivec.h>
+ 
+ #ifndef __powerpc64__
+diff --git a/none/tests/ppc32/test_isa_2_06_part2.c b/none/tests/ppc32/test_isa_2_06_part2.c
+index c7bf4fe..2ee7b53 100644
+--- a/none/tests/ppc32/test_isa_2_06_part2.c
++++ b/none/tests/ppc32/test_isa_2_06_part2.c
+@@ -20,17 +20,18 @@
+  The GNU General Public License is contained in the file COPYING.
+  */
+ 
+-#ifdef HAS_VSX
+-
+ #include <stdio.h>
+ #include <stdint.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <malloc.h>
+-#include <altivec.h>
+ #include <math.h>
+ #include <unistd.h>    // getopt
+ 
++#ifdef HAS_VSX
++
++#include <altivec.h>
++
+ #ifndef __powerpc64__
+ typedef uint32_t HWord_t;
+ #else
+diff --git a/none/tests/ppc32/test_isa_2_06_part3.c b/none/tests/ppc32/test_isa_2_06_part3.c
+index 8c74c09..5ebc1a5 100644
+--- a/none/tests/ppc32/test_isa_2_06_part3.c
++++ b/none/tests/ppc32/test_isa_2_06_part3.c
+@@ -20,17 +20,18 @@
+  The GNU General Public License is contained in the file COPYING.
+  */
+ 
+-#ifdef HAS_VSX
+-
+ #include <stdio.h>
+ #include <stdint.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <malloc.h>
+-#include <altivec.h>
+ #include <math.h>
+ #include <unistd.h>    // getopt
+ 
++#ifdef HAS_VSX
++
++#include <altivec.h>
++
+ #ifndef __powerpc64__
+ typedef uint32_t HWord_t;
+ #else
diff --git a/valgrind.spec b/valgrind.spec
index ee9cb75..a2e8d5d 100644
--- a/valgrind.spec
+++ b/valgrind.spec
@@ -92,6 +92,9 @@ Patch2: valgrind-3.9.0-helgrind-race-supp.patch
 # Make ld.so supressions slightly less specific.
 Patch3: valgrind-3.9.0-ldso-supp.patch
 
+# KDE#381272  ppc64 doesn't compile test_isa_2_06_partx.c without VSX support
+Patch4: valgrind-3.13.0-ppc64-check-no-vsx.patch
+
 %if %{build_multilib}
 # Ensure glibc{,-devel} is installed for both multilib arches
 BuildRequires: /lib/libc.so.6 /usr/lib/libc.so /lib64/libc.so.6 /usr/lib64/libc.so
@@ -209,6 +212,7 @@ Valgrind User Manual for details.
 %patch1 -p1
 %patch2 -p1
 %patch3 -p1
+%patch4 -p1
 
 %build
 # We need to use the software collection compiler and binutils if available.
@@ -414,6 +418,7 @@ echo ===============END TESTING===============
 * Thu Jun 15 2017 Mark Wielaard <mjw@fedoraproject.org> - 3.13.0-1
 - valgrind 3.13.0 final.
 - Drop all upstreamed patches.
+- Add valgrind-3.13.0-ppc64-check-no-vsx.patch
 
 * Tue Jun  6 2017 Mark Wielaard <mjw@fedoraproject.org> - 3.13.0-0.2.RC1
 - Add valgrind-3.13.0-arm-dcache.patch