From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id 4307C3857C43; Thu, 9 Feb 2023 19:48:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4307C3857C43 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1675972119; bh=WMMTtm5TBcdhmb1xDqDwsgQOAQ5bcdkC0kjaO78CJlg=; h=From:To:Subject:Date:From; b=UBkvSi7JDS+zed2ijcY5qBHHUgY7XbUs3+Pi4n1lddiuvuSRkzWJonOZ88Eo+zOm5 95QkeI/Swso+sXSL6KlW27ifT2yZpuqKNne+Uh+lSCU3lpIAjo5SP/mKMgmkB2LuJ4 5YJI6nWTd9hRhuSuFx5goK6/p4+8MjQamoAvwYWs= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Adhemerval Zanella To: glibc-cvs@sourceware.org Subject: [glibc/azanella/clang] aarch64: Use 64-bit variable to access the special registers X-Act-Checkin: glibc X-Git-Author: Adhemerval Zanella X-Git-Refname: refs/heads/azanella/clang X-Git-Oldrev: a08696d4bde2f8b7b7b88cca26989df545cfcb58 X-Git-Newrev: fc29c406a27b0f18e7778dec9c08b25945c391fc Message-Id: <20230209194839.4307C3857C43@sourceware.org> Date: Thu, 9 Feb 2023 19:48:39 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=fc29c406a27b0f18e7778dec9c08b25945c391fc commit fc29c406a27b0f18e7778dec9c08b25945c391fc Author: Adhemerval Zanella Date: Tue Mar 15 18:08:21 2022 -0300 aarch64: Use 64-bit variable to access the special registers Diff: --- sysdeps/aarch64/fpu/fpu_control.h | 36 ++++++++++++++++++-------- sysdeps/aarch64/fpu/fraiseexcpt.c | 2 +- sysdeps/aarch64/sfp-machine.h | 2 +- sysdeps/unix/sysv/linux/aarch64/cpu-features.c | 2 +- sysdeps/unix/sysv/linux/aarch64/sysconf.c | 2 +- 5 files changed, 29 insertions(+), 15 deletions(-) diff --git a/sysdeps/aarch64/fpu/fpu_control.h b/sysdeps/aarch64/fpu/fpu_control.h index 81ed67151b..4bf14c50bb 100644 --- a/sysdeps/aarch64/fpu/fpu_control.h +++ b/sysdeps/aarch64/fpu/fpu_control.h @@ -29,17 +29,31 @@ # define _FPU_GETFPSR(fpsr) (fpsr = __builtin_aarch64_get_fpsr ()) # define _FPU_SETFPSR(fpsr) __builtin_aarch64_set_fpsr (fpsr) #else -# define _FPU_GETCW(fpcr) \ - __asm__ __volatile__ ("mrs %0, fpcr" : "=r" (fpcr)) - -# define _FPU_SETCW(fpcr) \ - __asm__ __volatile__ ("msr fpcr, %0" : : "r" (fpcr)) - -# define _FPU_GETFPSR(fpsr) \ - __asm__ __volatile__ ("mrs %0, fpsr" : "=r" (fpsr)) - -# define _FPU_SETFPSR(fpsr) \ - __asm__ __volatile__ ("msr fpsr, %0" : : "r" (fpsr)) +# define _FPU_GETCW(fpcr) \ + ({ \ + unsigned long int __fpcr; \ + __asm__ __volatile__ ("mrs %0, fpcr" : "=r" (__fpcr)); \ + fpcr = __fpcr; \ + }) + +# define _FPU_SETCW(fpcr) \ + ({ \ + unsigned long int __fpcr = fpcr; \ + __asm__ __volatile__ ("msr fpcr, %0" : : "r" (__fpcr)); \ + }) + +# define _FPU_GETFPSR(fpsr) \ + ({ \ + unsigned long int __fpsr; \ + __asm__ __volatile__ ("mrs %0, fpsr" : "=r" (__fpsr)); \ + fpsr = __fpsr; \ + }) + +# define _FPU_SETFPSR(fpsr) \ + ({ \ + unsigned long int __fpsr = fpsr; \ + __asm__ __volatile__ ("msr fpsr, %0" : : "r" (__fpsr)); \ + }) #endif /* Reserved bits should be preserved when modifying register diff --git a/sysdeps/aarch64/fpu/fraiseexcpt.c b/sysdeps/aarch64/fpu/fraiseexcpt.c index 8c674d47d8..1387949ed4 100644 --- a/sysdeps/aarch64/fpu/fraiseexcpt.c +++ b/sysdeps/aarch64/fpu/fraiseexcpt.c @@ -23,7 +23,7 @@ int __feraiseexcept (int excepts) { - int fpsr; + unsigned long int fpsr; const float fp_zero = 0.0; const float fp_one = 1.0; const float fp_max = FLT_MAX; diff --git a/sysdeps/aarch64/sfp-machine.h b/sysdeps/aarch64/sfp-machine.h index a9ecdbf961..b4b34e98e9 100644 --- a/sysdeps/aarch64/sfp-machine.h +++ b/sysdeps/aarch64/sfp-machine.h @@ -74,7 +74,7 @@ do { \ const float fp_1e32 = 1.0e32f; \ const float fp_zero = 0.0; \ const float fp_one = 1.0; \ - unsigned fpsr; \ + unsigned long int fpsr; \ if (_fex & FP_EX_INVALID) \ { \ __asm__ __volatile__ ("fdiv\ts0, %s0, %s0" \ diff --git a/sysdeps/unix/sysv/linux/aarch64/cpu-features.c b/sysdeps/unix/sysv/linux/aarch64/cpu-features.c index 0380f116de..7d5c2aea2c 100644 --- a/sysdeps/unix/sysv/linux/aarch64/cpu-features.c +++ b/sysdeps/unix/sysv/linux/aarch64/cpu-features.c @@ -86,7 +86,7 @@ init_cpu_features (struct cpu_features *cpu_features) cpu_features->midr_el1 = midr; /* Check if ZVA is enabled. */ - unsigned dczid; + uint64_t dczid; asm volatile ("mrs %0, dczid_el0" : "=r"(dczid)); if ((dczid & DCZID_DZP_MASK) == 0) diff --git a/sysdeps/unix/sysv/linux/aarch64/sysconf.c b/sysdeps/unix/sysv/linux/aarch64/sysconf.c index d0fbefa2e9..dcf6cbd68e 100644 --- a/sysdeps/unix/sysv/linux/aarch64/sysconf.c +++ b/sysdeps/unix/sysv/linux/aarch64/sysconf.c @@ -27,7 +27,7 @@ static long int linux_sysconf (int name); long int __sysconf (int name) { - unsigned ctr; + unsigned long int ctr; /* Unfortunately, the registers that contain the actual cache info (CCSIDR_EL1, CLIDR_EL1, and CSSELR_EL1) are protected by the Linux