diff --git a/ChangeLog b/ChangeLog
index 9eafe63..9d094a1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2016-04-15  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
+
+	* sysdeps/unix/sysv/linux/Makefile [$(subdir) == nptl] (test): Remove
+	tst-getpid2.
+	* sysdeps/unix/sysv/linux/aarch64/clone.S (__clone): Do not change
+	pid/tid fields for CLONE_VM.
+	* sysdeps/unix/sysv/linux/arm/clone.S: Likewise.
+	* sysdeps/unix/sysv/linux/i386/clone.S: Likewise.
+	* sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S: Likewise.
+	* sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/clone.S: Likewise.
+	* sysdeps/unix/sysv/linux/tst-getpid2.c: Remove file.
+
 2016-04-15  Mike Frysinger  <vapier@gentoo.org>
 
 	* locale/iso-4217.def: Add SSP and change ZMK to ZMW.
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index 9999600..6d52b97 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -194,7 +194,7 @@ CFLAGS-gai.c += -DNEED_NETLINK
 endif
 
 ifeq ($(subdir),nptl)
-tests += tst-setgetname tst-align-clone tst-getpid1 tst-getpid2 \
+tests += tst-setgetname tst-align-clone tst-getpid1 \
 	tst-thread-affinity-pthread tst-thread-affinity-pthread2 \
 	tst-thread-affinity-sched
 endif
diff --git a/sysdeps/unix/sysv/linux/aarch64/clone.S b/sysdeps/unix/sysv/linux/aarch64/clone.S
index 8f3ab40..d95c990 100644
--- a/sysdeps/unix/sysv/linux/aarch64/clone.S
+++ b/sysdeps/unix/sysv/linux/aarch64/clone.S
@@ -72,9 +72,11 @@ thread_start:
 	cfi_undefined (x30)
 	mov	x29, 0
 
-	tbnz	x11, #CLONE_THREAD_BIT, 3f
-	mov	x0, #-1
-	tbnz	x11, #CLONE_VM_BIT, 2f
+	mov	x0, CLONE_VM
+	movk	x0, CLONE_THREAD>>16, lsl 16
+	tst	x0, x11
+	bne	3f
+
 	mov	x8, #SYS_ify(getpid)
 	svc	0x0
 2:
diff --git a/sysdeps/unix/sysv/linux/arm/clone.S b/sysdeps/unix/sysv/linux/arm/clone.S
index c103123..b3a875f 100644
--- a/sysdeps/unix/sysv/linux/arm/clone.S
+++ b/sysdeps/unix/sysv/linux/arm/clone.S
@@ -72,13 +72,12 @@ PSEUDO_END (__clone)
 	.cantunwind
 	tst	ip, #CLONE_THREAD
 	bne	3f
+	tst	ip, #CLONE_VM
+	bne	3f
 	GET_TLS (lr)
 	mov	r1, r0
-	tst	ip, #CLONE_VM
 	ldr	r7, =SYS_ify(getpid)
-	ite	ne
-	movne	r0, #-1
-	swieq	0x0
+	swi	0x0
 	NEGOFF_ADJ_BASE (r1, TID_OFFSET)
 	str	r0, NEGOFF_OFF1 (r1, TID_OFFSET)
 	str	r0, NEGOFF_OFF2 (r1, PID_OFFSET, TID_OFFSET)
diff --git a/sysdeps/unix/sysv/linux/i386/clone.S b/sysdeps/unix/sysv/linux/i386/clone.S
index ef447d1..64f0c9b 100644
--- a/sysdeps/unix/sysv/linux/i386/clone.S
+++ b/sysdeps/unix/sysv/linux/i386/clone.S
@@ -108,7 +108,7 @@ L(thread_start):
 	cfi_undefined (eip);
 	/* Note: %esi is zero.  */
 	movl	%esi,%ebp	/* terminate the stack frame */
-	testl	$CLONE_THREAD, %edi
+	testl	$(CLONE_THREAD | CLONE_VM), %edi
 	je	L(newpid)
 L(haspid):
 	call	*%ebx
@@ -124,9 +124,6 @@ L(here):
 
 	.subsection 2
 L(newpid):
-	testl	$CLONE_VM, %edi
-	movl	$-1, %eax
-	jne	L(nomoregetpid)
 	movl	$SYS_ify(getpid), %eax
 	ENTER_KERNEL
 L(nomoregetpid):
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S
index eb973db..ec82ed6 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S
@@ -76,11 +76,13 @@ ENTRY (__clone)
 	crandc	cr1*4+eq,cr1*4+eq,cr0*4+so
 	bne-	cr1,L(parent)		/* The '-' is to minimise the race.  */
 
-	andis.	r0,r28,CLONE_THREAD>>16
-	bne+	r0,L(oldpid)
-	andi.	r0,r28,CLONE_VM
-	li	r3,-1
-	bne-	r0,L(nomoregetpid)
+	/* If CLONE_THREAD of CLONE_VM does not update the pid/tid field.  */
+	lis	r0,CLONE_THREAD>>16
+	ori	r0,r0,CLONE_VM
+	and	r0,r0,r29
+	cmpwi	r0,0
+	bne+	cr0,L(oldpid)
+
 	DO_CALL(SYS_ify(getpid))
 L(nomoregetpid):
 	stw	r3,TID(r2)
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S
index 959fdb7..a8dfce6 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S
@@ -78,11 +78,13 @@ ENTRY (__clone)
 	crandc	cr1*4+eq,cr1*4+eq,cr0*4+so
 	bne-	cr1,L(parent)		/* The '-' is to minimise the race.  */
 
-	andis.	r0,r29,CLONE_THREAD>>16
+	/* If CLONE_THREAD of CLONE_VM does not update the pid/tid field.  */
+	lis	r0,CLONE_THREAD>>16
+	ori	r0,r0,CLONE_VM
+	and	r0,r0,r29
+	cmpwi	r0,0
 	bne+	cr0,L(oldpid)
-	andi.	r0,r29,CLONE_VM
-	li	r3,-1
-	bne-	cr0,L(nomoregetpid)
+
 	DO_CALL(SYS_ify(getpid))
 L(nomoregetpid):
 	stw	r3,TID(r13)
diff --git a/sysdeps/unix/sysv/linux/tst-getpid2.c b/sysdeps/unix/sysv/linux/tst-getpid2.c
deleted file mode 100644
index fc98cb6..0000000
--- a/sysdeps/unix/sysv/linux/tst-getpid2.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define TEST_CLONE_FLAGS CLONE_VM
-#include "tst-getpid1.c"
diff --git a/sysdeps/unix/sysv/linux/x86_64/clone.S b/sysdeps/unix/sysv/linux/x86_64/clone.S
index 1a50957..d33e35e 100644
--- a/sysdeps/unix/sysv/linux/x86_64/clone.S
+++ b/sysdeps/unix/sysv/linux/x86_64/clone.S
@@ -92,14 +92,11 @@ L(thread_start):
 	   the outermost frame obviously.  */
 	xorl	%ebp, %ebp
 
-	testq	$CLONE_THREAD, %rdi
+	andq	$(CLONE_THREAD | CLONE_VM), %rdi
 	jne	1f
-	testq	$CLONE_VM, %rdi
-	movl	$-1, %eax
-	jne	2f
 	movl	$SYS_ify(getpid), %eax
 	syscall
-2:	movl	%eax, %fs:PID
+	movl	%eax, %fs:PID
 	movl	%eax, %fs:TID
 1:
 
