llvm.org GIT mirror llvm / b23b0ff
[X86] Create mergeable constant pool entries for AVX We supported creating mergeable constant pool entries for smaller constants but not for 32-byte AVX constants. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261584 91177308-0d34-0410-b5e6-96231b3b80d8 David Majnemer 4 years ago
9 changed file(s) with 55 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
158158 MCSection *MergeableConst4Section;
159159 MCSection *MergeableConst8Section;
160160 MCSection *MergeableConst16Section;
161 MCSection *MergeableConst32Section;
161162
162163 // MachO specific sections.
163164
297298 const MCSection *getMergeableConst16Section() const {
298299 return MergeableConst16Section;
299300 }
301 const MCSection *getMergeableConst32Section() const {
302 return MergeableConst32Section;
303 }
300304
301305 // MachO specific sections.
302306 const MCSection *getTLSTLVSection() const { return TLSTLVSection; }
6262 /// for example, vectors.
6363 MergeableConst16,
6464
65 /// MergeableConst32 - This is a section used by 32-byte constants,
66 /// for example, vectors.
67 MergeableConst32,
68
6569 /// Writeable - This is the base of all segments that need to be written
6670 /// to during program runtime.
6771
124128
125129 bool isMergeableConst() const {
126130 return K == MergeableConst4 || K == MergeableConst8 ||
127 K == MergeableConst16;
131 K == MergeableConst16 || K == MergeableConst32;
128132 }
129133 bool isMergeableConst4() const { return K == MergeableConst4; }
130134 bool isMergeableConst8() const { return K == MergeableConst8; }
131135 bool isMergeableConst16() const { return K == MergeableConst16; }
136 bool isMergeableConst32() const { return K == MergeableConst32; }
132137
133138 bool isWriteable() const {
134139 return isThreadLocal() || isGlobalWriteableData();
179184 static SectionKind getMergeableConst4() { return get(MergeableConst4); }
180185 static SectionKind getMergeableConst8() { return get(MergeableConst8); }
181186 static SectionKind getMergeableConst16() { return get(MergeableConst16); }
187 static SectionKind getMergeableConst32() { return get(MergeableConst32); }
182188 static SectionKind getThreadBSS() { return get(ThreadBSS); }
183189 static SectionKind getThreadData() { return get(ThreadData); }
184190 static SectionKind getBSS() { return get(BSS); }
851851 return SectionKind::getMergeableConst8();
852852 case 16:
853853 return SectionKind::getMergeableConst16();
854 case 32:
855 return SectionKind::getMergeableConst32();
854856 default:
855857 return SectionKind::getReadOnly();
856858 }
269269 EntrySize = 4;
270270 } else if (Kind.isMergeableConst8()) {
271271 EntrySize = 8;
272 } else if (Kind.isMergeableConst16()) {
273 EntrySize = 16;
272274 } else {
273 assert(Kind.isMergeableConst16() && "unknown data width");
274 EntrySize = 16;
275 assert(Kind.isMergeableConst32() && "unknown data width");
276 EntrySize = 32;
275277 }
276278 }
277279
374376 return MergeableConst8Section;
375377 if (Kind.isMergeableConst16() && MergeableConst16Section)
376378 return MergeableConst16Section;
379 if (Kind.isMergeableConst32() && MergeableConst32Section)
380 return MergeableConst32Section;
377381 if (Kind.isReadOnly())
378382 return ReadOnlySection;
379383
467467 MergeableConst16Section =
468468 Ctx->getELFSection(".rodata.cst16", ELF::SHT_PROGBITS,
469469 ELF::SHF_ALLOC | ELF::SHF_MERGE, 16, "");
470
471 MergeableConst32Section =
472 Ctx->getELFSection(".rodata.cst32", ELF::SHT_PROGBITS,
473 ELF::SHF_ALLOC | ELF::SHF_MERGE, 32, "");
470474
471475 StaticCtorSection = Ctx->getELFSection(".ctors", ELF::SHT_PROGBITS,
472476 ELF::SHF_ALLOC | ELF::SHF_WRITE);
201201 case 4: return SectionKind::getMergeableConst4();
202202 case 8: return SectionKind::getMergeableConst8();
203203 case 16: return SectionKind::getMergeableConst16();
204 case 32: return SectionKind::getMergeableConst32();
204205 default:
205206 return SectionKind::getReadOnly();
206207 }
175175 COMDATSymName = "__xmm@" + scalarConstantToHexString(C);
176176 Align = 16;
177177 }
178 } else if (Kind.isMergeableConst32()) {
179 if (Align <= 32) {
180 COMDATSymName = "__ymm@" + scalarConstantToHexString(C);
181 Align = 32;
182 }
178183 }
179184
180185 if (!COMDATSymName.empty())
297297
298298 ; WIN32-SECTIONS: .section .rdata,"dr",one_only,_G15
299299 ; WIN32-SECTIONS: _G15:
300
301 @G16 = unnamed_addr constant i256 0
302
303 ; LINUX: .section .rodata.cst32,"aM",@progbits,32
304 ; LINUX: G16:
305
306 ; LINUX-SECTIONS: .section .rodata.cst32,"aM",@progbits,32
307 ; LINUX-SECTIONS: G16:
308
309 ; WIN32-SECTIONS: .section .rdata,"dr",one_only,_G16
310 ; WIN32-SECTIONS: _G16:
None ; RUN: llc < %s -mtriple=x86_64-win32 -mattr=sse2 | FileCheck %s
0 ; RUN: llc < %s -mtriple=x86_64-win32 -mattr=sse2 -mattr=avx | FileCheck %s
11 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
22 target triple = "x86_64-pc-windows-msvc"
33
7676 ; CHECK-NEXT: __real@bf8000003f800000:
7777 ; CHECK-NEXT: .long 1065353216
7878 ; CHECK-NEXT: .long 3212836864
79
80 define <4 x i64> @ymm() {
81 entry:
82 ret <4 x i64>
83 }
84
85 ; CHECK: .globl __ymm@0000000400000003000000020000000100000004000000030000000200000001
86 ; CHECK: .section .rdata,"dr",discard,__ymm@0000000400000003000000020000000100000004000000030000000200000001
87 ; CHECK: .p2align 5
88 ; CHECK: __ymm@0000000400000003000000020000000100000004000000030000000200000001:
89 ; CHECK: .quad 8589934593 # 0x200000001
90 ; CHECK: .quad 17179869187 # 0x400000003
91 ; CHECK: .quad 8589934593 # 0x200000001
92 ; CHECK: .quad 17179869187