7

Document floating point directive and generic way to to load a floating point im...

 11 months ago
source link: https://github.com/riscv-non-isa/riscv-asm-manual/pull/86
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Document floating point directive and generic way to to load a floating point immediate to floating point register #86

Merged

kito-cheng merged 4 commits into

master

from

float-stuffs

Jun 6, 2023

Conversation

Collaborator

Split from #85, this PR only contain non-zfa part.

Contain two things:

  1. .float and .double
  2. Generic way to to load a floating point immediate to floating point register via load from memeory.

Collaborator

Author

Collaborator

Author

Changes:

  • Add new section: Floating-point literals

Contributor

asb

commented

May 19, 2023

edited

I think we risk veering into becoming a general assembly guide which might be more of a burden than we want to take on, but documenting .float and .double seems handy. I wonder a bit about "The Assembler supports the same floating point literal formats as those defined in the C and C++ standards" - fine for gas and LLVM as and any other assembler wanting to consume the same input, but not necessarily true of any arbitrary assembler. Perhaps this document needs a "Scope" section that says something like "This document aims to provide guidance to assembly programmers targeting common open source RISC-V assemblers such as GNU as and LLVM's assembler. Other assemblers might not support the same directives or pseudoinstructions."

Collaborator

Author

Thanks, although one of my ultimate goal is make this document become RISC-V standard Assembly manual, but archive that apparently need much more effort than I/we can pay, so limit the scope for this document is sound good idea, let me create PR in my next workday :)

Collaborator

Author

Add #89, @asb did you have any further concern about this PR?

Contributor

With #89 in place this is looking pretty good to me, but given you only document .float and .double perhaps it doesn't make sense to list flh and flq (or to instead give guidance on using .2byte/.8byte or similar with the bit pattern of the encoded FP value.

riscv-asm.md

Outdated

point immediate value. Instead, a programmer can use the `.float`/`.double`

directive to declare a floating point immediate value in the source code, and

then load it into a floating point register using the load global

pseudoinstruction (`fl{h|s|d|q}`).

Same comment as @asb : you only mention the .float and .double directives; what should I use in the FP16 and FP128 cases? Note that .quad is already used by GAS. Maybe .float{16,32,64,128} would be a more scalable approach?

Collaborator

Author

Oh, the reason I document .float and .double here is because .float16 is not supported by clang, and .float128 are not supported for both clang and binutils...

.quad is supported by both, I think I should add that to doc.

Collaborator

Author

My thought is we should add .float{16,32,64,128} and .bfloat16 in future, but anyway it out of scope of this PR, let me finish fli stuff first.

Collaborator

Author

Changes:

  • Fix fls -> flw
  • Add .quad for 128 bit floating point

Collaborator

Author

@aswaterman thanks bro :)

aswaterman reacted with heart emoji

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

nick-knight

nick-knight left review comments

aswaterman

aswaterman approved these changes

cmuellner

Awaiting requested review from cmuellner
Assignees

No one assigned

Labels
None yet
Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

None yet

4 participants

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK