You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
maximum:If one of the arguments is NaN, then NaN is returned. Otherwise this returns the greater of the two numbers. -0.0 is considered to be less than +0.0.
IEEE float 2019有一个函数叫maximum,LLVM里没有LoongArch的原生的实现,但是有一份通用的实现,和一份riscv的实现,那么哪一种实现更好呢?
https://llvm.org/docs/LangRef.html#llvm-min-intrinsics-comparation
llvm/llvm-project#64208
maximum:If one of the arguments is NaN, then NaN is returned. Otherwise this returns the greater of the two numbers. -0.0 is considered to be less than +0.0.
LLVM通用代码
Source: llvm/llvm-project@4a8f2f2
目前LLVM Intrinsics 在 LoongArch会生成如下指令
伪代码
这个方法有两个缺陷
但在这个Fallback提交之前,RISC-V有一个无需rodata的实现
RISC-V代码
Source: llvm/llvm-project@4942978
RISC-V的指令
LLVM IR表示
LoongArch指令
为什么这里调用了三次fmax? 如果只需要调用一次,那么这个实现更短。即使要调用三次,这个实现也不需要rodata。
The text was updated successfully, but these errors were encountered: