-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[LoongArch64] Fix code generation for type conversion from float/double to uint/ulong. #105783
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
Conversation
…le to uint/ulong.
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
|
@shushanhf Could you please review this change? |
|
If LA64 doesn't have native conversion instruction for fp<->unsigned, are the |
We just use some instructions embedded by the codegen to avoid calling helpers. |
|
Is there any JIT tests covering this? I can find |
|
shushanhf
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks
@jakobbotsch could you please review this PR?
|
@jakobbotsch could you please review this PR? |
|
/azp run runtime |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run runtime-dev-innerloop |
|
Azure Pipelines successfully started running 1 pipeline(s). |
The previous conversion from floating-point numbers to unsigned integers was incorrect in handling negative numbers and NaN.The previous instructions are as follows:
lu52i.d $r21, $zero, 1086movgr2fr.d $ft3, $r21fcmp.clt.d $fcc2, $fs0, $ft3fcmp.ceq.d $fcc3, $fs0, $ft3li.w $r21, 0x0bcnez $fcc2, 16fsub.d $ft3, $fs0, $ft3li.w $r21, 0x1slli.d $r21, $r21, 0x3ffsel $ft3, $ft3, $fs0, $fcc2ftintrz.l.d $ft3, $ft3movfr2gr.d $a0, $ft3bcnez $fcc3, 8beqz $a0, 8or $a0, $r21, $a0After modification, negative numbers and NaN are handled first.The modified instructions are as follows:
li.w $a0, 0x0movgr2fr.d $ft3, $zerofcmp.cult.d $fcc2, $fa0, $ft3bcnez $fcc2, 52lu52i.d $r21, $zero, 1086movgr2fr.d $ft3, $r21fcmp.clt.d $fcc2, $fa0, $ft3li.w $r21, 0x0bcnez $fcc2, 16fsub.d $ft3, $fa0, $ft3li.w $r21, 0x1slli.d $r21, $r21, 0x3ffsel $ft3, $ft3, $fa0, $fcc2ftintrz.l.d $ft3, $ft3movfr2gr.d $a0, $ft3or $a0, $r21, $a0