[PATCH] D98266: [AMDGPU] Refactor AMDGPUTargetStreamer::EmitCodeEnd
Jay Foad via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 9 11:02:38 PST 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG288ea820cf4a: [AMDGPU] Refactor AMDGPUTargetStreamer::EmitCodeEnd (authored by foad).
Changed prior to commit:
https://reviews.llvm.org/D98266?vs=329353&id=329404#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D98266/new/
https://reviews.llvm.org/D98266
Files:
llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp
Index: llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp
+++ llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp
@@ -264,15 +264,21 @@
const uint32_t Encoded_s_code_end = 0xbf9f0000;
const uint32_t Encoded_s_nop = 0xbf800000;
uint32_t Encoded_pad = Encoded_s_code_end;
- unsigned FillSize = 48;
+
+ // Instruction cache line size in bytes.
+ const unsigned Log2CacheLineSize = 6;
+ const unsigned CacheLineSize = 1u << Log2CacheLineSize;
+
+ // Extra padding amount in bytes to support prefetch mode 3.
+ unsigned FillSize = 3 * CacheLineSize;
if (AMDGPU::isGFX90A(STI)) {
Encoded_pad = Encoded_s_nop;
- FillSize = 256;
+ FillSize = 16 * CacheLineSize;
}
- OS << "\t.p2alignl 6, " << Encoded_pad << '\n';
- OS << "\t.fill " << FillSize << ", 4, " << Encoded_pad << '\n';
+ OS << "\t.p2alignl " << Log2CacheLineSize << ", " << Encoded_pad << '\n';
+ OS << "\t.fill " << (FillSize / 4) << ", 4, " << Encoded_pad << '\n';
return true;
}
@@ -641,17 +647,23 @@
const uint32_t Encoded_s_code_end = 0xbf9f0000;
const uint32_t Encoded_s_nop = 0xbf800000;
uint32_t Encoded_pad = Encoded_s_code_end;
- unsigned FillSize = 48;
+
+ // Instruction cache line size in bytes.
+ const unsigned Log2CacheLineSize = 6;
+ const unsigned CacheLineSize = 1u << Log2CacheLineSize;
+
+ // Extra padding amount in bytes to support prefetch mode 3.
+ unsigned FillSize = 3 * CacheLineSize;
if (AMDGPU::isGFX90A(STI)) {
Encoded_pad = Encoded_s_nop;
- FillSize = 256;
+ FillSize = 16 * CacheLineSize;
}
MCStreamer &OS = getStreamer();
OS.PushSection();
- OS.emitValueToAlignment(64, Encoded_pad, 4);
- for (unsigned I = 0; I < FillSize; ++I)
+ OS.emitValueToAlignment(CacheLineSize, Encoded_pad, 4);
+ for (unsigned I = 0; I < FillSize; I += 4)
OS.emitInt32(Encoded_pad);
OS.PopSection();
return true;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98266.329404.patch
Type: text/x-patch
Size: 2031 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210309/927d3fed/attachment.bin>
More information about the llvm-commits
mailing list