Skip to content

Commit

Permalink
ircd::info: Fix leaf for avx2/avx512f; additional tsc related.
Browse files Browse the repository at this point in the history
  • Loading branch information
jevolk committed Mar 27, 2023
1 parent d4b3a0d commit ffecc8b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
2 changes: 1 addition & 1 deletion include/ircd/info.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ namespace ircd::info::hardware::x86
extern const string_view vendor;
extern const bool sse, sse2, sse3, ssse3, sse4a, sse4_1, sse4_2;
extern const bool avx, avx2, avx512f;
extern const bool tsc, tsc_constant;
extern const bool tsc, tsc_constant, tsc_nonstop;
}

namespace ircd::info::hardware::arm
Expand Down
25 changes: 19 additions & 6 deletions ircd/info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ ircd::info::dump_cpu_info_x86()
const auto append{[&support]
(const string_view &name, const bool &avail, const int &enable)
{
strlcat(support, fmt::bsprintf<64>
strlcat(support, fmt::bsprintf<32>
{
" %s:%c%s",
name,
Expand All @@ -193,7 +193,14 @@ ircd::info::dump_cpu_info_x86()
append("avx", hardware::x86::avx, simd::support::avx);
append("avx2", hardware::x86::avx2, simd::support::avx2);
append("avx512f", hardware::x86::avx512f, simd::support::avx512f);
append("constant_tsc", hardware::x86::tsc_constant, -1);

strlcat(support, fmt::bsprintf<32>
{
"%s%s%s",
hardware::x86::tsc? " tsc": "",
hardware::x86::tsc_constant? ":constant": "",
hardware::x86::tsc_nonstop? ":nonstop": "",
});

log::info
{
Expand Down Expand Up @@ -415,25 +422,31 @@ ircd::info::hardware::x86::avx
decltype(ircd::info::hardware::x86::avx2)
ircd::info::hardware::x86::avx2
{
bool(features & (uint128_t(1) << (32 + 5)))
bool(extended_features & (uint128_t(1) << (32 + 5)))
};

decltype(ircd::info::hardware::x86::avx512f)
ircd::info::hardware::x86::avx512f
{
bool(features & (uint128_t(1) << (32 + 16)))
bool(extended_features & (uint128_t(1) << (32 + 16)))
};

decltype(ircd::info::hardware::x86::tsc)
ircd::info::hardware::x86::tsc
{
bool(features & (uint128_t(1) << 4))
bool(features & (uint128_t(1) << (96 + 4)))
};

decltype(ircd::info::hardware::x86::tsc_constant)
ircd::info::hardware::x86::tsc_constant
{
bool(_apmi & (uint128_t(1) << (8)))
bool(_apmi & (uint128_t(1) << (96 + 8)))
};

decltype(ircd::info::hardware::x86::tsc_nonstop)
ircd::info::hardware::x86::tsc_nonstop
{
bool(_apmi & (uint128_t(1) << (96 + 24)))
};

#ifdef __x86_64__
Expand Down

0 comments on commit ffecc8b

Please sign in to comment.