Skip to content

Commit

Permalink
add FZ16 to fpcr_fz_mask for aarch64
Browse files Browse the repository at this point in the history
  • Loading branch information
vchuravy authored and johanmon committed Jul 5, 2021
1 parent b405709 commit 01eabc0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/processor_arm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1810,6 +1810,8 @@ extern "C" int jl_test_cpu_feature(jl_cpu_feature_t feature)
#ifdef _CPU_AARCH64_
// FPCR FZ, bit [24]
static constexpr uint32_t fpcr_fz_mask = 1 << 24;
// FPCR FZ16, bit [19]
static constexpr uint32_t fpcr_fz16_mask = 1 << 19;
// FPCR DN, bit [25]
static constexpr uint32_t fpcr_dn_mask = 1 << 25;

Expand All @@ -1833,7 +1835,8 @@ extern "C" JL_DLLEXPORT int32_t jl_get_zero_subnormals(void)
extern "C" JL_DLLEXPORT int32_t jl_set_zero_subnormals(int8_t isZero)
{
uint32_t fpcr = get_fpcr_aarch64();
fpcr = isZero ? (fpcr | fpcr_fz_mask) : (fpcr & ~fpcr_fz_mask);
static uint32_t mask = fpcr_fz_mask | (jl_test_cpu_feature(JL_AArch64_fullfp16) ? fpcr_fz16_mask : 0);
fpcr = isZero ? (fpcr | mask) : (fpcr & ~mask);
set_fpcr_aarch64(fpcr);
return 0;
}
Expand Down

0 comments on commit 01eabc0

Please sign in to comment.