[llvm] [NVPTX] Basic support for fp128 as a storage type (PR #136006)
Artem Belevich via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 16 12:30:23 PDT 2025
================
@@ -1716,6 +1715,7 @@ void NVPTXAsmPrinter::bufferAggregateConstant(const Constant *CPV,
if (CPV->getNumOperands()) {
StructType *ST = cast<StructType>(CPV->getType());
for (unsigned i = 0, e = CPV->getNumOperands(); i != e; ++i) {
+ int Bytes;
if (i == (e - 1))
Bytes = DL.getStructLayout(ST)->getElementOffset(0) +
DL.getTypeAllocSize(ST) -
----------------
Artem-B wrote:
<!--__GRAPHITE_HTML_TAG_START__--><p class='graphite__hidden'><i>[Re: lines +1717 to +1727]</i></p><!--__GRAPHITE_HTML_TAG_END__-->
This could be made a bit more readable.
```
for (int i : llvm::seq(CPV->getNumOperands())) {
int EndOffset = (i+1 == CPV->getNumOperands())
? DL.getStructLayout(ST)->getElementOffset(0) + DL.getTypeAllocSize(ST)
: DL.getStructLayout(ST)->getElementOffset(i + 1)
int Bytes = end_offset - DL.getStructLayout(ST)->getElementOffset(i);
bufferLEByte(cast<Constant>(CPV->getOperand(i)), Bytes, aggBuffer);
}
```
<!--__GRAPHITE_HTML_TAG_START__--><p class='graphite__hidden'>See this comment inline on <a href="https://app.graphite.dev/github/pr/llvm/llvm-project/136006?utm_source=unchanged-line-comment">Graphite</a>.</p><!--__GRAPHITE_HTML_TAG_END__-->
https://github.com/llvm/llvm-project/pull/136006
More information about the llvm-commits
mailing list