PATCH [5/10] arm: Extend again arm_feature_set struct to provide more bits
authorAndrea Corallo <andrea.corallo@arm.com>
Thu, 3 Jun 2021 14:48:05 +0000 (16:48 +0200)
committerAndrea Corallo <andrea.corallo@arm.com>
Mon, 26 Jul 2021 12:18:24 +0000 (14:18 +0200)
include/
2021-06-11  Andrea Corallo  <andrea.corallo@arm.com>

* opcode/arm.h (arm_feature_set): Extend 'core' field.
(ARM_CPU_HAS_FEATURE, ARM_FSET_CPU_SUBSET, ARM_CPU_IS_ANY)
(ARM_MERGE_FEATURE_SETS, ARM_CLEAR_FEATURE, ARM_FEATURE_EQUAL)
(ARM_FEATURE_ZERO, ARM_FEATURE_CORE_EQUAL): Account for
'core[2]'.
(ARM_FEATURE_CORE_HIGH_HIGH): New macro.

include/opcode/arm.h

index 90c09a70658007b0c9027850338119ccc466dbd1..1152e78122251c86be5d04f27f9168e8590e4736 100644 (file)
    and use macro ARM_FEATURE to initialize the feature set variable.  */
 typedef struct
 {
-  unsigned long core[2];
+  unsigned long core[3];
   unsigned long coproc;
 } arm_feature_set;
 
@@ -435,23 +435,27 @@ typedef struct
 #define ARM_CPU_HAS_FEATURE(CPU,FEAT) \
   (((CPU).core[0] & (FEAT).core[0]) != 0 \
    || ((CPU).core[1] & (FEAT).core[1]) != 0 \
+   || ((CPU).core[2] & (FEAT).core[2]) != 0 \
    || ((CPU).coproc & (FEAT).coproc) != 0)
 
 /* Tests whether the features of A are a subset of B.  */
 #define ARM_FSET_CPU_SUBSET(A,B) \
   (((A).core[0] & (B).core[0]) == (A).core[0] \
    && ((A).core[1] & (B).core[1]) == (A).core[1] \
+   && ((A).core[2] & (B).core[2]) == (A).core[2] \
    && ((A).coproc & (B).coproc) == (A).coproc)
 
 #define ARM_CPU_IS_ANY(CPU) \
   ((CPU).core[0] == ((arm_feature_set)ARM_ANY).core[0] \
-   && (CPU).core[1] == ((arm_feature_set)ARM_ANY).core[1])
+   && (CPU).core[1] == ((arm_feature_set)ARM_ANY).core[1] \
+   && (CPU).core[2] == ((arm_feature_set)ARM_ANY).core[2])
 
 #define ARM_MERGE_FEATURE_SETS(TARG,F1,F2)             \
   do                                                   \
     {                                                  \
       (TARG).core[0] = (F1).core[0] | (F2).core[0];    \
       (TARG).core[1] = (F1).core[1] | (F2).core[1];    \
+      (TARG).core[2] = (F1).core[2] | (F2).core[2];    \
       (TARG).coproc = (F1).coproc | (F2).coproc;       \
     }                                                  \
   while (0)
@@ -461,6 +465,7 @@ typedef struct
     {                                                  \
       (TARG).core[0] = (F1).core[0] &~ (F2).core[0];   \
       (TARG).core[1] = (F1).core[1] &~ (F2).core[1];   \
+      (TARG).core[2] = (F1).core[2] &~ (F2).core[2];   \
       (TARG).coproc = (F1).coproc &~ (F2).coproc;      \
     }                                                  \
   while (0)
@@ -468,17 +473,24 @@ typedef struct
 #define ARM_FEATURE_EQUAL(T1,T2)               \
   (   (T1).core[0] == (T2).core[0]             \
    && (T1).core[1] == (T2).core[1]             \
+   && (T1).core[2] == (T2).core[2]             \
    && (T1).coproc  == (T2).coproc)
 
 #define ARM_FEATURE_ZERO(T)                    \
-  ((T).core[0] == 0 && (T).core[1] == 0 && (T).coproc == 0)
+  ((T).core[0] == 0                            \
+   && (T).core[1] == 0                         \
+   && (T).core[2] == 0                         \
+   && (T).coproc == 0)
 
 #define ARM_FEATURE_CORE_EQUAL(T1, T2)         \
-  ((T1).core[0] == (T2).core[0] && (T1).core[1] == (T2).core[1])
+  ((T1).core[0] == (T2).core[0]                        \
+   && (T1).core[1] == (T2).core[1]             \
+   && (T1).core[2] == (T2).core[2])
 
 #define ARM_FEATURE_LOW(core, coproc) {{(core), 0}, (coproc)}
 #define ARM_FEATURE_CORE(core1, core2) {{(core1), (core2)}, 0}
 #define ARM_FEATURE_CORE_LOW(core) {{(core), 0}, 0}
 #define ARM_FEATURE_CORE_HIGH(core) {{0, (core)}, 0}
+#define ARM_FEATURE_CORE_HIGH_HIGH(core) {{0, 0, (core)}, 0}
 #define ARM_FEATURE_COPROC(coproc) {{0, 0}, (coproc)}
 #define ARM_FEATURE(core1, core2, coproc) {{(core1), (core2)}, (coproc)}