[FFmpeg-devel] [PATCH v3 12/14] mips: improve detection of ISAs, FPU and ASEs (DSP, MSA)

Vicente Olivert Riera Vincent.Riera at imgtec.com
Thu Dec 3 14:22:27 CET 2015


Signed-off-by: Vicente Olivert Riera <Vincent.Riera at imgtec.com>
---
Changes v2 -> v3:
 - Nothing.

Changes v1 -> v2:
 - Add a block of code for mipsdspr2 which was previously placed in the
   first patch of this series causing a syntax error in the configure
   script.
   https://lists.ffmpeg.org/pipermail/ffmpeg-devel/2015-November/183444.html

 configure | 83 +++++++++++++++++++++++++++++++++++++++++++++++++--------------
 1 file changed, 65 insertions(+), 18 deletions(-)

diff --git a/configure b/configure
index 2ee10db..7d06494 100755
--- a/configure
+++ b/configure
@@ -4964,27 +4964,74 @@ elif enabled mips; then
     enabled mmi && check_inline_asm mmi '"punpcklhw $f0, $f0, $f0"'
 
     # Enable minimum ISA based on selected options
-    if enabled mips64 && (enabled mipsdsp || enabled mipsdspr2); then
-        add_cflags "-mips64r2"
-        add_asflags "-mips64r2"
-    elif enabled mips64 && enabled mipsfpu && disabled loongson2 && disabled loongson3; then
-        add_cflags "-mips64"
-        add_asflags "-mips64"
-    elif enabled mipsdsp || enabled mipsdspr2; then
-        add_cflags "-mips32r2 -mfp32"
-        add_asflags "-mips32r2 -mfp32"
+    if enabled mips64; then
+        if enabled mips64r6; then
+            check_cflags "-mips64r6" &&
+            check_ldflags "-mips64r6" &&
+            add_asflags "-mips64r6" &&
+            check_inline_asm mips64r6 '"dlsa $0, $0, $0, 1"'
+        elif enabled mips64r2; then
+            check_cflags "-mips64r2" &&
+            check_ldflags "-mips64r2" &&
+            add_asflags "-mips64r2" &&
+            check_inline_asm mips64r2 '"dext $0, $0, 0, 1"'
+        else
+            check_cflags "-mips64" &&
+            check_ldflags "-mips64" &&
+            add_asflags "-mips64" &&
+            check_inline_asm mips64r1 '"daddi $0, $0, 0"'
+        fi
+    else
+        if enabled mips32r6; then
+            check_cflags "-mips32r6" &&
+            check_ldflags "-mips32r6" &&
+            add_asflags "-mips32r6" &&
+            check_inline_asm mips32r6 '"aui $0, $0, 0"'
+        elif enabled mips32r2; then
+            check_cflags "-mips32r2" &&
+            check_ldflags "-mips32r2" &&
+            add_asflags "-mips32r2" &&
+            check_inline_asm mips32r2 '"ext $0, $0, 0, 1"'
+        else
+            check_cflags "-mips32" &&
+            check_ldflags "-mips32" &&
+            add_asflags "-mips32" &&
+            check_inline_asm mips32r1 '"addi $0, $0, 0"'
+        fi
+    fi
+
+    # MIPS FPU
+    if enabled mipsfpu; then
+        add_cflags "-mhard-float" &&
+        add_asflags "-mhard-float" &&
+        check_inline_asm mipsfpu '"cvt.d.l $f0, $f2"'
     fi
 
-    enabled mipsdsp && add_cflags "-mdsp" && add_asflags "-mdsp" &&
-     check_inline_asm mipsdsp '"addu.qb $t0, $t1, $t2"'
-    enabled mipsdspr2 && add_cflags "-mdspr2" && add_asflags "-mdspr2" &&
-     check_inline_asm mipsdspr2 '"absq_s.qb $t0, $t1"'
-    enabled mipsfpu   && add_cflags "-mhard-float" && add_asflags "-mhard-float" &&
-     check_inline_asm mipsfpu   '"madd.d $f0, $f2, $f4, $f6"'
-    enabled msa       && check_cflags "-mmsa" && check_ldflags "-mmsa" &&
-     check_inline_asm msa       '"addvi.b $w0, $w1, 1"'
+    # MSA and DSP support require ISA revision level 2 or greater
+    if enabled mips32r2 || enabled mips64r2 || enabled mips32r6 || enabled mips64r6; then
+        # MSA must be used with -mfp64 and -mhard-float
+        if enabled mipsfpu; then
+            if enabled msa; then
+                check_cflags "-mfp64 -mmsa" &&
+                check_ldflags "-mfp64 -mmsa" &&
+                add_asflags "-mfp64 -mmsa" &&
+                check_inline_asm msa '"addvi.b $w0, $w1, 1"'
+            fi
+        else
+            disable msa
+        fi
 
-    enabled msa && add_asflags "-mmsa"
+        if enabled mipsdsp; then
+            check_cflags "-mdsp" &&
+            add_asflags "-mdsp" &&
+            check_inline_asm mipsdsp '"addu.qb $t0, $t1, $t2"'
+        fi
+        if enabled mipsdspr2; then
+            check_cflags "-mdspr2" &&
+            add_asflags "-mdspr2" &&
+            check_inline_asm mipsdspr2 '"absq_s.qb $t0, $t1"'
+        fi
+    fi
 
 elif enabled parisc; then
 
-- 
2.4.10



More information about the ffmpeg-devel mailing list