-
Notifications
You must be signed in to change notification settings - Fork 17.8k
[SPIR-V] Support printing OpConstantF literals wider than 64 bits #208219
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| # RUN: llc -O0 -mtriple=spirv32-unknown-unknown -start-after=finalize-isel -verify-machineinstrs %s -o - | FileCheck %s | ||
|
|
||
| # Exercises the SPIRVInstPrinter's OpConstantF path for literals wider than | ||
| # 64 bits (e.g. fp128), independent of how the OpConstantF instruction with | ||
| # more than two literal words was produced. | ||
|
|
||
| --- | | ||
| define fp128 @getConstantFP128() { | ||
| ret fp128 0xL00000000000000004001000000000000 | ||
| } | ||
|
Comment on lines
+8
to
+10
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not write the test starting from the IR instead of the MIR ?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unfortunately, there is another issue: there is a miscompilation of fp128 constant literals. I decided to split them gotta be done in the following patch
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You may peek here: 0e27cc3 |
||
| ... | ||
| --- | ||
| name: getConstantFP128 | ||
| legalized: true | ||
| regBankSelected: true | ||
| selected: true | ||
| tracksRegLiveness: true | ||
| body: | | ||
| bb.1 (%ir-block.0): | ||
| %0:type = OpTypeFloat 128 | ||
| %1:fid = OpConstantF %0, 0, 0, 0, 1073807360 | ||
| %2:type = OpTypeFunction %0, %0 | ||
| %3:iid = OpFunction %0, 0, %2 | ||
| OpFunctionEnd | ||
| OpReturnValue %1 | ||
|
|
||
| # CHECK: %[[#FP128:]] = OpTypeFloat 128 | ||
| # CHECK: %[[#CST_FP128:]] = OpConstant %[[#FP128]] 4 | ||
| # CHECK: OpReturnValue %[[#CST_FP128]] | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can just check for
NumVarOps == 4. Any other case will hit theassert(TotalBits == 128 && "Unsupported floating-point literal width");anyways.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, thanks, done