From 4abc13fa555c47cd79f236927d15115474c04dcf Mon Sep 17 00:00:00 2001 From: Zhang Na <44800775+loongson-zn@users.noreply.github.com> Date: Sat, 26 Feb 2022 11:02:32 +0800 Subject: [PATCH] Add support for LoongArch (#122) --- include/boost/predef/architecture.h | 1 + include/boost/predef/architecture/loongarch.h | 41 +++++++++++++++++++ include/boost/predef/other/endian.h | 1 + 3 files changed, 43 insertions(+) create mode 100644 include/boost/predef/architecture/loongarch.h diff --git a/include/boost/predef/architecture.h b/include/boost/predef/architecture.h index f43f946..b131a89 100644 --- a/include/boost/predef/architecture.h +++ b/include/boost/predef/architecture.h @@ -16,6 +16,7 @@ http://www.boost.org/LICENSE_1_0.txt) #include #include #include +#include #include #include #include diff --git a/include/boost/predef/architecture/loongarch.h b/include/boost/predef/architecture/loongarch.h new file mode 100644 index 0000000..e3e163b --- /dev/null +++ b/include/boost/predef/architecture/loongarch.h @@ -0,0 +1,41 @@ +/* +Copyright Zhang Na 2022 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_ARCHITECTURE_LOONGARCH_H +#define BOOST_PREDEF_ARCHITECTURE_LOONGARCH_H + +#include +#include + +/* tag::reference[] += `BOOST_ARCH_LOONGARCH` + +[options="header"] +|=== +| {predef_symbol} | {predef_version} + +| `+__loongarch__+` | {predef_detection} +|=== +*/ // end::reference[] + +#define BOOST_ARCH_LOONGARCH BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__loongarch__) +# undef BOOST_ARCH_LOONGARCH +# define BOOST_ARCH_LOONGARCH BOOST_VERSION_NUMBER_AVAILABLE +#endif + +#if BOOST_ARCH_LOONGARCH +# define BOOST_ARCH_LOONGARCH_AVAILABLE +#endif + +#define BOOST_ARCH_LOONGARCH_NAME "LoongArch" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_ARCH_LOONGARCH,BOOST_ARCH_LOONGARCH_NAME) diff --git a/include/boost/predef/other/endian.h b/include/boost/predef/other/endian.h index d8ec63f..435492a 100644 --- a/include/boost/predef/other/endian.h +++ b/include/boost/predef/other/endian.h @@ -121,6 +121,7 @@ information and acquired knowledge: defined(__ARMEL__) || \ defined(__THUMBEL__) || \ defined(__AARCH64EL__) || \ + defined(__loongarch__) || \ defined(_MIPSEL) || \ defined(__MIPSEL) || \ defined(__MIPSEL__) || \