mirror of
https://github.com/google/cpu_features.git
synced 2025-04-28 07:23:37 +02:00
parent
6984510879
commit
9917e8481e
@ -50,16 +50,9 @@ CPU_FEATURES_START_CPP_NAMESPACE
|
||||
#define ARM_HWCAP2_CRC32 (1UL << 4)
|
||||
|
||||
// http://elixir.free-electrons.com/linux/latest/source/arch/mips/include/uapi/asm/hwcap.h
|
||||
#define MIPS_HWCAP_VZ (1UL << 0)
|
||||
#define MIPS_HWCAP_EVA (1UL << 1)
|
||||
#define MIPS_HWCAP_HTW (1UL << 2)
|
||||
#define MIPS_HWCAP_FPU (1UL << 3)
|
||||
#define MIPS_HWCAP_MIPS32R2 (1UL << 4)
|
||||
#define MIPS_HWCAP_MIPS32R5 (1UL << 5)
|
||||
#define MIPS_HWCAP_MIPS64R6 (1UL << 6)
|
||||
#define MIPS_HWCAP_DSPR1 (1UL << 7)
|
||||
#define MIPS_HWCAP_DSPR2 (1UL << 8)
|
||||
#define MIPS_HWCAP_MSA (1UL << 9)
|
||||
#define MIPS_HWCAP_R6 (1UL << 0)
|
||||
#define MIPS_HWCAP_MSA (1UL << 1)
|
||||
#define MIPS_HWCAP_CRC32 (1UL << 2)
|
||||
|
||||
// http://elixir.free-electrons.com/linux/latest/source/arch/powerpc/include/uapi/asm/cputable.h
|
||||
#ifndef _UAPI__ASM_POWERPC_CPUTABLE_H
|
||||
|
@ -24,7 +24,7 @@ DECLARE_SETTER(MipsFeatures, eva)
|
||||
|
||||
static const CapabilityConfig kConfigs[] = {
|
||||
{{MIPS_HWCAP_MSA, 0}, "msa", &set_msa}, //
|
||||
{{MIPS_HWCAP_EVA, 0}, "eva", &set_eva}, //
|
||||
{{0, 0}, "eva", &set_eva}, //
|
||||
};
|
||||
static const size_t kConfigsSize = sizeof(kConfigs) / sizeof(CapabilityConfig);
|
||||
|
||||
|
@ -28,12 +28,13 @@ void CpuFeatures_SetFromFlags(const size_t configs_size,
|
||||
}
|
||||
|
||||
static bool IsSet(const uint32_t mask, const uint32_t value) {
|
||||
if (mask == 0) return false;
|
||||
return (value & mask) == mask;
|
||||
}
|
||||
|
||||
static bool IsHwCapsSet(const HardwareCapabilities hwcaps_mask,
|
||||
const HardwareCapabilities hwcaps) {
|
||||
return IsSet(hwcaps_mask.hwcaps, hwcaps.hwcaps) &&
|
||||
return IsSet(hwcaps_mask.hwcaps, hwcaps.hwcaps) ||
|
||||
IsSet(hwcaps_mask.hwcaps2, hwcaps.hwcaps2);
|
||||
}
|
||||
|
||||
|
@ -26,14 +26,6 @@ namespace {
|
||||
|
||||
void DisableHardwareCapabilities() { SetHardwareCapabilities(0, 0); }
|
||||
|
||||
TEST(CpuinfoMipsTest, FromHardwareCapBoth) {
|
||||
SetHardwareCapabilities(MIPS_HWCAP_EVA | MIPS_HWCAP_MSA, 0);
|
||||
GetEmptyFilesystem(); // disabling /proc/cpuinfo
|
||||
const auto info = GetMipsInfo();
|
||||
EXPECT_TRUE(info.features.msa);
|
||||
EXPECT_TRUE(info.features.eva);
|
||||
}
|
||||
|
||||
TEST(CpuinfoMipsTest, FromHardwareCapOnlyOne) {
|
||||
SetHardwareCapabilities(MIPS_HWCAP_MSA, 0);
|
||||
GetEmptyFilesystem(); // disabling /proc/cpuinfo
|
||||
|
Loading…
x
Reference in New Issue
Block a user