mips: Autodetect MIPS DSP rev1 and rev2 instructionset

Not every MIPS SoC has the DSP extensions, auto-detect them by using
builtin GCC functions. Check for the DSP macros and add the result
for rev1 and rev2 to the cpufeatures.

Change-Id: I3d6c950f170f102514c43b349f9a23ee796d801a
Reviewed-by: Girish Ramakrishnan <girish.1.ramakrishnan@nokia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Holger Hans Peter Freyther 2012-07-20 21:03:56 +08:00 committed by Qt by Nokia
parent 5f5e9b0e04
commit 08e92ba1e0
6 changed files with 122 additions and 9 deletions

View File

@ -229,7 +229,12 @@ const char msg2[] = "==Qt=magic=Qt== Sub-architecture:"
#endif
// -- MIPS --
// Wikipedia says there are extensions, but GCC installs no headers
# if __mips_dsp
" dsp"
# endif
# if __mips_dspr2
" dspr2"
# endif
// -- POWER, PowerPC --
#ifdef __ALTIVEC__

View File

@ -0,0 +1,47 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/
**
** This file is part of the config.tests of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
int main(int, char**)
{
int result;
__builtin_mips_lhx(&result, 10);
return result;
}

View File

@ -0,0 +1,2 @@
SOURCES = mips_dsp.cpp
CONFIG -= x11 qt

View File

@ -0,0 +1,49 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/
**
** This file is part of the config.tests of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
int main(int, char**)
{
int result, tmp1, tmp2;
tmp1 = 10;
tmp2 = 20;
result = __builtin_mips_append (tmp1, tmp2, 10);
return result;
}

View File

@ -0,0 +1,2 @@
SOURCES = mips_dspr2.cpp
CONFIG -= x11 qt

24
configure vendored
View File

@ -837,8 +837,8 @@ CFG_REDUCE_RELOCATIONS=auto
CFG_ACCESSIBILITY=auto
CFG_IWMMXT=no
CFG_NEON=auto
CFG_MIPS_DSP=yes
CFG_MIPS_DSPR2=yes
CFG_MIPS_DSP=auto
CFG_MIPS_DSPR2=auto
CFG_CLOCK_GETTIME=auto
CFG_CLOCK_MONOTONIC=auto
CFG_MREMAP=auto
@ -3994,17 +3994,25 @@ elif [ "$CFG_ARCH" != "arm" ]; then
fi
# detect mips_dsp support
if [ "${CFG_ARCH}" = "mips" ] && [ "${CFG_MIPS_DSP}" = "yes" ]; then
CFG_MIPS_DSP=yes
if [ "$CFG_ARCH" = "mips" ] && [ "${CFG_MIPS_DSP}" = "auto" ]; then
if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/mips_dsp "mips_dsp" $L_FLAGS $I_FLAGS $D_FLAGS $l_FLAGS; then
CFG_MIPS_DSP=yes
else
CFG_MIPS_DSP=no
CFG_MIPS_DSP=no
fi
elif [ "$CFG_ARCH" != "mips" ]; then
CFG_MIPS_DSP=no
fi
# detect mips_dspr2 support
if [ "${CFG_ARCH}" = "mips" ] && [ "${CFG_MIPS_DSPR2}" = "yes" ]; then
CFG_MIPS_DSPR2=yes
if [ "$CFG_ARCH" = "mips" ] && [ "${CFG_MIPS_DSPR2}" = "auto" ]; then
if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/mips_dspr2 "mips_dspr2" $L_FLAGS $I_FLAGS $D_FLAGS $l_FLAGS; then
CFG_MIPS_DSPR2=yes
else
CFG_MIPS_DSPR2=no
CFG_MIPS_DSPR2=no
fi
elif [ "$CFG_ARCH" != "mips" ]; then
CFG_MIPS_DSPR2=no
fi
[ "$XPLATFORM_MINGW" = "yes" ] && QMakeVar add styles "windowsxp windowsvista"