mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2026-10-28 10:04:37 +08:00
avutil/mips/mmiutils: provide the Loongson MMI mnemonics GNU binutils lacks
GNU binutils spells the MMI instructions pxor, pand, por, pnor, ssrld and sslld as xor, and, or, nor, dsrl and dsll on floating point registers, with -march=loongson2e/2f/3a and since 2.32 with -mloongson-mmi; the p-named entries in its opcode table are the R5900 instructions on general purpose registers. The other 43 p-named MMI instructions FFmpeg uses are spelled the same by everyone. Loongson's gcc toolchain accepts both spellings (ebedd26eef), the binutils 2.24 of their cross-gcc-4.9.3-n64-loongson-rc6.1 only the GNU ones. Since903c5d58f0configure probes pxor and so silently disables MMI with every GNU binutils. Probe Loongson's spelling first and fall back to the GNU one together with assembler macros that define the six names, as asmdefs.h already does for parse_r. The macros assemble to the same encodings as the GNU spelling with binutils 2.24, 2.28 and 2.42. The GNU fallback is limited to little-endian mips64: the MMI code does not build for O32 and its unaligned loads assume little-endian.
This commit is contained in:
1 parent
c4047d1921
commit
1c767fe664
2 files changed
+19
-1
No files matched your search
@@ -2597,6 +2597,7 @@ TOOLCHAIN_FEATURES="
|
||||
ibm_asm
|
||||
inline_asm_direct_symbol_refs
|
||||
inline_asm_nonlocal_labels
|
||||
loongson_mmi_mnemonics
|
||||
pragma_deprecated
|
||||
rsync_contimeout
|
||||
symver_asm_label
|
||||
@@ -6658,7 +6659,14 @@ elif enabled mips; then
|
||||
enabled loongson3 && check_inline_asm loongson3 '"gsldxc1 $f0, 0($2, $3)"' '-mloongson-ext' && append MMIFLAGS '-mloongson-ext'
|
||||
|
||||
# MMI can be detected at runtime too
|
||||
enabled mmi && check_inline_asm mmi '"pxor $f0, $f0, $f0"' '-mloongson-mmi' && append MMIFLAGS '-mloongson-mmi'
|
||||
enabled mmi && {
|
||||
check_inline_asm loongson_mmi_mnemonics '"pxor $f0, $f0, $f0\n\tssrld $f0, $f0, $f0"' '-mloongson-mmi' || {
|
||||
# the MMI code does not build for O32 and assumes little-endian
|
||||
disable mmi
|
||||
enabled mips64 && ! enabled bigendian &&
|
||||
check_inline_asm mmi '"xor $f0, $f0, $f0"' '-mloongson-mmi'
|
||||
}
|
||||
} && append MMIFLAGS '-mloongson-mmi'
|
||||
|
||||
if enabled bigendian && enabled msa; then
|
||||
disable msa
|
||||
|
||||
@@ -29,6 +29,16 @@
|
||||
#include "libavutil/mem_internal.h"
|
||||
#include "libavutil/mips/asmdefs.h"
|
||||
|
||||
#if !HAVE_LOONGSON_MMI_MNEMONICS
|
||||
/* GNU binutils lacks Loongson's names for these MMI instructions */
|
||||
__asm__(".macro pxor d, s, t\n\txor \\d, \\s, \\t\n\t.endm\n"
|
||||
".macro pand d, s, t\n\tand \\d, \\s, \\t\n\t.endm\n"
|
||||
".macro por d, s, t\n\tor \\d, \\s, \\t\n\t.endm\n"
|
||||
".macro pnor d, s, t\n\tnor \\d, \\s, \\t\n\t.endm\n"
|
||||
".macro ssrld d, s, t\n\tdsrl \\d, \\s, \\t\n\t.endm\n"
|
||||
".macro sslld d, s, t\n\tdsll \\d, \\s, \\t\n\t.endm\n");
|
||||
#endif
|
||||
|
||||
/*
|
||||
* These were used to define temporary registers for MMI marcos
|
||||
* however now we're using $at. They're theoretically unnecessary
|
||||
|
||||
Reference in new issue
Block a user