]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
arm: correctly define __ARM_FEATURE_CLZ
authorRichard Earnshaw <rearnsha@arm.com>
Mon, 19 Dec 2022 15:01:49 +0000 (15:01 +0000)
committerRichard Earnshaw <rearnsha@arm.com>
Mon, 19 Dec 2022 15:03:30 +0000 (15:03 +0000)
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.

gcc/config/arm/arm-c.cc

index 86c56bf26800e273a8b244ff68299db1ea16f43e..202898fa04185e839a2f530a9222a9ae41468976 100644 (file)
@@ -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",