diff mbox series

[FFmpeg-devel,v3,1/4] avutil/mips: Use MMI_{L, S}QC1 macro in {SAVE, RECOVER}_REG

Message ID 20210723055344.21961-2-jiaxun.yang@flygoat.com
State New
Headers show
Series avcodec Loongson-2 MMI fixes
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Jiaxun Yang July 23, 2021, 5:53 a.m. UTC
{SAVE,RECOVER}_REG will be available for Loongson2 again,
also comment about the magic.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Reviewed-by: Shiyou Yin <yinshiyou-hf@loongson.cn>
---
 libavutil/mips/mmiutils.h | 32 +++++++++++++++++---------------
 1 file changed, 17 insertions(+), 15 deletions(-)

Comments

殷时友 July 28, 2021, 1:44 a.m. UTC | #1
> 2021年7月23日 下午1:53,Jiaxun Yang <jiaxun.yang@flygoat.com> 写道:
> 
> {SAVE,RECOVER}_REG will be available for Loongson2 again,
> also comment about the magic.
> 
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> Reviewed-by: Shiyou Yin <yinshiyou-hf@loongson.cn>
> ---
> libavutil/mips/mmiutils.h | 32 +++++++++++++++++---------------
> 1 file changed, 17 insertions(+), 15 deletions(-)
> 
> diff --git a/libavutil/mips/mmiutils.h b/libavutil/mips/mmiutils.h
> index 6a82caa908..41715c6490 100644
> --- a/libavutil/mips/mmiutils.h
> +++ b/libavutil/mips/mmiutils.h
> @@ -204,25 +204,27 @@
> #endif /* HAVE_LOONGSON2 */
> 
> /**
> - * backup register
> + * Backup saved registers
> + * We're not using compiler's clobber list as it's not smart enough
> + * to take advantage of quad word load/store.
>  */
> #define BACKUP_REG \
>   LOCAL_ALIGNED_16(double, temp_backup_reg, [8]);               \
>   if (_MIPS_SIM == _ABI64)                                      \
>     __asm__ volatile (                                          \
> -      "gssqc1       $f25,      $f24,       0x00(%[temp])  \n\t" \
> -      "gssqc1       $f27,      $f26,       0x10(%[temp])  \n\t" \
> -      "gssqc1       $f29,      $f28,       0x20(%[temp])  \n\t" \
> -      "gssqc1       $f31,      $f30,       0x30(%[temp])  \n\t" \
> +      MMI_SQC1($f25, $f24, %[temp], 0x00)                       \
> +      MMI_SQC1($f27, $f26, %[temp], 0x10)                       \
> +      MMI_SQC1($f29, $f28, %[temp], 0x20)                       \
> +      MMI_SQC1($f31, $f30, %[temp], 0x30)                       \
>       :                                                         \
>       : [temp]"r"(temp_backup_reg)                              \
>       : "memory"                                                \
>     );                                                          \
>   else                                                          \
>     __asm__ volatile (                                          \
> -      "gssqc1       $f22,      $f20,       0x00(%[temp])  \n\t" \
> -      "gssqc1       $f26,      $f24,       0x10(%[temp])  \n\t" \
> -      "gssqc1       $f30,      $f28,       0x20(%[temp])  \n\t" \
> +      MMI_SQC1($f22, $f20, %[temp], 0x10)                       \
> +      MMI_SQC1($f26, $f24, %[temp], 0x10)                       \
> +      MMI_SQC1($f30, $f28, %[temp], 0x20)                       \
>       :                                                         \
>       : [temp]"r"(temp_backup_reg)                              \
>       : "memory"                                                \
> @@ -234,19 +236,19 @@
> #define RECOVER_REG \
>   if (_MIPS_SIM == _ABI64)                                      \
>     __asm__ volatile (                                          \
> -      "gslqc1       $f25,      $f24,       0x00(%[temp])  \n\t" \
> -      "gslqc1       $f27,      $f26,       0x10(%[temp])  \n\t" \
> -      "gslqc1       $f29,      $f28,       0x20(%[temp])  \n\t" \
> -      "gslqc1       $f31,      $f30,       0x30(%[temp])  \n\t" \
> +      MMI_LQC1($f25, $f24, %[temp], 0x00)                       \
> +      MMI_LQC1($f27, $f26, %[temp], 0x10)                       \
> +      MMI_LQC1($f29, $f28, %[temp], 0x20)                       \
> +      MMI_LQC1($f31, $f30, %[temp], 0x30)                       \
>       :                                                         \
>       : [temp]"r"(temp_backup_reg)                              \
>       : "memory"                                                \
>     );                                                          \
>   else                                                          \
>     __asm__ volatile (                                          \
> -      "gslqc1       $f22,      $f20,       0x00(%[temp])  \n\t" \
> -      "gslqc1       $f26,      $f24,       0x10(%[temp])  \n\t" \
> -      "gslqc1       $f30,      $f28,       0x20(%[temp])  \n\t" \
> +      MMI_LQC1($f22, $f20, %[temp], 0x10)                       \
> +      MMI_LQC1($f26, $f24, %[temp], 0x10)                       \
> +      MMI_LQC1($f30, $f28, %[temp], 0x20)                       \
>       :                                                         \
>       : [temp]"r"(temp_backup_reg)                              \
>       : "memory"                                                \
> -- 
> 2.32.0

LGTM
diff mbox series

Patch

diff --git a/libavutil/mips/mmiutils.h b/libavutil/mips/mmiutils.h
index 6a82caa908..41715c6490 100644
--- a/libavutil/mips/mmiutils.h
+++ b/libavutil/mips/mmiutils.h
@@ -204,25 +204,27 @@ 
 #endif /* HAVE_LOONGSON2 */
 
 /**
- * backup register
+ * Backup saved registers
+ * We're not using compiler's clobber list as it's not smart enough
+ * to take advantage of quad word load/store.
  */
 #define BACKUP_REG \
   LOCAL_ALIGNED_16(double, temp_backup_reg, [8]);               \
   if (_MIPS_SIM == _ABI64)                                      \
     __asm__ volatile (                                          \
-      "gssqc1       $f25,      $f24,       0x00(%[temp])  \n\t" \
-      "gssqc1       $f27,      $f26,       0x10(%[temp])  \n\t" \
-      "gssqc1       $f29,      $f28,       0x20(%[temp])  \n\t" \
-      "gssqc1       $f31,      $f30,       0x30(%[temp])  \n\t" \
+      MMI_SQC1($f25, $f24, %[temp], 0x00)                       \
+      MMI_SQC1($f27, $f26, %[temp], 0x10)                       \
+      MMI_SQC1($f29, $f28, %[temp], 0x20)                       \
+      MMI_SQC1($f31, $f30, %[temp], 0x30)                       \
       :                                                         \
       : [temp]"r"(temp_backup_reg)                              \
       : "memory"                                                \
     );                                                          \
   else                                                          \
     __asm__ volatile (                                          \
-      "gssqc1       $f22,      $f20,       0x00(%[temp])  \n\t" \
-      "gssqc1       $f26,      $f24,       0x10(%[temp])  \n\t" \
-      "gssqc1       $f30,      $f28,       0x20(%[temp])  \n\t" \
+      MMI_SQC1($f22, $f20, %[temp], 0x10)                       \
+      MMI_SQC1($f26, $f24, %[temp], 0x10)                       \
+      MMI_SQC1($f30, $f28, %[temp], 0x20)                       \
       :                                                         \
       : [temp]"r"(temp_backup_reg)                              \
       : "memory"                                                \
@@ -234,19 +236,19 @@ 
 #define RECOVER_REG \
   if (_MIPS_SIM == _ABI64)                                      \
     __asm__ volatile (                                          \
-      "gslqc1       $f25,      $f24,       0x00(%[temp])  \n\t" \
-      "gslqc1       $f27,      $f26,       0x10(%[temp])  \n\t" \
-      "gslqc1       $f29,      $f28,       0x20(%[temp])  \n\t" \
-      "gslqc1       $f31,      $f30,       0x30(%[temp])  \n\t" \
+      MMI_LQC1($f25, $f24, %[temp], 0x00)                       \
+      MMI_LQC1($f27, $f26, %[temp], 0x10)                       \
+      MMI_LQC1($f29, $f28, %[temp], 0x20)                       \
+      MMI_LQC1($f31, $f30, %[temp], 0x30)                       \
       :                                                         \
       : [temp]"r"(temp_backup_reg)                              \
       : "memory"                                                \
     );                                                          \
   else                                                          \
     __asm__ volatile (                                          \
-      "gslqc1       $f22,      $f20,       0x00(%[temp])  \n\t" \
-      "gslqc1       $f26,      $f24,       0x10(%[temp])  \n\t" \
-      "gslqc1       $f30,      $f28,       0x20(%[temp])  \n\t" \
+      MMI_LQC1($f22, $f20, %[temp], 0x10)                       \
+      MMI_LQC1($f26, $f24, %[temp], 0x10)                       \
+      MMI_LQC1($f30, $f28, %[temp], 0x20)                       \
       :                                                         \
       : [temp]"r"(temp_backup_reg)                              \
       : "memory"                                                \