Skip to content

Commit 02249d5

Browse files
committed
add FZ16 to fpcr_fz_mask for aarch64
1 parent 2ec75d6 commit 02249d5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/processor_arm.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1810,6 +1810,8 @@ extern "C" int jl_test_cpu_feature(jl_cpu_feature_t feature)
18101810
#ifdef _CPU_AARCH64_
18111811
// FPCR FZ, bit [24]
18121812
static constexpr uint32_t fpcr_fz_mask = 1 << 24;
1813+
// FPCR FZ16, bit [19]
1814+
static constexpr uint32_t fpcr_fz16_mask = 1 << 19;
18131815
// FPCR DN, bit [25]
18141816
static constexpr uint32_t fpcr_dn_mask = 1 << 25;
18151817

@@ -1833,7 +1835,8 @@ extern "C" JL_DLLEXPORT int32_t jl_get_zero_subnormals(void)
18331835
extern "C" JL_DLLEXPORT int32_t jl_set_zero_subnormals(int8_t isZero)
18341836
{
18351837
uint32_t fpcr = get_fpcr_aarch64();
1836-
fpcr = isZero ? (fpcr | fpcr_fz_mask) : (fpcr & ~fpcr_fz_mask);
1838+
static uint32_t mask = fpcr_fz_mask | (jl_test_cpu_feature(JL_AArch64_fullfp16) ? fpcr_fz16_mask : 0);
1839+
fpcr = isZero ? (fpcr | mask) : (fpcr & ~mask);
18371840
set_fpcr_aarch64(fpcr);
18381841
return 0;
18391842
}

0 commit comments

Comments
 (0)