diff mbox

[2/4] S390: Use 64bit instruction to check for copies of > 1MB with mvcle.

Message ID 1461672469-2107-2-git-send-email-stli@linux.vnet.ibm.com
State Committed
Headers show

Commit Message

Stefan Liebler April 26, 2016, 12:07 p.m. UTC
The __memcpy_default variant on s390 64bit calculates the number of
256byte blocks in a 64bit register and checks, if they exceed 1MB
to jump to mvcle. Otherwise a mvc-loop is used. The compare-instruction
only checks a 32bit value.
This patch uses a 64bit compare.

ChangeLog:

	* sysdeps/s390/s390-64/memcpy.S (memcpy):
	Use cghi instead of chi to compare 64bit value.
---
 sysdeps/s390/s390-64/memcpy.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Florian Weimer April 26, 2016, 2:16 p.m. UTC | #1
On 04/26/2016 02:07 PM, Stefan Liebler wrote:
> The __memcpy_default variant on s390 64bit calculates the number of
> 256byte blocks in a 64bit register and checks, if they exceed 1MB
> to jump to mvcle. Otherwise a mvc-loop is used. The compare-instruction
> only checks a 32bit value.
> This patch uses a 64bit compare.

This is purely an optimization, right?  Did the previous implementation 
still perform a complete copy (although perhaps in a less efficient way)?

Thanks,
Florian
Stefan Liebler April 26, 2016, 2:20 p.m. UTC | #2
On 04/26/2016 04:16 PM, Florian Weimer wrote:
> On 04/26/2016 02:07 PM, Stefan Liebler wrote:
>> The __memcpy_default variant on s390 64bit calculates the number of
>> 256byte blocks in a 64bit register and checks, if they exceed 1MB
>> to jump to mvcle. Otherwise a mvc-loop is used. The compare-instruction
>> only checks a 32bit value.
>> This patch uses a 64bit compare.
>
> This is purely an optimization, right?  Did the previous implementation
> still perform a complete copy (although perhaps in a less efficient way)?
>
> Thanks,
> Florian
>
>
Yes it performs a complete copy with mcv-loop instead of mvcle.
diff mbox

Patch

diff --git a/sysdeps/s390/s390-64/memcpy.S b/sysdeps/s390/s390-64/memcpy.S
index e84a357..9d60a14 100644
--- a/sysdeps/s390/s390-64/memcpy.S
+++ b/sysdeps/s390/s390-64/memcpy.S
@@ -47,7 +47,7 @@  ENTRY(memcpy)
 .L_Z900_4:
 	br      %r14
 .L_Z900_13:
-	chi	%r5,4096             # Switch to mvcle for copies >1MB
+	cghi	%r5,4096            # Switch to mvcle for copies >1MB
 	jh      __memcpy_mvcle
 .L_Z900_12:
 	mvc     0(256,%r1),0(%r3)