This is an archive of the discontinued LLVM Phabricator instance.

[SPIRV] Fix OpConstant float and double printing
ClosedPublic

Authored by sudonatalie on Sep 1 2023, 12:51 PM.

Details

Summary

Print OpConstant floats as formatted decimal floating points, with
special case exceptions to print infinity and NaN as hexfloats.

This change follows from the fixes in
https://github.com/llvm/llvm-project/pull/66686 to correct how
constant values are printed generally.

Diff Detail

Event Timeline

sudonatalie created this revision.Sep 1 2023, 12:51 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 1 2023, 12:51 PM

math.h -> APFloat

sudonatalie published this revision for review.Sep 1 2023, 1:05 PM
sudonatalie added a reviewer: mpaszkowski.
Herald added a project: Restricted Project. · View Herald Transcript
mpaszkowski accepted this revision.Sep 7 2023, 1:22 PM

@sudonatalie Thank you for the patch! LGTM!

This revision is now accepted and ready to land.Sep 7 2023, 1:22 PM
sudonatalie planned changes to this revision.Sep 14 2023, 9:28 AM

This patch needs changes to interoperate correctly with the MCCodeEmitter (llc -filetype=obj) before landing.

Remove changes to lowering logic and get context from the instruction type rather than operand for printing

This revision is now accepted and ready to land.Sep 20 2023, 6:41 AM
sudonatalie retitled this revision from [SPIRV] Fix OpConstant float lowering and writing to [SPIRV] Fix OpConstant float and double printing.Sep 20 2023, 6:43 AM
sudonatalie edited the summary of this revision. (Show Details)
sudonatalie edited the summary of this revision. (Show Details)
sudonatalie requested review of this revision.Sep 20 2023, 6:53 AM

Requesting re-review since this patch has been substantially changed. There is no longer any change to ISel so the machine code accurately represents the number of operands in the SPIR-V, and it does not interfere with the behavior of the binary printer.

sudonatalie edited the summary of this revision. (Show Details)Sep 20 2023, 6:54 AM
Keenuts accepted this revision.Sep 20 2023, 8:16 AM

Thanks for fixing!

This revision is now accepted and ready to land.Sep 20 2023, 8:16 AM
This revision was automatically updated to reflect the committed changes.