[FFmpeg-devel] [PATCH 12/13] Improve detection of MIPS ISAs, FPU and ASEs (DSP, MSA)

Nedeljko Babic Nedeljko.Babic at imgtec.com
Tue Nov 17 16:05:57 CET 2015


LGTM

Thanks,
Nedeljko
________________________________________
Od: Vincent Olivert Riera
Poslato: 16. novembar 2015 15:57
Za: ffmpeg-devel at ffmpeg.org
Cc: Nedeljko Babic; Shivraj Patil; Vincent Olivert Riera
Tema: [PATCH 12/13] Improve detection of MIPS ISAs, FPU and ASEs (DSP, MSA)

Signed-off-by: Vicente Olivert Riera <Vincent.Riera at imgtec.com>
---
 configure |   77 ++++++++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 59 insertions(+), 18 deletions(-)

diff --git a/configure b/configure
index 1bfcc67..4173684 100755
--- a/configure
+++ b/configure
@@ -4952,27 +4952,68 @@ 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" &&
--
1.7.1



More information about the ffmpeg-devel mailing list