[FFmpeg-devel] [PATCH] Fix compilation with llvm-gcc on x86_64
Mans Rullgard
mans
Sun Nov 1 18:55:12 CET 2009
LLVM requires matching input and output asm parameters to have the
same type. For the FASTDIV macro, an (int) cast on the input fixes
this trivially.
Apparently, LLVM also dislikes +g constraints with int operands on
x86_64, probably due to register being wider than int. Using a +r
constraint instead works with gcc 3.4.6, gcc 4.3.4, and llvm-gcc 2.6.
---
libavcodec/x86/dsputil_mmx.c | 10 +++++-----
libavcodec/x86/dsputil_mmx_avg_template.c | 22 +++++++++++-----------
libavcodec/x86/dsputil_mmx_rnd_template.c | 12 ++++++------
libavutil/internal.h | 2 +-
4 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/libavcodec/x86/dsputil_mmx.c b/libavcodec/x86/dsputil_mmx.c
index af33707..c5bacaf 100644
--- a/libavcodec/x86/dsputil_mmx.c
+++ b/libavcodec/x86/dsputil_mmx.c
@@ -376,7 +376,7 @@ static void put_pixels4_mmx(uint8_t *block, const uint8_t *pixels, int line_size
"add %%"REG_a", %2 \n\t"
"subl $4, %0 \n\t"
"jnz 1b \n\t"
- : "+g"(h), "+r" (pixels), "+r" (block)
+ : "+r"(h), "+r" (pixels), "+r" (block)
: "r"((x86_reg)line_size)
: "%"REG_a, "memory"
);
@@ -402,7 +402,7 @@ static void put_pixels8_mmx(uint8_t *block, const uint8_t *pixels, int line_size
"add %%"REG_a", %2 \n\t"
"subl $4, %0 \n\t"
"jnz 1b \n\t"
- : "+g"(h), "+r" (pixels), "+r" (block)
+ : "+r"(h), "+r" (pixels), "+r" (block)
: "r"((x86_reg)line_size)
: "%"REG_a, "memory"
);
@@ -436,7 +436,7 @@ static void put_pixels16_mmx(uint8_t *block, const uint8_t *pixels, int line_siz
"add %%"REG_a", %2 \n\t"
"subl $4, %0 \n\t"
"jnz 1b \n\t"
- : "+g"(h), "+r" (pixels), "+r" (block)
+ : "+r"(h), "+r" (pixels), "+r" (block)
: "r"((x86_reg)line_size)
: "%"REG_a, "memory"
);
@@ -458,7 +458,7 @@ static void put_pixels16_sse2(uint8_t *block, const uint8_t *pixels, int line_si
"lea (%1,%3,4), %1 \n\t"
"lea (%2,%3,4), %2 \n\t"
"jnz 1b \n\t"
- : "+g"(h), "+r" (pixels), "+r" (block)
+ : "+r"(h), "+r" (pixels), "+r" (block)
: "r"((x86_reg)line_size), "r"((x86_reg)3L*line_size)
: "memory"
);
@@ -484,7 +484,7 @@ static void avg_pixels16_sse2(uint8_t *block, const uint8_t *pixels, int line_si
"lea (%1,%3,4), %1 \n\t"
"lea (%2,%3,4), %2 \n\t"
"jnz 1b \n\t"
- : "+g"(h), "+r" (pixels), "+r" (block)
+ : "+r"(h), "+r" (pixels), "+r" (block)
: "r"((x86_reg)line_size), "r"((x86_reg)3L*line_size)
: "memory"
);
diff --git a/libavcodec/x86/dsputil_mmx_avg_template.c b/libavcodec/x86/dsputil_mmx_avg_template.c
index 8220867..905ecdf 100644
--- a/libavcodec/x86/dsputil_mmx_avg_template.c
+++ b/libavcodec/x86/dsputil_mmx_avg_template.c
@@ -50,7 +50,7 @@ static void DEF(put_pixels8_x2)(uint8_t *block, const uint8_t *pixels, int line_
"add %%"REG_a", %2 \n\t"
"subl $4, %0 \n\t"
"jnz 1b \n\t"
- :"+g"(h), "+S"(pixels), "+D"(block)
+ :"+r"(h), "+S"(pixels), "+D"(block)
:"r" ((x86_reg)line_size)
:"%"REG_a, "memory");
}
@@ -368,7 +368,7 @@ static void DEF(put_pixels16_x2)(uint8_t *block, const uint8_t *pixels, int line
"add %%"REG_a", %2 \n\t"
"subl $4, %0 \n\t"
"jnz 1b \n\t"
- :"+g"(h), "+S"(pixels), "+D"(block)
+ :"+r"(h), "+S"(pixels), "+D"(block)
:"r" ((x86_reg)line_size)
:"%"REG_a, "memory");
}
@@ -581,7 +581,7 @@ static void DEF(put_no_rnd_pixels8_x2)(uint8_t *block, const uint8_t *pixels, in
"add %%"REG_a", %2 \n\t"
"subl $4, %0 \n\t"
"jnz 1b \n\t"
- :"+g"(h), "+S"(pixels), "+D"(block)
+ :"+r"(h), "+S"(pixels), "+D"(block)
:"r" ((x86_reg)line_size)
:"%"REG_a, "memory");
}
@@ -611,7 +611,7 @@ static void DEF(put_pixels8_y2)(uint8_t *block, const uint8_t *pixels, int line_
"add %%"REG_a", %2 \n\t"
"subl $4, %0 \n\t"
"jnz 1b \n\t"
- :"+g"(h), "+S"(pixels), "+D" (block)
+ :"+r"(h), "+S"(pixels), "+D" (block)
:"r" ((x86_reg)line_size)
:"%"REG_a, "memory");
}
@@ -645,7 +645,7 @@ static void DEF(put_no_rnd_pixels8_y2)(uint8_t *block, const uint8_t *pixels, in
"add %%"REG_a", %2 \n\t"
"subl $4, %0 \n\t"
"jnz 1b \n\t"
- :"+g"(h), "+S"(pixels), "+D" (block)
+ :"+r"(h), "+S"(pixels), "+D" (block)
:"r" ((x86_reg)line_size)
:"%"REG_a, "memory");
}
@@ -673,7 +673,7 @@ static void DEF(avg_pixels8)(uint8_t *block, const uint8_t *pixels, int line_siz
"add %%"REG_a", %2 \n\t"
"subl $4, %0 \n\t"
"jnz 1b \n\t"
- :"+g"(h), "+S"(pixels), "+D"(block)
+ :"+r"(h), "+S"(pixels), "+D"(block)
:"r" ((x86_reg)line_size)
:"%"REG_a, "memory");
}
@@ -705,7 +705,7 @@ static void DEF(avg_pixels8_x2)(uint8_t *block, const uint8_t *pixels, int line_
"add %%"REG_a", %2 \n\t"
"subl $4, %0 \n\t"
"jnz 1b \n\t"
- :"+g"(h), "+S"(pixels), "+D"(block)
+ :"+r"(h), "+S"(pixels), "+D"(block)
:"r" ((x86_reg)line_size)
:"%"REG_a, "memory");
}
@@ -743,7 +743,7 @@ static void DEF(avg_pixels8_y2)(uint8_t *block, const uint8_t *pixels, int line_
"add %%"REG_a", %2 \n\t"
"subl $4, %0 \n\t"
"jnz 1b \n\t"
- :"+g"(h), "+S"(pixels), "+D"(block)
+ :"+r"(h), "+S"(pixels), "+D"(block)
:"r" ((x86_reg)line_size)
:"%"REG_a, "memory");
}
@@ -786,7 +786,7 @@ static void DEF(avg_pixels8_xy2)(uint8_t *block, const uint8_t *pixels, int line
"add %%"REG_a", %2 \n\t"
"subl $4, %0 \n\t"
"jnz 1b \n\t"
- :"+g"(h), "+S"(pixels), "+D"(block)
+ :"+r"(h), "+S"(pixels), "+D"(block)
:"r" ((x86_reg)line_size)
:"%"REG_a, "memory");
}
@@ -863,7 +863,7 @@ static void DEF(OPNAME ## 2tap_qpel16_l3)(uint8_t *dst, uint8_t *src, int stride
"add %5, %1 \n\t"\
"decl %0 \n\t"\
"jnz 1b \n\t"\
- :"+g"(h), "+r"(src)\
+ :"+r"(h), "+r"(src)\
:"r"((x86_reg)off1), "r"((x86_reg)off2),\
"r"((x86_reg)(dst-src)), "r"((x86_reg)stride)\
:"memory"\
@@ -880,7 +880,7 @@ static void DEF(OPNAME ## 2tap_qpel8_l3)(uint8_t *dst, uint8_t *src, int stride,
"add %5, %1 \n\t"\
"decl %0 \n\t"\
"jnz 1b \n\t"\
- :"+g"(h), "+r"(src)\
+ :"+r"(h), "+r"(src)\
:"r"((x86_reg)off1), "r"((x86_reg)off2),\
"r"((x86_reg)(dst-src)), "r"((x86_reg)stride)\
:"memory"\
diff --git a/libavcodec/x86/dsputil_mmx_rnd_template.c b/libavcodec/x86/dsputil_mmx_rnd_template.c
index 2fc1756..a58e49d 100644
--- a/libavcodec/x86/dsputil_mmx_rnd_template.c
+++ b/libavcodec/x86/dsputil_mmx_rnd_template.c
@@ -52,7 +52,7 @@ static void DEF(put, pixels8_x2)(uint8_t *block, const uint8_t *pixels, int line
"add %%"REG_a", %2 \n\t"
"subl $4, %0 \n\t"
"jnz 1b \n\t"
- :"+g"(h), "+S"(pixels), "+D"(block)
+ :"+r"(h), "+S"(pixels), "+D"(block)
:"r"((x86_reg)line_size)
:REG_a, "memory");
}
@@ -148,7 +148,7 @@ static void DEF(put, pixels16_x2)(uint8_t *block, const uint8_t *pixels, int lin
"add %%"REG_a", %2 \n\t"
"subl $4, %0 \n\t"
"jnz 1b \n\t"
- :"+g"(h), "+S"(pixels), "+D"(block)
+ :"+r"(h), "+S"(pixels), "+D"(block)
:"r"((x86_reg)line_size)
:REG_a, "memory");
}
@@ -226,7 +226,7 @@ static void DEF(put, pixels8_y2)(uint8_t *block, const uint8_t *pixels, int line
"add %%"REG_a", %2 \n\t"
"subl $4, %0 \n\t"
"jnz 1b \n\t"
- :"+g"(h), "+S"(pixels), "+D"(block)
+ :"+r"(h), "+S"(pixels), "+D"(block)
:"r"((x86_reg)line_size)
:REG_a, "memory");
}
@@ -292,7 +292,7 @@ static void DEF(put, pixels8_xy2)(uint8_t *block, const uint8_t *pixels, int lin
"subl $2, %0 \n\t"
"jnz 1b \n\t"
- :"+g"(h), "+S"(pixels)
+ :"+r"(h), "+S"(pixels)
:"D"(block), "r"((x86_reg)line_size)
:REG_a, "memory");
}
@@ -488,7 +488,7 @@ static void DEF(avg, pixels8_y2)(uint8_t *block, const uint8_t *pixels, int line
"subl $4, %0 \n\t"
"jnz 1b \n\t"
- :"+g"(h), "+S"(pixels), "+D"(block)
+ :"+r"(h), "+S"(pixels), "+D"(block)
:"r"((x86_reg)line_size)
:REG_a, "memory");
}
@@ -563,7 +563,7 @@ static void DEF(avg, pixels8_xy2)(uint8_t *block, const uint8_t *pixels, int lin
"subl $2, %0 \n\t"
"jnz 1b \n\t"
- :"+g"(h), "+S"(pixels)
+ :"+r"(h), "+S"(pixels)
:"D"(block), "r"((x86_reg)line_size)
:REG_a, "memory");
}
diff --git a/libavutil/internal.h b/libavutil/internal.h
index 141186b..717cc8f 100644
--- a/libavutil/internal.h
+++ b/libavutil/internal.h
@@ -133,7 +133,7 @@ extern const uint32_t ff_inverse[257];
__asm__ volatile(\
"mull %3"\
:"=d"(ret), "=a"(dmy)\
- :"1"(a), "g"(ff_inverse[b])\
+ :"1"((int)a), "g"(ff_inverse[b])\
);\
ret;\
})
--
1.6.5.2
More information about the ffmpeg-devel
mailing list