kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [kvm-unit-tests PATCH] s390x: Use loop to save and restore fprs
@ 2019-11-04  8:55 Janosch Frank
  2019-11-04 10:00 ` David Hildenbrand
  2019-11-08  9:15 ` Thomas Huth
  0 siblings, 2 replies; 4+ messages in thread
From: Janosch Frank @ 2019-11-04  8:55 UTC (permalink / raw)
  To: kvm; +Cc: linux-s390, thuth, david, pmorel

Let's save some lines in the assembly by using a loop to save and
restore the fprs.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
---
 s390x/cstart64.S | 38 ++++++--------------------------------
 1 file changed, 6 insertions(+), 32 deletions(-)

diff --git a/s390x/cstart64.S b/s390x/cstart64.S
index 5dc1577..8e2b21e 100644
--- a/s390x/cstart64.S
+++ b/s390x/cstart64.S
@@ -99,44 +99,18 @@ memsetxc:
 	lctlg	%c0, %c0, 0(%r1)
 	/* save fprs 0-15 + fpc */
 	la	%r1, GEN_LC_SW_INT_FPRS
-	std	%f0, 0(%r1)
-	std	%f1, 8(%r1)
-	std	%f2, 16(%r1)
-	std	%f3, 24(%r1)
-	std	%f4, 32(%r1)
-	std	%f5, 40(%r1)
-	std	%f6, 48(%r1)
-	std	%f7, 56(%r1)
-	std	%f8, 64(%r1)
-	std	%f9, 72(%r1)
-	std	%f10, 80(%r1)
-	std	%f11, 88(%r1)
-	std	%f12, 96(%r1)
-	std	%f13, 104(%r1)
-	std	%f14, 112(%r1)
-	std	%f15, 120(%r1)
+	.irp i, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
+	std	\i, \i * 8(%r1)
+	.endr
 	stfpc	GEN_LC_SW_INT_FPC
 	.endm
 
 	.macro RESTORE_REGS
 	/* restore fprs 0-15 + fpc */
 	la	%r1, GEN_LC_SW_INT_FPRS
-	ld	%f0, 0(%r1)
-	ld	%f1, 8(%r1)
-	ld	%f2, 16(%r1)
-	ld	%f3, 24(%r1)
-	ld	%f4, 32(%r1)
-	ld	%f5, 40(%r1)
-	ld	%f6, 48(%r1)
-	ld	%f7, 56(%r1)
-	ld	%f8, 64(%r1)
-	ld	%f9, 72(%r1)
-	ld	%f10, 80(%r1)
-	ld	%f11, 88(%r1)
-	ld	%f12, 96(%r1)
-	ld	%f13, 104(%r1)
-	ld	%f14, 112(%r1)
-	ld	%f15, 120(%r1)
+	.irp i, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
+	ld	\i, \i * 8(%r1)
+	.endr
 	lfpc	GEN_LC_SW_INT_FPC
 	/* restore cr0 */
 	lctlg	%c0, %c0, GEN_LC_SW_INT_CR0
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [kvm-unit-tests PATCH] s390x: Use loop to save and restore fprs
  2019-11-04  8:55 [kvm-unit-tests PATCH] s390x: Use loop to save and restore fprs Janosch Frank
@ 2019-11-04 10:00 ` David Hildenbrand
  2019-11-08  9:15 ` Thomas Huth
  1 sibling, 0 replies; 4+ messages in thread
From: David Hildenbrand @ 2019-11-04 10:00 UTC (permalink / raw)
  To: Janosch Frank, kvm; +Cc: linux-s390, thuth, pmorel

On 04.11.19 09:55, Janosch Frank wrote:
> Let's save some lines in the assembly by using a loop to save and
> restore the fprs.
> 
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
> ---
>   s390x/cstart64.S | 38 ++++++--------------------------------
>   1 file changed, 6 insertions(+), 32 deletions(-)
> 
> diff --git a/s390x/cstart64.S b/s390x/cstart64.S
> index 5dc1577..8e2b21e 100644
> --- a/s390x/cstart64.S
> +++ b/s390x/cstart64.S
> @@ -99,44 +99,18 @@ memsetxc:
>   	lctlg	%c0, %c0, 0(%r1)
>   	/* save fprs 0-15 + fpc */
>   	la	%r1, GEN_LC_SW_INT_FPRS
> -	std	%f0, 0(%r1)
> -	std	%f1, 8(%r1)
> -	std	%f2, 16(%r1)
> -	std	%f3, 24(%r1)
> -	std	%f4, 32(%r1)
> -	std	%f5, 40(%r1)
> -	std	%f6, 48(%r1)
> -	std	%f7, 56(%r1)
> -	std	%f8, 64(%r1)
> -	std	%f9, 72(%r1)
> -	std	%f10, 80(%r1)
> -	std	%f11, 88(%r1)
> -	std	%f12, 96(%r1)
> -	std	%f13, 104(%r1)
> -	std	%f14, 112(%r1)
> -	std	%f15, 120(%r1)
> +	.irp i, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
> +	std	\i, \i * 8(%r1)
> +	.endr
>   	stfpc	GEN_LC_SW_INT_FPC
>   	.endm
>   
>   	.macro RESTORE_REGS
>   	/* restore fprs 0-15 + fpc */
>   	la	%r1, GEN_LC_SW_INT_FPRS
> -	ld	%f0, 0(%r1)
> -	ld	%f1, 8(%r1)
> -	ld	%f2, 16(%r1)
> -	ld	%f3, 24(%r1)
> -	ld	%f4, 32(%r1)
> -	ld	%f5, 40(%r1)
> -	ld	%f6, 48(%r1)
> -	ld	%f7, 56(%r1)
> -	ld	%f8, 64(%r1)
> -	ld	%f9, 72(%r1)
> -	ld	%f10, 80(%r1)
> -	ld	%f11, 88(%r1)
> -	ld	%f12, 96(%r1)
> -	ld	%f13, 104(%r1)
> -	ld	%f14, 112(%r1)
> -	ld	%f15, 120(%r1)
> +	.irp i, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
> +	ld	\i, \i * 8(%r1)
> +	.endr
>   	lfpc	GEN_LC_SW_INT_FPC
>   	/* restore cr0 */
>   	lctlg	%c0, %c0, GEN_LC_SW_INT_CR0
> 

Looks good to me!

Queued to

https://github.com/davidhildenbrand/kvm-unit-tests.git s390x-next

For now, but waiting for more review.

-- 

Thanks,

David / dhildenb


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [kvm-unit-tests PATCH] s390x: Use loop to save and restore fprs
  2019-11-04  8:55 [kvm-unit-tests PATCH] s390x: Use loop to save and restore fprs Janosch Frank
  2019-11-04 10:00 ` David Hildenbrand
@ 2019-11-08  9:15 ` Thomas Huth
  2019-11-11 13:34   ` Pierre Morel
  1 sibling, 1 reply; 4+ messages in thread
From: Thomas Huth @ 2019-11-08  9:15 UTC (permalink / raw)
  To: Janosch Frank, kvm; +Cc: linux-s390, david, pmorel

On 04/11/2019 09.55, Janosch Frank wrote:
> Let's save some lines in the assembly by using a loop to save and
> restore the fprs.
> 
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
> ---
>   s390x/cstart64.S | 38 ++++++--------------------------------
>   1 file changed, 6 insertions(+), 32 deletions(-)
> 
> diff --git a/s390x/cstart64.S b/s390x/cstart64.S
> index 5dc1577..8e2b21e 100644
> --- a/s390x/cstart64.S
> +++ b/s390x/cstart64.S
> @@ -99,44 +99,18 @@ memsetxc:
>   	lctlg	%c0, %c0, 0(%r1)
>   	/* save fprs 0-15 + fpc */
>   	la	%r1, GEN_LC_SW_INT_FPRS
> -	std	%f0, 0(%r1)
> -	std	%f1, 8(%r1)
> -	std	%f2, 16(%r1)
> -	std	%f3, 24(%r1)
> -	std	%f4, 32(%r1)
> -	std	%f5, 40(%r1)
> -	std	%f6, 48(%r1)
> -	std	%f7, 56(%r1)
> -	std	%f8, 64(%r1)
> -	std	%f9, 72(%r1)
> -	std	%f10, 80(%r1)
> -	std	%f11, 88(%r1)
> -	std	%f12, 96(%r1)
> -	std	%f13, 104(%r1)
> -	std	%f14, 112(%r1)
> -	std	%f15, 120(%r1)
> +	.irp i, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
> +	std	\i, \i * 8(%r1)
> +	.endr
>   	stfpc	GEN_LC_SW_INT_FPC
>   	.endm
>   
>   	.macro RESTORE_REGS
>   	/* restore fprs 0-15 + fpc */
>   	la	%r1, GEN_LC_SW_INT_FPRS
> -	ld	%f0, 0(%r1)
> -	ld	%f1, 8(%r1)
> -	ld	%f2, 16(%r1)
> -	ld	%f3, 24(%r1)
> -	ld	%f4, 32(%r1)
> -	ld	%f5, 40(%r1)
> -	ld	%f6, 48(%r1)
> -	ld	%f7, 56(%r1)
> -	ld	%f8, 64(%r1)
> -	ld	%f9, 72(%r1)
> -	ld	%f10, 80(%r1)
> -	ld	%f11, 88(%r1)
> -	ld	%f12, 96(%r1)
> -	ld	%f13, 104(%r1)
> -	ld	%f14, 112(%r1)
> -	ld	%f15, 120(%r1)
> +	.irp i, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
> +	ld	\i, \i * 8(%r1)
> +	.endr
>   	lfpc	GEN_LC_SW_INT_FPC
>   	/* restore cr0 */
>   	lctlg	%c0, %c0, GEN_LC_SW_INT_CR0
> 

Produces exactly the same code as before.

Tested-by: Thomas Huth <thuth@redhat.com>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [kvm-unit-tests PATCH] s390x: Use loop to save and restore fprs
  2019-11-08  9:15 ` Thomas Huth
@ 2019-11-11 13:34   ` Pierre Morel
  0 siblings, 0 replies; 4+ messages in thread
From: Pierre Morel @ 2019-11-11 13:34 UTC (permalink / raw)
  To: Thomas Huth, Janosch Frank, kvm; +Cc: linux-s390, david


On 11/8/19 10:15 AM, Thomas Huth wrote:
> On 04/11/2019 09.55, Janosch Frank wrote:
>> Let's save some lines in the assembly by using a loop to save and
>> restore the fprs.
>>
>> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
>> ---
>>   s390x/cstart64.S | 38 ++++++--------------------------------
>>   1 file changed, 6 insertions(+), 32 deletions(-)
>>
>> diff --git a/s390x/cstart64.S b/s390x/cstart64.S
>> index 5dc1577..8e2b21e 100644
>> --- a/s390x/cstart64.S
>> +++ b/s390x/cstart64.S
>> @@ -99,44 +99,18 @@ memsetxc:
>>       lctlg    %c0, %c0, 0(%r1)
>>       /* save fprs 0-15 + fpc */
>>       la    %r1, GEN_LC_SW_INT_FPRS
>> -    std    %f0, 0(%r1)
>> -    std    %f1, 8(%r1)
>> -    std    %f2, 16(%r1)
>> -    std    %f3, 24(%r1)
>> -    std    %f4, 32(%r1)
>> -    std    %f5, 40(%r1)
>> -    std    %f6, 48(%r1)
>> -    std    %f7, 56(%r1)
>> -    std    %f8, 64(%r1)
>> -    std    %f9, 72(%r1)
>> -    std    %f10, 80(%r1)
>> -    std    %f11, 88(%r1)
>> -    std    %f12, 96(%r1)
>> -    std    %f13, 104(%r1)
>> -    std    %f14, 112(%r1)
>> -    std    %f15, 120(%r1)
>> +    .irp i, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
>> +    std    \i, \i * 8(%r1)
>> +    .endr
>>       stfpc    GEN_LC_SW_INT_FPC
>>       .endm
>>         .macro RESTORE_REGS
>>       /* restore fprs 0-15 + fpc */
>>       la    %r1, GEN_LC_SW_INT_FPRS
>> -    ld    %f0, 0(%r1)
>> -    ld    %f1, 8(%r1)
>> -    ld    %f2, 16(%r1)
>> -    ld    %f3, 24(%r1)
>> -    ld    %f4, 32(%r1)
>> -    ld    %f5, 40(%r1)
>> -    ld    %f6, 48(%r1)
>> -    ld    %f7, 56(%r1)
>> -    ld    %f8, 64(%r1)
>> -    ld    %f9, 72(%r1)
>> -    ld    %f10, 80(%r1)
>> -    ld    %f11, 88(%r1)
>> -    ld    %f12, 96(%r1)
>> -    ld    %f13, 104(%r1)
>> -    ld    %f14, 112(%r1)
>> -    ld    %f15, 120(%r1)
>> +    .irp i, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
>> +    ld    \i, \i * 8(%r1)
>> +    .endr
>>       lfpc    GEN_LC_SW_INT_FPC
>>       /* restore cr0 */
>>       lctlg    %c0, %c0, GEN_LC_SW_INT_CR0
>>
>
> Produces exactly the same code as before.
>
> Tested-by: Thomas Huth <thuth@redhat.com>
>
Good for me, makes the code smaller ... is better

Reviewed-by: Pierre Morel <pmorel@linux.ibm.com>



-- 
Pierre Morel
IBM Lab Boeblingen


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-11-11 13:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-04  8:55 [kvm-unit-tests PATCH] s390x: Use loop to save and restore fprs Janosch Frank
2019-11-04 10:00 ` David Hildenbrand
2019-11-08  9:15 ` Thomas Huth
2019-11-11 13:34   ` Pierre Morel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).