Repository: microsoft/onnxruntime
File: onnxruntime/core/platform/check_intel.cc (C++)

Code before:
  bool is_intel_specified_platform = false;
  constexpr unsigned int kVendorID_Intel[] = {0x756e6547, 0x6c65746e, 0x49656e69};  // "GenuntelineI"

#if defined(_WIN32)
  constexpr unsigned int kVendorID_IntelSpecifiedPlatformIDs[] = {
      // ExtendedModel, ExtendedFamily, Family Code, and Model Number
      0xa06a,  // MTL
      0xc065,  // ARL-H
      0xb065   // ARL-U
  };

  int regs_leaf0[4];
  int regs_leaf1[4];
  __cpuid(regs_leaf0, 0);
  __cpuid(regs_leaf1, 0x1);

  is_intel =
      (kVendorID_Intel[0] == regs_leaf0[1]) &&
      (kVendorID_Intel[1] == regs_leaf0[2]) &&
      (kVendorID_Intel[2] == regs_leaf0[3]);

  if (!is_intel) {
    return intel_check;  // if not an Intel CPU, return early
  }

  for (int intelSpecifiedPlatform : kVendorID_IntelSpecifiedPlatformIDs) {
    if ((regs_leaf1[0] >> 4) == intelSpecifiedPlatform) {
      is_intel_specified_platform = true;
    }
  }


#elif defined(__linux__)
  unsigned int regs[4] = {0};
  __get_cpuid(0, &regs[0], &regs[1], &regs[2], &regs[3]);

  is_intel = (regs[1] == kVendorID_Intel[0] &&
                   regs[2] == kVendorID_Intel[1] &&
                   regs[3] == kVendorID_Intel[2]);
  if (!is_intel) {
    return intel_check;  // if not an Intel CPU, return early
  }

  __get_cpuid(1, &regs[0], &regs[1], &regs[2], &regs[3]);

  unsigned int base_family = (regs[0] >> 8) & 0xF;
  unsigned int base_model = (regs[0] >> 4) & 0xF;
  unsigned int extended_model = (regs[0] >> 16) & 0xF;

  unsigned int model =
      (base_family == 0x6 || base_family == 0xF)

Review comment (suggestion):
nit: `kVendorID_IntelSpecifiedPlatformIDs` is an `unsigned int[]`
```suggestion
  for (auto intelSpecifiedPlatform : kVendorID_IntelSpecifiedPlatformIDs) {
```

Code after:
  CheckIntelResult intel_check = {false, false};
  bool is_intel = false;
  bool is_intel_specified_platform = false;

#if (defined(_M_AMD64) || defined(__x86_64__))
#if defined(_WIN32)
  constexpr unsigned int kVendorID_Intel[] = {0x756e6547, 0x6c65746e, 0x49656e69};  // "GenuntelineI"
  constexpr unsigned int kVendorID_IntelSpecifiedPlatformIDs[] = {
      // ExtendedModel, ExtendedFamily, Family Code, and Model Number
      0xa06a,  // MTL
      0xc065,  // ARL-H
      0xb065   // ARL-U
  };

  int regs_leaf0[4];
  int regs_leaf1[4];
  __cpuid(regs_leaf0, 0);
  __cpuid(regs_leaf1, 0x1);

  is_intel =
      (kVendorID_Intel[0] == static_cast<unsigned int>(regs_leaf0[1])) &&
      (kVendorID_Intel[1] == static_cast<unsigned int>(regs_leaf0[2])) &&
      (kVendorID_Intel[2] == static_cast<unsigned int>(regs_leaf0[3]));

  if (!is_intel) {
    return intel_check;  // if not an Intel CPU, return early
  }

  for (auto intel_specified_platform : kVendorID_IntelSpecifiedPlatformIDs) {
    if ((static_cast<unsigned int>(regs_leaf1[0]) >> 4) == intel_specified_platform) {
      is_intel_specified_platform = true;
      break;
    }
  }

#elif defined(__linux__)
  constexpr unsigned int kVendorID_Intel[] = {0x756e6547, 0x6c65746e, 0x49656e69};  // "GenuntelineI"
  unsigned int regs[4] = {0};
  __get_cpuid(0, &regs[0], &regs[1], &regs[2], &regs[3]);

  is_intel = (regs[1] == kVendorID_Intel[0] &&
              regs[2] == kVendorID_Intel[1] &&
              regs[3] == kVendorID_Intel[2]);
  if (!is_intel) {
    return intel_check;  // if not an Intel CPU, return early
  }

  __get_cpuid(1, &regs[0], &regs[1], &regs[2], &regs[3]);

  unsigned int base_family = (regs[0] >> 8) & 0xF;
  unsigned int base_model = (regs[0] >> 4) & 0xF;