Repository: microsoft/onnxruntime
File: onnxruntime/core/common/cpuid_info.cc (C++)

Code before:
        GetCPUID(7, data);
        const uint32_t max_SubLeaves = data[0];
        has_amx_bf16_ = (data[3] & (1 << 22));
        has_avx2_ = has_avx_ && (data[1] & (1 << 5));
        has_avx512f_ = has_avx512 && (data[1] & (1 << 16));
        // Add check for AVX512 Skylake since tensorization GEMM need intrinsics from avx512bw/avx512dq.
        // avx512_skylake = avx512f | avx512vl | avx512cd | avx512bw | avx512dq
        has_avx512_skylake_ = has_avx512 && (data[1] & ((1 << 16) | (1 << 17) | (1 << 28) | (1 << 30) | (1 << 31)));
        is_hybrid_ = (data[3] & (1 << 15));
        // Check for TPAUSE
        CheckIntelResult check_intel = CheckIntel();
        if (check_intel.is_intel) {
          if (data[2] & (1 << 5)) {
            has_tpause_ = true;
          } 
          else {
            has_tpause_ = false;
          }

          #ifdef __linux__
          if(__builtin_cpu_supports("waitpkg")) {
            has_tpause_ = true;
          } else {
            has_tpause_ = false;
          }
          #endif
        }
        if (max_SubLeaves >= 1) {
          GetCPUID(7, 1, data);
          has_avx512_bf16_ = has_avx512 && (data[0] & (1 << 5));
        }
      }
    }
  }
}

std::string CPUIDInfo::GetX86Vendor(int32_t* data) {
  char vendor[sizeof(int32_t) * 3 + 1]{};
  *reinterpret_cast<int*>(vendor + 0) = data[1];
  *reinterpret_cast<int*>(vendor + 4) = data[3];
  *reinterpret_cast<int*>(vendor + 8) = data[2];
  return vendor;
}

#endif  // defined(CPUIDINFO_ARCH_X86)

#if defined(CPUIDINFO_ARCH_ARM)

#if defined(__linux__)

void CPUIDInfo::ArmLinuxInit() {

Review comment (refactor):
the `#ifdef __linux__` part overwrites the previous value of `has_tpause_`. could we simplify it to this?

```suggestion
#ifdef __linux__
          has_tpause_ = __builtin_cpu_supports("waitpkg") != 0;
#else
          has_tpause_ = (data[2] & (1 << 5)) != 0;
#endif
```

Code after:
      if (num_IDs >= 7) {
        GetCPUID(7, data);
        const uint32_t max_SubLeaves = data[0];
        has_amx_bf16_ = (data[3] & (1 << 22));
        has_avx2_ = has_avx_ && (data[1] & (1 << 5));
        has_avx512f_ = has_avx512 && (data[1] & (1 << 16));
        // Add check for AVX512 Skylake since tensorization GEMM need intrinsics from avx512bw/avx512dq.
        // avx512_skylake = avx512f | avx512vl | avx512cd | avx512bw | avx512dq
        has_avx512_skylake_ = has_avx512 && (data[1] & ((1 << 16) | (1 << 17) | (1 << 28) | (1 << 30) | (1 << 31)));
        is_hybrid_ = (data[3] & (1 << 15));
        // Check for TPAUSE
        CheckIntelResult check_intel = CheckIntel();
        if (check_intel.is_intel) {
#ifdef __linux__
#if !defined(__ANDROID__)
          has_tpause_ = __builtin_cpu_supports("waitpkg") != 0;
#endif
#else
          has_tpause_ = (data[2] & (1 << 5)) != 0;
#endif
        }
        if (max_SubLeaves >= 1) {
          GetCPUID(7, 1, data);
          has_avx512_bf16_ = has_avx512 && (data[0] & (1 << 5));
        }
      }
    }
  }
}

std::string CPUIDInfo::GetX86Vendor(int32_t* data) {
  char vendor[sizeof(int32_t) * 3 + 1]{};
  *reinterpret_cast<int*>(vendor + 0) = data[1];
  *reinterpret_cast<int*>(vendor + 4) = data[3];
  *reinterpret_cast<int*>(vendor + 8) = data[2];
  return vendor;
}

#endif  // defined(CPUIDINFO_ARCH_X86)

uint32_t CPUIDInfo::GetVendorId(const std::string& vendor) {
  if (vendor == "GenuineIntel") return 0x8086;
  if (vendor == "GenuineAMD") return 0x1022;
  if (vendor.find("Qualcomm") == 0) return 'Q' | ('C' << 8) | ('O' << 16) | ('M' << 24);
  if (vendor.find("NV") == 0) return 0x10DE;
  return 0;
}

#if defined(CPUIDINFO_ARCH_ARM)

#if defined(__linux__)