[FFmpeg-devel] [PATCH v3] avutil/mips: Avoid instruction exception caused by gssqc1/gslqc1.

Reimar Döffinger Reimar.Doeffinger at gmx.de
Sun Jul 28 01:36:54 EEST 2019


On 26.07.2019, at 07:18, Shiyou Yin <yinshiyou-hf at loongson.cn> wrote:

> Ensure the address accesed by gssqc1/gslqc1 are 16-bits memory-aligned.

Looks good to me if standard DECLARE_ALIGNED should work for stack on MIPS.
(on x86 it used to be possible for the stack pointer to only be 8-byte aligned, in which case DECLARE_ALIGNED could not actually provide 16-byte aligned stack variables, so there were special macros - I have not checked how it works nowadays or if MIPS has that issue).
Well, I guess regardless of that, this is better than before, so should be fine to apply either way.

> ---
> libavcodec/mips/simple_idct_mmi.c | 2 +-
> libavutil/mips/mmiutils.h         | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/mips/simple_idct_mmi.c b/libavcodec/mips/simple_idct_mmi.c
> index 7f4bb74..73d797f 100644
> --- a/libavcodec/mips/simple_idct_mmi.c
> +++ b/libavcodec/mips/simple_idct_mmi.c
> @@ -39,7 +39,7 @@
> #define COL_SHIFT 20
> #define DC_SHIFT 3
> 
> -DECLARE_ALIGNED(8, const int16_t, W_arr)[46] = {
> +DECLARE_ALIGNED(16, const int16_t, W_arr)[46] = {
>     W4,  W2,  W4,  W6,
>     W1,  W3,  W5,  W7,
>     W4,  W6, -W4, -W2,
> diff --git a/libavutil/mips/mmiutils.h b/libavutil/mips/mmiutils.h
> index 05f6b31..14b6d20 100644
> --- a/libavutil/mips/mmiutils.h
> +++ b/libavutil/mips/mmiutils.h
> @@ -205,7 +205,7 @@
>  * backup register
>  */
> #define BACKUP_REG \
> -  double temp_backup_reg[8];                                    \
> +  DECLARE_ALIGNED(16, double, temp_backup_reg)[8];              \
>   if (_MIPS_SIM == _ABI64)                                      \
>     __asm__ volatile (                                          \
>       "gssqc1       $f25,      $f24,       0x00(%[temp])  \n\t" \
> -- 
> 2.1.0
> 
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-devel mailing list