#define foreach_x86_cpu_uarch \
_(0x06, 0x9e, "Kaby Lake", "Kaby Lake DT/H/S/X") \
_(0x06, 0x8e, "Kaby Lake", "Kaby Lake Y/U") \
+ _(0x06, 0x8c, "Tiger Lake", "Tiger Lake U") \
+ _(0x06, 0x86, "Tremont", "Elkhart Lake") \
_(0x06, 0x85, "Knights Mill", "Knights Mill") \
+ _(0x06, 0x7e, "Ice Lake", "Ice Lake U") \
+ _(0x06, 0x7d, "Ice Lake", "Ice Lake Y") \
+ _(0x06, 0x7a, "Goldmont Plus", "Gemini Lake") \
+ _(0x06, 0x6c, "Ice Lake", "Ice Lake SP") \
+ _(0x06, 0x6a, "Ice Lake", "Ice Lake DE") \
+ _(0x06, 0x66, "Cannon Lake", "Cannon Lake U") \
_(0x06, 0x5f, "Goldmont", "Denverton") \
_(0x06, 0x5e, "Skylake", "Skylake DT/H/S") \
_(0x06, 0x5c, "Goldmont", "Apollo Lake") \
static inline char const *
-flag_skip_prefix (char const *flag)
+flag_skip_prefix (char const *flag, const char *pfx, int len)
{
- if (memcmp (flag, "x86_", sizeof ("x86_") - 1) == 0)
- return flag + sizeof ("x86_") - 1;
- if (memcmp (flag, "aarch64_", sizeof ("aarch64_") - 1) == 0)
- return flag + sizeof ("aarch64_") - 1;
+ if (0 == strncmp (flag, pfx, len - 1))
+ return flag + len - 1;
return flag;
}
#if defined(__x86_64__)
#define _(flag, func, reg, bit) \
if (clib_cpu_supports_ ## flag()) \
- s = format (s, "%s ", flag_skip_prefix(#flag));
+ s = format (s, "%s ", flag_skip_prefix(#flag, "x86_", sizeof("x86_")));
foreach_x86_64_flags return s;
#undef _
#elif defined(__aarch64__)
#define _(flag, bit) \
if (clib_cpu_supports_ ## flag()) \
- s = format (s, "%s ", flag_skip_prefix(#flag));
+ s = format (s, "%s ", flag_skip_prefix(#flag, "aarch64_", sizeof("aarch64_")));
foreach_aarch64_flags return s;
#undef _
#else /* ! ! __x86_64__ && ! __aarch64__ */