public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-4793] arm: correctly define __ARM_FEATURE_CLZ
@ 2022-12-19 15:04 Richard Earnshaw
  0 siblings, 0 replies; only message in thread
From: Richard Earnshaw @ 2022-12-19 15:04 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:aa510619f8b650322c113d8593dd57afe6c6f9ae

commit r13-4793-gaa510619f8b650322c113d8593dd57afe6c6f9ae
Author: Richard Earnshaw <rearnsha@arm.com>
Date:   Mon Dec 19 15:01:49 2022 +0000

    arm: correctly define __ARM_FEATURE_CLZ
    
    The ACLE requires that __ARM_FEATURE_CLZ be defined if the hardware
    supports it; it's also clear that this doesn't mean the current ISA,
    so we must define this even when compiling for Thumb1 if the target
    supports CLZ in A32.
    
    This brings GCC into alignment with Clang.
    
    gcc/ChangeLog:
    
            * config/arm/arm-c.cc (__ARM_FEATURE_CLZ): Fix definition of
            preprocessor macro when target has CLZ in another ISA.

Diff:
---
 gcc/config/arm/arm-c.cc | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/gcc/config/arm/arm-c.cc b/gcc/config/arm/arm-c.cc
index 86c56bf2680..202898fa041 100644
--- a/gcc/config/arm/arm-c.cc
+++ b/gcc/config/arm/arm-c.cc
@@ -238,8 +238,12 @@ arm_cpu_builtins (struct cpp_reader* pfile)
     builtin_define_with_int_value ("__ARM_FEATURE_LDREX",
 				   TARGET_ARM_FEATURE_LDREX);
 
+  /* ACLE says that __ARM_FEATURE_CLZ is defined if the hardware
+     supports it; it's also clear that this doesn't mean the current
+     ISA, so we define this even when compiling for Thumb1 if the
+     target supports CLZ in A32.  */
   def_or_undef_macro (pfile, "__ARM_FEATURE_CLZ",
-		      ((TARGET_ARM_ARCH >= 5 && !TARGET_THUMB)
+		      ((TARGET_ARM_ARCH >= 5 && arm_arch_notm)
 		       || TARGET_ARM_ARCH_ISA_THUMB >=2));
 
   def_or_undef_macro (pfile, "__ARM_FEATURE_NUMERIC_MAXMIN",

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-12-19 15:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-19 15:04 [gcc r13-4793] arm: correctly define __ARM_FEATURE_CLZ Richard Earnshaw

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).