Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update x64emu.c #507

Merged
merged 1 commit into from
Feb 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/emu/x64emu.c
Original file line number Diff line number Diff line change
Expand Up @@ -518,10 +518,19 @@ void applyFlushTo0(x64emu_t* emu)
#ifdef __x86_64__
_mm_setcsr(_mm_getcsr() | (emu->mxcsr.x32&0x8040));
#elif defined(__aarch64__)
#ifdef __ANDROID__
uint64_t fpcr;
__asm__ __volatile__ ("mrs %0, fpcr":"=r"(fpcr));
#else
uint64_t fpcr = __builtin_aarch64_get_fpcr();
#endif
fpcr &= ~((1<<24) | (1<<1)); // clear bit FZ (24) and AH (1)
fpcr |= (emu->mxcsr.f.MXCSR_FZ)<<24; // set FZ as mxcsr FZ
fpcr |= ((emu->mxcsr.f.MXCSR_DAZ)^(emu->mxcsr.f.MXCSR_FZ))<<1; // set AH if DAZ different from FZ
#ifdef __ANDROID__
__asm__ __volatile__ ("msr fpcr, %0"::"r"(fpcr));
#else
__builtin_aarch64_set_fpcr(fpcr);
#endif
}
#endif
}