diff mbox

[FFmpeg-devel,1/2] avcodec/mips: [loongson] fix improper use of register constraints.

Message ID 1536221453-15372-1-git-send-email-yinshiyou-hf@loongson.cn
State Accepted
Commit 9f60c58586805cc5249ea0446a9bb86eed8bc311
Headers show

Commit Message

殷时友 Sept. 6, 2018, 8:10 a.m. UTC
Constraint "g" means compiler can store variable in memory or register.
When we use constraint "g" for a variable and this variable was operated by
instruction which only support register operands may lead "invalid operands" error.
---
 libavcodec/mips/vc1dsp_mmi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

殷时友 Sept. 7, 2018, 3:40 a.m. UTC | #1
>-----Original Message-----
>From: ffmpeg-devel-bounces@ffmpeg.org [mailto:ffmpeg-devel-bounces@ffmpeg.org] On Behalf Of
>Shiyou Yin
>Sent: Thursday, September 6, 2018 4:11 PM
>To: ffmpeg-devel@ffmpeg.org
>Subject: [FFmpeg-devel] [PATCH 1/2] avcodec/mips: [loongson] fix improper use of register constraints.
>
>Constraint "g" means compiler can store variable in memory or register.
>When we use constraint "g" for a variable and this variable was operated by
>instruction which only support register operands may lead "invalid operands" error.
>---
> libavcodec/mips/vc1dsp_mmi.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
>diff --git a/libavcodec/mips/vc1dsp_mmi.c b/libavcodec/mips/vc1dsp_mmi.c
>index d78e0c3..a439b40 100644
>--- a/libavcodec/mips/vc1dsp_mmi.c
>+++ b/libavcodec/mips/vc1dsp_mmi.c
>@@ -1857,8 +1857,8 @@ static void OPNAME ## vc1_shift2_mmi(uint8_t *dst, const uint8_t *src,
>\
>         : RESTRICT_ASM_LOW32            RESTRICT_ASM_ADDRT                  \
>           [src]"+r"(src),               [dst]"+r"(dst)                      \
>         : [offset]"r"(offset),          [offset_x2n]"r"(-2*offset),         \
>-          [stride]"g"(stride),          [rnd]"m"(rnd),                      \
>-          [stride1]"g"(stride-offset),                                      \
>+          [stride]"r"(stride),          [rnd]"m"(rnd),                      \
>+          [stride1]"r"(stride-offset),                                      \
>           [ff_pw_9]"m"(ff_pw_9)                                             \
>         : "$8", "$9", "$10", "$f0", "$f2", "$f4", "$f6", "$f8", "$f10",     \
>           "$f12", "$f14", "$f16", "memory"                                  \
>@@ -2082,7 +2082,7 @@ OPNAME ## vc1_## NAME ## _mmi(uint8_t *dst, const uint8_t *src,
>\
>           [h]"+r"(h),                                                       \
>           [src]"+r"(src),               [dst]"+r"(dst)                      \
>         : [offset_x1]"r"(offset),       [offset_x2]"r"(2*offset),           \
>-          [offset_x3]"r"(3*offset),     [stride]"g"(stride),                \
>+          [offset_x3]"r"(3*offset),     [stride]"r"(stride),                \
>           [rnd]"m"(rnd),                                                    \
>           [ff_pw_53]"m"(ff_pw_53),      [ff_pw_18]"m"(ff_pw_18),            \
>           [ff_pw_3]"f"(ff_pw_3)                                             \
>--
>2.1.0

Hi Michael, could you please help to review this patch.
Michael Niedermayer Sept. 7, 2018, 6:18 p.m. UTC | #2
On Thu, Sep 06, 2018 at 04:10:52PM +0800, Shiyou Yin wrote:
> Constraint "g" means compiler can store variable in memory or register.
> When we use constraint "g" for a variable and this variable was operated by
> instruction which only support register operands may lead "invalid operands" error.
> ---
>  libavcodec/mips/vc1dsp_mmi.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

will apply

thx

[...]
diff mbox

Patch

diff --git a/libavcodec/mips/vc1dsp_mmi.c b/libavcodec/mips/vc1dsp_mmi.c
index d78e0c3..a439b40 100644
--- a/libavcodec/mips/vc1dsp_mmi.c
+++ b/libavcodec/mips/vc1dsp_mmi.c
@@ -1857,8 +1857,8 @@  static void OPNAME ## vc1_shift2_mmi(uint8_t *dst, const uint8_t *src,      \
         : RESTRICT_ASM_LOW32            RESTRICT_ASM_ADDRT                  \
           [src]"+r"(src),               [dst]"+r"(dst)                      \
         : [offset]"r"(offset),          [offset_x2n]"r"(-2*offset),         \
-          [stride]"g"(stride),          [rnd]"m"(rnd),                      \
-          [stride1]"g"(stride-offset),                                      \
+          [stride]"r"(stride),          [rnd]"m"(rnd),                      \
+          [stride1]"r"(stride-offset),                                      \
           [ff_pw_9]"m"(ff_pw_9)                                             \
         : "$8", "$9", "$10", "$f0", "$f2", "$f4", "$f6", "$f8", "$f10",     \
           "$f12", "$f14", "$f16", "memory"                                  \
@@ -2082,7 +2082,7 @@  OPNAME ## vc1_## NAME ## _mmi(uint8_t *dst, const uint8_t *src,             \
           [h]"+r"(h),                                                       \
           [src]"+r"(src),               [dst]"+r"(dst)                      \
         : [offset_x1]"r"(offset),       [offset_x2]"r"(2*offset),           \
-          [offset_x3]"r"(3*offset),     [stride]"g"(stride),                \
+          [offset_x3]"r"(3*offset),     [stride]"r"(stride),                \
           [rnd]"m"(rnd),                                                    \
           [ff_pw_53]"m"(ff_pw_53),      [ff_pw_18]"m"(ff_pw_18),            \
           [ff_pw_3]"f"(ff_pw_3)                                             \