From: Debian Qt/KDE Maintainers Date: Sat, 8 Feb 2025 16:24:33 +0000 (+0300) Subject: add support for LoongArch X-Git-Tag: archive/raspbian/5.15.15+dfsg-4+rpi1^2~19 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=69d0b5bca099a1c0a7931d2f5289990a68dd2ee7;p=qtbase-opensource-src.git add support for LoongArch Origin: upstream, https://code.qt.io/cgit/qt/qtbase.git/commit/?id=bdc16f086f1664b5 Last-Update: 2024-03-09 Gbp-Pq: Name loongarch.diff --- diff --git a/src/corelib/global/archdetect.cpp b/src/corelib/global/archdetect.cpp index 1d00b7f5a..281e84df6 100644 --- a/src/corelib/global/archdetect.cpp +++ b/src/corelib/global/archdetect.cpp @@ -59,6 +59,10 @@ # define ARCH_PROCESSOR "x86_64" #elif defined(Q_PROCESSOR_IA64) # define ARCH_PROCESSOR "ia64" +#elif defined(Q_PROCESSOR_LOONGARCH_32) +# define ARCH_PROCESSOR "loongarch32" +#elif defined(Q_PROCESSOR_LOONGARCH_64) +# define ARCH_PROCESSOR "loongarch64" #elif defined(Q_PROCESSOR_MIPS_64) # define ARCH_PROCESSOR "mips64" #elif defined(Q_PROCESSOR_MIPS) diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 5ad82c259..5cbf2054a 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -1815,6 +1815,37 @@ bool qSharedBuild() noexcept \sa QSysInfo::buildCpuArchitecture() */ +/*! + \macro Q_PROCESSOR_LOONGARCH + \relates + + Defined if the application is compiled for LoongArch processors. + + \sa QSysInfo::buildCpuArchitecture() +*/ + +/*! + \macro Q_PROCESSOR_LOONGARCH_32 + \relates + + Defined if the application is compiled for 32-bit LoongArch processors. + The \l Q_PROCESSOR_LOONGARCH macro is also defined when + Q_PROCESSOR_LOONGARCH_32 is defined. + + \sa QSysInfo::buildCpuArchitecture() +*/ + +/*! + \macro Q_PROCESSOR_LOONGARCH_64 + \relates + + Defined if the application is compiled for 64-bit LoongArch processors. + The \l Q_PROCESSOR_LOONGARCH macro is also defined when + Q_PROCESSOR_LOONGARCH_64 is defined. + + \sa QSysInfo::buildCpuArchitecture() +*/ + /*! \macro Q_PROCESSOR_MIPS \relates diff --git a/src/corelib/global/qprocessordetection.h b/src/corelib/global/qprocessordetection.h index 8d6572085..7b32b919f 100644 --- a/src/corelib/global/qprocessordetection.h +++ b/src/corelib/global/qprocessordetection.h @@ -223,6 +223,20 @@ # define Q_PROCESSOR_WORDSIZE 8 // Q_BYTE_ORDER not defined, use endianness auto-detection +/* + LoongArch family, known variants: 32- and 64-bit + + LoongArch is little-endian. +*/ +#elif defined(__loongarch__) +# define Q_PROCESSOR_LOONGARCH +# if __loongarch_grlen == 64 +# define Q_PROCESSOR_LOONGARCH_64 +# else +# define Q_PROCESSOR_LOONGARCH_32 +# endif +# define Q_BYTE_ORDER Q_LITTLE_ENDIAN + /* MIPS family, known revisions: I, II, III, IV, 32, 64