-
Notifications
You must be signed in to change notification settings - Fork 13.4k
[MIPS] Opcode of mina.fmt and max.fmt in MIPS R6 are wrong #85608
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
Comments
@llvm/issue-subscribers-backend-mips Author: Cinhi Young (Cyanoxygen)
While proposing https://github.com//issues/64207#issuecomment-1989915063, I discovered that the opcode of two FPU compare instructions are documented wrong, and the mistake is present in LLVM code.
The opcode of {"max.d", "D,S,T", 0x4620001e, 0xffe0003f, WR_1|RD_2|RD_3|FP_D, 0, I37, 0, 0 },
{"mina.s", "D,S,T", 0x4600001d, 0xffe0003f, WR_1|RD_2|RD_3|FP_S, 0, I37, 0, 0 }, And the program misbehaves with code compiled by LLVM. owo:
min.s $f0, $f1, $f0
min.d $f0, $f1, $f0
max.s $f0, $f1, $f0
max.d $f0, $f1, $f0 Expected behavior
Actual behavior
NoteOptionally, we can match The fix is on its way. |
The PR has been merged. Let's close this bug report. |
While proposing #64207 (comment), I discovered that the opcode of two FPU compare instructions are documented wrong, and the mistake is present in LLVM code.
The opcode of
mina.fmt
andmax.fmt
should be swapped, according to binutils:And the program misbehaves with code compiled by LLVM.
Consider the following code which contains
min.fmt
andmax.fmt
:Expected behavior
gcc -o minmax-valid.o -c owo.s
objdump
of the code above should print the following encoding:Actual behavior
clang -o minmax-invalid.o -c owo.s
objdump
of the binary compiled from the code above with LLVM showedmina.fmt
instead ofmax.fmt
:Note
Optionally, we can match
@llvm.minnum.f{32,64}
and@llvm.maxnum.f{32,64}
to these instructions, as it behaves similar toUCOMISD
on x86, I suppose.The fix is on its way.
The text was updated successfully, but these errors were encountered: