>From 8b567e5d140a427542ba5d20d915c0a91b61846b Mon Sep 17 00:00:00 2001
From: Shiyou Yin <yinshiyou-hf@loongson.cn>
Date: Thu, 16 Jul 2020 14:59:26 +0800
Subject: [PATCH] diff corresponding to the review comments.

---
 configure          | 14 ++------------
 ffbuild/common.mak |  2 +-
 2 files changed, 3 insertions(+), 13 deletions(-)

diff --git a/configure b/configure
index 55ba544..574f6ab 100755
--- a/configure
+++ b/configure
@@ -5090,7 +5090,6 @@ elif enabled mips; then
                 case $cpu in
                     loongson3*)
                         enable loongson3
-                        enable mips64r2
                         enable msa
                         cpuflags="-march=loongson3a -mhard-float $expensive_optimization_flag"
                     ;;
@@ -5859,7 +5858,6 @@ EOF
 
 elif enabled mips; then
 
-
     # Check toolchain ISA level
     if enabled mips64; then
         enabled mips64r6 && check_inline_asm mips64r6 '"dlsa $0, $0, $0, 1"' &&
@@ -5889,18 +5887,10 @@ elif enabled mips; then
     enabled msa && enabled msa2 && check_inline_asm msa2 '"nxbits.any.b $w0, $w0"' '-mmsa2' && append MSAFLAGS '-mmsa2'
 
     # loongson2 have no switch cflag so we can only probe toolchain ability
-    enabled loongson2 && check_inline_asm loongson2 '"dmult.g $8, $9, $10"'
-    if enabled loongson2 ; then
-        disable loongson3
-    fi
+    enabled loongson2 && check_inline_asm loongson2 '"dmult.g $8, $9, $10"' && disable loongson3
 
     # loongson3 is paired with MMI
-    enabled mips64r2 && enabled loongson3 && check_inline_asm loongson3 '"gsldxc1 $f0, 0($2, $3)"' '-mloongson-ext' && append MMIFLAGS '-mloongson-ext'
-
-    # MMI must come together with loongson2 or loongson3
-    if disabled loongson2 && disabled loongson3; then
-        disable mmi
-    fi
+    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 '"punpcklhw $f0, $f0, $f0"' '-mloongson-mmi' && append MMIFLAGS '-mloongson-mmi'
diff --git a/ffbuild/common.mak b/ffbuild/common.mak
index 6b95a17..13e1355 100644
--- a/ffbuild/common.mak
+++ b/ffbuild/common.mak
@@ -44,7 +44,7 @@ LDFLAGS    := $(ALLFFLIBS:%=$(LD_PATH)lib%) $(LDFLAGS)
 
 define COMPILE
        $(call $(1)DEP,$(1))
-       $($(1)) $($(1)FLAGS) $($(1)_DEPFLAGS) $($(1)_C) $($(1)_O) $($(2)) $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
+       $($(1)) $($(1)FLAGS) $($(2)) $($(1)_DEPFLAGS) $($(1)_C) $($(1)_O) $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
 endef
 
 COMPILE_C = $(call COMPILE,CC)
-- 
2.1.0

