[compiler-rt] [compiler-rt] Fix the HWCAP2_EBF16 and HWCAP2_SVE_EBF16 macro value (PR #70905)

via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 1 00:30:31 PDT 2023


https://github.com/joyhou-hw created https://github.com/llvm/llvm-project/pull/70905

HWCAP2_EBF16 (1UL << 32)
HWCAP2_SVE_EBF16 (1UL << 33)
this  will overflow in aarch64 ilp32 abi, and make func  __init_cpu_features_constructor() wrong.

>From d5c10a9ca57618029e81206c86de3b3a2c0f6b92 Mon Sep 17 00:00:00 2001
From: houzhenyu <houzhenyu at huawei.com>
Date: Wed, 1 Nov 2023 15:18:09 +0800
Subject: [PATCH] [compiler-rt] Fix the HWCAP2_EBF16 and HWCAP2_SVE_EBF16 macro
 value

(1UL << 32) will overflow in aarch64 ilp32 abi.
---
 compiler-rt/lib/builtins/cpu_model.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/compiler-rt/lib/builtins/cpu_model.c b/compiler-rt/lib/builtins/cpu_model.c
index aefa56abcdd9535..b0ec5e51e96d491 100644
--- a/compiler-rt/lib/builtins/cpu_model.c
+++ b/compiler-rt/lib/builtins/cpu_model.c
@@ -1137,10 +1137,10 @@ typedef struct __ifunc_arg_t {
 #define HWCAP2_WFXT (1UL << 31)
 #endif
 #ifndef HWCAP2_EBF16
-#define HWCAP2_EBF16 (1UL << 32)
+#define HWCAP2_EBF16 (1ULL << 32)
 #endif
 #ifndef HWCAP2_SVE_EBF16
-#define HWCAP2_SVE_EBF16 (1UL << 33)
+#define HWCAP2_SVE_EBF16 (1ULL << 33)
 #endif
 
 // Detect Exynos 9810 CPU



More information about the llvm-commits mailing list