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

Floating-Point Conversion ( fcvt.d.s) #90

Closed
ProfPierce opened this issue Sep 7, 2020 · 3 comments
Closed

Floating-Point Conversion ( fcvt.d.s) #90

ProfPierce opened this issue Sep 7, 2020 · 3 comments

Comments

@ProfPierce
Copy link

Error message on the following instruction: fcvt.d.s ft2, ft1, dyn

Error in test.asm line 31 column 12: "ft2": operand is of incorrect type

The help documentation states the following: fcvt.d.s t1, f1, dyn Convert a float to a double: Assigned the value of f2 to f1
(note register t1 is referenced in the format but f2 is stated in the description.)

Specification description: "The double-precision to single-precision and single-precision to double-precision conversion instructions, FCVT.S.D and FCVT.D.S, are encoded in the OP-FP major opcode space and both the source and destination are floating-point registers."

It seems the implementation of the instruction in RARS is attempting a floating to integer conversion where it should be a floating precision conversion from single-precision to double-precision.

@TheThirdOne
Copy link
Owner

Thanks for the issue. The instruction should be taking a floating point argument. This is just a simple typo; the logic of the FCVT.D.S instruction is the correct logic. FCVT.S.D is broken in the same way.

I thought these were both tested, but it seems that the FCVT.D.S psuedo-instruction can convert floating point to integer registers so the tests didn't fail to assemble.

This is very easy to fix; only the example format and description for each instruction have to be changed. I am probably going to handle this issue and a few others tomorrow as a batch.

TheThirdOne added a commit that referenced this issue Sep 8, 2020
Issue #90 brought this to my attention. Interestingly the psuedo-instruction system convered this up.
TheThirdOne added a commit that referenced this issue Sep 8, 2020
…ound to nearest even

I found this bug while fixing #90 and saw the operands[3] on an instruction with only 3 arguments.

I also started up a debugger to check if I had made this mistake elsewhere. I checked all
calls to Floating.getRoundingMode called by the tests and none of them incorrectly use RNE.
If another instruction is borked, the operand count is too low rather than too high.

While debugging, I found that the toString method of ProgramStatement is completely borked.
@TheThirdOne
Copy link
Owner

This should be fixed now. Let me know if it is fixed for you in the continuous build.

I found a separate issue with fcvt.s.d by fixing this so this issue helped doubly.

@ProfPierce
Copy link
Author

ProfPierce commented Sep 9, 2020 via email

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

No branches or pull requests

2 participants