Skip to content

[LA64_DYNAREC] fix COMISS/UCOMISS flags state handling#3631

Merged
ksco merged 1 commit intoptitSeb:mainfrom
yzewei:la_64_df_flags
Mar 9, 2026
Merged

[LA64_DYNAREC] fix COMISS/UCOMISS flags state handling#3631
ksco merged 1 commit intoptitSeb:mainfrom
yzewei:la_64_df_flags

Conversation

@yzewei
Copy link
Contributor

@yzewei yzewei commented Mar 9, 2026

The reason for canceling DF is that using SF_SET_DF in the 0F 2E/2F path of LA64 dynarec causes single-precision SVD results from scipy.linalg to be incorrect. The corresponding double-precision COMISD/UCOMISD (66 0F 2E/2F) uses the immediate flags path (SF_SET), so it does not have the same problem.

Reproduce code:
You will need an x86 Python program and the relevant packages (scipy && numpy) installed.

#pip3 install numpy scipy
./box64 python3 - <<'PY'  import numpy as np
from scipy.linalg.lapack import sgesvd
A = np.array([[1.,2.,3.],[4.,5.,6.],[7.,8.,10.]], dtype=np.float32, order='F')
u, s, vt, info = sgesvd(A, compute_uv=1, full_matrices=1, overwrite_a=0)
print(s, info)
PY                                               

I suspect that arm64 also has a similar problem.dynarec_arm64_0f.c

Signed-off-by: Zewei Yang <yangzewei@loongson.cn>
@ptitSeb ptitSeb requested a review from ksco March 9, 2026 08:18
@ksco ksco merged commit 9558d59 into ptitSeb:main Mar 9, 2026
30 checks passed
@yzewei yzewei deleted the la_64_df_flags branch March 9, 2026 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants