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

Possible bugs in fcvt.d.s #253

Closed
misterjdrg opened this issue Apr 30, 2022 · 8 comments
Closed

Possible bugs in fcvt.d.s #253

misterjdrg opened this issue Apr 30, 2022 · 8 comments

Comments

@misterjdrg
Copy link
Contributor

So, I looking onto generated assembly for fcvt.d.s and seeing this:

00000000800004ac <inst_0>:
    800004ac:   00083c87                fld     fs9,0(a6)
    800004b0:   00205073                fsrmi   zero,0
    800004b4:   420c86d3                fcvt.d.s        fa3,fs9
    800004b8:   001018f3                fsflags a7,zero
    800004bc:   00d7b027                fsd     fa3,0(a5)
    800004c0:   0117b423                sd      a7,8(a5)

fcvt.d.s is converting from f32 to f64.
So fs9 @800004b4 should contain 32bit float.
fld loading f64 into fs9
Maybe flw should be used?

@misterjdrg misterjdrg changed the title Possible bugs in D test macros v2 Possible bugs in fcvt.d.s Apr 30, 2022
@allenjbaum
Copy link
Collaborator

allenjbaum commented May 1, 2022 via email

@misterjdrg
Copy link
Contributor Author

misterjdrg commented May 1, 2022

This is RV64.
Values in tests doesn't look like 64bit floats and most results of convertion is NaN.


I trying to generate unit tests suite for my emulator, so
I patched spike to generate detailed traces of execution.
d_fcvt.d.s_b22-01.spike.reglog.txt

@allenjbaum
Copy link
Collaborator

allenjbaum commented May 2, 2022 via email

@misterjdrg
Copy link
Contributor Author

Form riscv spec:

When multiple floating-point precisions are supported, then valid values of narrower n-bit types,
n < FLEN, are represented in the lower n bits of an FLEN-bit NaN value, in a process termed
NaN-boxing. The upper bits of a valid NaN-boxed value must be all 1s.

So if 32 bit is properly boxed, all bits above 32-th should be 1
This is not the case

@allenjbaum
Copy link
Collaborator

allenjbaum commented May 2, 2022 via email

@misterjdrg
Copy link
Contributor Author

It true.
I mean fcvt.d.s doesn't have a single 'happy path' test, where 127-32 are ones.

@neelgala
Copy link
Collaborator

neelgala commented May 7, 2022

The issues mentioned here are already captured in this and this issue on isac and are being worked on.

@misterjdrg
Copy link
Contributor Author

Ok, thanks

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

3 participants