[clang] [clang][LoongArch] Guard FCSR intrinsics with __loongarch_hard_float (PR #176545)
via cfe-commits
cfe-commits at lists.llvm.org
Sat Jan 17 00:49:07 PST 2026
https://github.com/heiher created https://github.com/llvm/llvm-project/pull/176545
Link: https://gcc.gnu.org/pipermail/gcc-patches/2025-December/703313.html
>From d54f0a1045463cff7454744090365d30fb1dc840 Mon Sep 17 00:00:00 2001
From: WANG Rui <wangrui at loongson.cn>
Date: Fri, 12 Dec 2025 15:45:32 +0800
Subject: [PATCH] [clang][LoongArch] Guard FCSR intrinsics with
__loongarch_hard_float
Link: https://gcc.gnu.org/pipermail/gcc-patches/2025-December/703313.html
---
clang/lib/Headers/larchintrin.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/clang/lib/Headers/larchintrin.h b/clang/lib/Headers/larchintrin.h
index a1247d12e21f8..3f0fab2b570e0 100644
--- a/clang/lib/Headers/larchintrin.h
+++ b/clang/lib/Headers/larchintrin.h
@@ -120,10 +120,12 @@ extern __inline int
#define __ibar(/*ui15*/ _1) __builtin_loongarch_ibar((_1))
+#ifdef __loongarch_hard_float
#define __movfcsr2gr(/*ui5*/ _1) __builtin_loongarch_movfcsr2gr((_1));
#define __movgr2fcsr(/*ui5*/ _1, _2) \
__builtin_loongarch_movgr2fcsr((_1), (unsigned int)_2);
+#endif
#define __syscall(/*ui15*/ _1) __builtin_loongarch_syscall((_1))
More information about the cfe-commits
mailing list