Add RISC-V detection

Change-Id: I0203c88e0944064841c9f6fe9f8a7888d6c421d1
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Andreas Schwab 2018-12-18 16:41:39 +01:00 committed by Allan Sandfeld Jensen
parent 8059762565
commit 9a6a847311
3 changed files with 54 additions and 0 deletions

View File

@ -67,6 +67,10 @@
# define ARCH_PROCESSOR "power"
#elif defined(Q_PROCESSOR_POWER_64)
# define ARCH_PROCESSOR "power64"
#elif defined(Q_PROCESSOR_RISCV_32)
# define ARCH_PROCESSOR "riscv32"
#elif defined(Q_PROCESSOR_RISCV_64)
# define ARCH_PROCESSOR "riscv64"
#elif defined(Q_PROCESSOR_S390_X)
# define ARCH_PROCESSOR "s390x"
#elif defined(Q_PROCESSOR_S390)

View File

@ -1883,6 +1883,42 @@ bool qSharedBuild() noexcept
\sa QSysInfo::buildCpuArchitecture()
*/
/*!
\macro Q_PROCESSOR_RISCV
\relates <QtGlobal>
\since 5.13
Defined if the application is compiled for RISC-V processors. Qt currently
supports two RISC-V variants: \l Q_PROCESSOR_RISCV_32 and \l
Q_PROCESSOR_RISCV_64.
\sa QSysInfo::buildCpuArchitecture()
*/
/*!
\macro Q_PROCESSOR_RISCV_32
\relates <QtGlobal>
\since 5.13
Defined if the application is compiled for 32-bit RISC-V processors. The \l
Q_PROCESSOR_RISCV macro is also defined when Q_PROCESSOR_RISCV_32 is
defined.
\sa QSysInfo::buildCpuArchitecture()
*/
/*!
\macro Q_PROCESSOR_RISCV_64
\relates <QtGlobal>
\since 5.13
Defined if the application is compiled for 64-bit RISC-V processors. The \l
Q_PROCESSOR_RISCV macro is also defined when Q_PROCESSOR_RISCV_64 is
defined.
\sa QSysInfo::buildCpuArchitecture()
*/
/*!
\macro Q_PROCESSOR_S390
\relates <QtGlobal>

View File

@ -281,6 +281,20 @@
# endif
// Q_BYTE_ORDER not defined, use endianness auto-detection
/*
RISC-V family, known variants: 32- and 64-bit
RISC-V is little-endian.
*/
#elif defined(__riscv)
# define Q_PROCESSOR_RISCV
# if __riscv_xlen == 64
# define Q_PROCESSOR_RISCV_64
# else
# define Q_PROCESSOR_RISCV_32
# endif
# define Q_BYTE_ORDER Q_LITTLE_ENDIAN
/*
S390 family, known variant: S390X (64-bit)