Skip to content

Commit 1de2d3c

Browse files
Wunkolokawakami-k
authored andcommitted
Add jscvt detection
1 parent f9b03ff commit 1de2d3c

File tree

5 files changed

+13
-0
lines changed

5 files changed

+13
-0
lines changed

sample/cpuinfo.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ int main() {
4040
printf("bf16 ");
4141
if (cpu.has(XBYAK_AARCH64_HWCAP_CRC))
4242
printf("crc ");
43+
if (cpu.has(XBYAK_AARCH64_HWCAP_JSCVT))
44+
printf("jscvt ");
4345
printf("\n");
4446
printf("# of CPU cores: %d\n", cpu.getNumCores(CoreLevel));
4547

src/util_impl_linux.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,8 @@ class CpuInfoLinux : public CpuInfo {
403403
type_ |= (Type)XBYAK_AARCH64_HWCAP_ADVSIMD;
404404
if (hwcap & HWCAP_CRC32)
405405
type_ |= (Type)XBYAK_AARCH64_HWCAP_CRC;
406+
if (hwcap & HWCAP_JSCVT)
407+
type_ |= (Type)XBYAK_AARCH64_HWCAP_JSCVT;
406408

407409
#ifdef AT_HWCAP2
408410
const unsigned long hwcap2 = getauxval(AT_HWCAP2);

src/util_impl_mac.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ constexpr char hw_opt_atomics[] = "hw.optional.armv8_1_atomics";
3939
constexpr char hw_opt_fp[] = "hw.optional.floatingpoint";
4040
constexpr char hw_opt_neon[] = "hw.optional.neon";
4141
constexpr char hw_opt_crc[] = "hw.optional.armv8_crc32";
42+
constexpr char hw_opt_jscvt[] = "hw.optional.FEAT_JSCVT";
4243
constexpr char hw_perflevel1_logicalcpu[] = "hw.perflevel1.logicalcpu";
4344

4445
class CpuInfoMac : public CpuInfo {
@@ -122,6 +123,11 @@ class CpuInfoMac : public CpuInfo {
122123
throw Error(ERR_INTERNAL);
123124
else
124125
type_ |= (val == 1) ? (Type)XBYAK_AARCH64_HWCAP_CRC : 0;
126+
127+
if (sysctlbyname(hw_opt_jscvt, &val, &len, NULL, 0) != 0)
128+
throw Error(ERR_INTERNAL);
129+
else
130+
type_ |= (val == 1) ? (Type)XBYAK_AARCH64_HWCAP_JSCVT : 0;
125131
}
126132

127133
void setNumCores() {

src/util_impl_windows.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ class CpuInfoWindows : public CpuInfo {
107107
type_ |= (Type)XBYAK_AARCH64_HWCAP_ATOMIC;
108108
if (IsProcessorFeaturePresent(PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE))
109109
type_ |= (Type)XBYAK_AARCH64_HWCAP_CRC;
110+
if (IsProcessorFeaturePresent(PF_ARM_V83_JSCVT_INSTRUCTIONS_AVAILABLE))
111+
type_ |= (Type)XBYAK_AARCH64_HWCAP_JSCVT;
110112
}
111113
};
112114

xbyak_aarch64/xbyak_aarch64_util.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ enum hwCap_t {
6464
XBYAK_AARCH64_HWCAP_ATOMIC = 1 << 4,
6565
XBYAK_AARCH64_HWCAP_BF16 = 1 << 5,
6666
XBYAK_AARCH64_HWCAP_CRC = 1 << 6,
67+
XBYAK_AARCH64_HWCAP_JSCVT = 1 << 7,
6768
};
6869

6970
struct implementer_t {

0 commit comments

Comments
 (0)