mips: improve detection of ISAs, FPU and ASEs (DSP, MSA)

Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
pull/181/head
Vicente Olivert Riera 9 years ago committed by Michael Niedermayer
parent 6aac43f180
commit 8514fb6b98
  1. 101
      configure

101
configure vendored

@ -5084,27 +5084,92 @@ 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_ldflags "-mips64r6" &&
add_cflags "-mips64r6" &&
add_asflags "-mips64r6" &&
check_inline_asm mips64r6 '"dlsa $0, $0, $0, 1"' ||
disable mips64r6
fi
if disabled mips64r6 && enabled mips64r2; then
check_ldflags "-mips64r2" &&
add_cflags "-mips64r2" &&
add_asflags "-mips64r2" &&
check_inline_asm mips64r2 '"dext $0, $0, 0, 1"' ||
disable mips64r2
fi
if disabled mips64r6 && disabled mips64r2; then
check_ldflags "-mips64" &&
add_cflags "-mips64" &&
add_asflags "-mips64" &&
check_inline_asm mips64r1 '"daddi $0, $0, 0"' ||
disable mips64r1
fi
else
if enabled mips32r6; then
check_ldflags "-mips32r6" &&
add_cflags "-mips32r6" &&
add_asflags "-mips32r6" &&
check_inline_asm mips32r6 '"aui $0, $0, 0"' ||
disable mips32r6
fi
if disabled mips32r6 && enabled mips32r2; then
check_ldflags "-mips32r2" &&
add_cflags "-mips32r2" &&
add_asflags "-mips32r2" &&
check_inline_asm mips32r2 '"ext $0, $0, 0, 1"' ||
disable mips32r2
fi
if disabled mips32r6 && disabled mips32r2; then
check_ldflags "-mips32" &&
add_cflags "-mips32" &&
add_asflags "-mips32" &&
check_inline_asm mips32r1 '"addi $0, $0, 0"' ||
disable mips32r1
fi
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"'
# MIPS FPU
if enabled mipsfpu; then
check_ldflags "-mhard-float" &&
add_cflags "-mhard-float" &&
add_asflags "-mhard-float" &&
check_inline_asm mipsfpu '"cvt.d.l $f0, $f2"' ||
disable mipsfpu
fi
# 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_ldflags "-mfp64 -mmsa" &&
add_cflags "-mfp64 -mmsa" &&
add_asflags "-mfp64 -mmsa" &&
check_inline_asm msa '"addvi.b $w0, $w1, 1"' &&
check_header msa.h ||
disable msa
fi
else
disable msa
fi
enabled msa && add_asflags "-mmsa"
if enabled mipsdsp; then
check_ldflags "-mdsp" &&
add_cflags "-mdsp" &&
add_asflags "-mdsp" &&
check_inline_asm mipsdsp '"addu.qb $t0, $t1, $t2"' ||
disable mipsdsp
fi
if enabled mipsdspr2; then
check_ldflags "-mdspr2" &&
add_cflags "-mdspr2" &&
add_asflags "-mdspr2" &&
check_inline_asm mipsdspr2 '"absq_s.qb $t0, $t1"' ||
disable mipsdspr2
fi
fi
elif enabled parisc; then

Loading…
Cancel
Save