diff --git a/srcpkgs/libllvm6.0 b/srcpkgs/libllvm6.0 new file mode 120000 index 0000000000..4b92e184ed --- /dev/null +++ b/srcpkgs/libllvm6.0 @@ -0,0 +1 @@ +llvm6.0 \ No newline at end of file diff --git a/srcpkgs/llvm6.0/files/llvm-Config-config.h b/srcpkgs/llvm6.0/files/llvm-Config-config.h new file mode 100644 index 0000000000..c369b4551f --- /dev/null +++ b/srcpkgs/llvm6.0/files/llvm-Config-config.h @@ -0,0 +1,9 @@ +#include + +#if __WORDSIZE == 32 +#include "config-32.h" +#elif __WORDSIZE == 64 +#include "config-64.h" +#else +#error "Unknown word size" +#endif diff --git a/srcpkgs/llvm6.0/files/llvm-Config-llvm-config.h b/srcpkgs/llvm6.0/files/llvm-Config-llvm-config.h new file mode 100644 index 0000000000..2fa08c9be6 --- /dev/null +++ b/srcpkgs/llvm6.0/files/llvm-Config-llvm-config.h @@ -0,0 +1,9 @@ +#include + +#if __WORDSIZE == 32 +#include "llvm-config-32.h" +#elif __WORDSIZE == 64 +#include "llvm-config-64.h" +#else +#error "Unknown word size" +#endif diff --git a/srcpkgs/llvm6.0/files/patches/cfe/cfe-001-fix-stdint.patch b/srcpkgs/llvm6.0/files/patches/cfe/cfe-001-fix-stdint.patch new file mode 100644 index 0000000000..17c6989dc8 --- /dev/null +++ b/srcpkgs/llvm6.0/files/patches/cfe/cfe-001-fix-stdint.patch @@ -0,0 +1,41 @@ +From fd3bcfddcdb11757e95bc3a625017cbf234b67ed Mon Sep 17 00:00:00 2001 +From: Andrea Brancaleoni +Date: Tue, 8 Sep 2015 22:14:32 +0200 +Subject: [PATCH 1/7] fix stdint + +--- + lib/Headers/stdint.h | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/lib/Headers/stdint.h b/lib/Headers/stdint.h +index 0303db9..8ca28df 100644 +--- a/lib/Headers/stdint.h ++++ b/lib/Headers/stdint.h +@@ -22,8 +22,6 @@ + * + \*===----------------------------------------------------------------------===*/ + +-#ifndef __CLANG_STDINT_H +-#define __CLANG_STDINT_H + + /* If we're hosted, fall back to the system's stdint.h, which might have + * additional definitions. +@@ -72,6 +70,8 @@ + # endif + + #else ++#ifndef __CLANG_STDINT_H ++#define __CLANG_STDINT_H + + /* C99 7.18.1.1 Exact-width integer types. + * C99 7.18.1.2 Minimum-width integer types. +@@ -703,5 +703,5 @@ typedef __UINTMAX_TYPE__ uintmax_t; + #define INTMAX_C(v) __INTN_C(__INTMAX_WIDTH__, v) + #define UINTMAX_C(v) __UINTN_C(__INTMAX_WIDTH__, v) + +-#endif /* __STDC_HOSTED__ */ + #endif /* __CLANG_STDINT_H */ ++#endif /* __STDC_HOSTED__ */ +-- +2.5.1 + diff --git a/srcpkgs/llvm6.0/files/patches/cfe/cfe-003-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm6.0/files/patches/cfe/cfe-003-fix-unwind-chain-inclusion.patch new file mode 100644 index 0000000000..a399ac17a0 --- /dev/null +++ b/srcpkgs/llvm6.0/files/patches/cfe/cfe-003-fix-unwind-chain-inclusion.patch @@ -0,0 +1,45 @@ +From 352974169f0d2b5da3d5321f588f5e3b5941330e Mon Sep 17 00:00:00 2001 +From: Andrea Brancaleoni +Date: Tue, 8 Sep 2015 22:14:57 +0200 +Subject: [PATCH 2/7] fix unwind chain inclusion + +--- + lib/Headers/unwind.h | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +diff --git a/lib/Headers/unwind.h b/lib/Headers/unwind.h +index 303d792..44e10cc 100644 +--- a/lib/Headers/unwind.h ++++ b/lib/Headers/unwind.h +@@ -23,9 +23,6 @@ + + /* See "Data Definitions for libgcc_s" in the Linux Standard Base.*/ + +-#ifndef __CLANG_UNWIND_H +-#define __CLANG_UNWIND_H +- + #if defined(__APPLE__) && __has_include_next() + /* Darwin (from 11.x on) provide an unwind.h. If that's available, + * use it. libunwind wraps some of its definitions in #ifdef _GNU_SOURCE, +@@ -53,6 +50,9 @@ + # endif + #else + ++#ifndef __CLANG_UNWIND_H ++#define __CLANG_UNWIND_H ++ + #include + + #ifdef __cplusplus +@@ -277,6 +277,7 @@ _Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *); + } + #endif + ++#endif /* __CLANG_UNWIND_H */ ++ + #endif + +-#endif /* __CLANG_UNWIND_H */ +-- +2.5.1 + diff --git a/srcpkgs/llvm6.0/files/patches/cfe/cfe-004-add-musl-triples.patch b/srcpkgs/llvm6.0/files/patches/cfe/cfe-004-add-musl-triples.patch new file mode 100644 index 0000000000..9486d0ec2e --- /dev/null +++ b/srcpkgs/llvm6.0/files/patches/cfe/cfe-004-add-musl-triples.patch @@ -0,0 +1,39 @@ +--- clang/lib/Driver/ToolChains/Gnu.cpp.orig ++++ clang/lib/Driver/ToolChains/Gnu.cpp +@@ -1802,7 +1802,8 @@ + static const char *const AArch64LibDirs[] = {"/lib64", "/lib"}; + static const char *const AArch64Triples[] = { + "aarch64-none-linux-gnu", "aarch64-linux-gnu", "aarch64-linux-android", +- "aarch64-redhat-linux", "aarch64-suse-linux"}; ++ "aarch64-redhat-linux", "aarch64-suse-linux", ++ "aarch64-linux-musl"}; + static const char *const AArch64beLibDirs[] = {"/lib"}; + static const char *const AArch64beTriples[] = {"aarch64_be-none-linux-gnu", + "aarch64_be-linux-gnu"}; +@@ -1813,7 +1814,9 @@ + static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf", + "armv7hl-redhat-linux-gnueabi", + "armv6hl-suse-linux-gnueabi", +- "armv7hl-suse-linux-gnueabi"}; ++ "armv7hl-suse-linux-gnueabi", ++ "arm-linux-musleabihf", ++ "armv7l-linux-musleabihf"}; + static const char *const ARMebLibDirs[] = {"/lib"}; + static const char *const ARMebTriples[] = {"armeb-linux-gnueabi", + "armeb-linux-androideabi"}; +@@ -1827,6 +1830,7 @@ + "x86_64-redhat-linux", "x86_64-suse-linux", + "x86_64-manbo-linux-gnu", "x86_64-linux-gnu", + "x86_64-slackware-linux", "x86_64-linux-android", ++ "x86_64-linux-musl", + "x86_64-unknown-linux"}; + static const char *const X32LibDirs[] = {"/libx32"}; + static const char *const X86LibDirs[] = {"/lib32", "/lib"}; +@@ -1835,6 +1839,7 @@ + "i386-linux-gnu", "i386-redhat-linux6E", "i686-redhat-linux", + "i586-redhat-linux", "i386-redhat-linux", "i586-suse-linux", + "i486-slackware-linux", "i686-montavista-linux", "i686-linux-android", ++ "i686-linux-musl", + "i586-linux-gnu"}; + + static const char *const MIPSLibDirs[] = {"/lib"}; diff --git a/srcpkgs/llvm6.0/files/patches/lldb/editline_wchar.patch b/srcpkgs/llvm6.0/files/patches/lldb/editline_wchar.patch new file mode 100644 index 0000000000..828e4db983 --- /dev/null +++ b/srcpkgs/llvm6.0/files/patches/lldb/editline_wchar.patch @@ -0,0 +1,11 @@ +--- lldb-5.0.0.src/include/lldb/Host/Editline.h.orig ++++ lldb-5.0.0.src/include/lldb/Host/Editline.h +@@ -44,7 +44,7 @@ + // used in cases where this is true. This is a compile time dependecy, for now + // selected per target Platform + #if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || \ +- defined(__OpenBSD__) ++ defined(__OpenBSD__) || defined(__linux__) + #define LLDB_EDITLINE_USE_WCHAR 1 + #include + #else diff --git a/srcpkgs/llvm6.0/files/patches/lldb/zzz-aarch64.patch b/srcpkgs/llvm6.0/files/patches/lldb/zzz-aarch64.patch new file mode 100644 index 0000000000..5bacbf4729 --- /dev/null +++ b/srcpkgs/llvm6.0/files/patches/lldb/zzz-aarch64.patch @@ -0,0 +1,25 @@ +--- lldb/source/Plugins/Process/Linux/Procfs.h.orig ++++ lldb/source/Plugins/Process/Linux/Procfs.h +@@ -11,21 +11,6 @@ + // sys/procfs.h on Android/Linux for all supported architectures. + + #include ++#include + +-#ifdef __ANDROID__ +-#if defined(__arm64__) || defined(__aarch64__) +-typedef unsigned long elf_greg_t; +-typedef elf_greg_t +- elf_gregset_t[(sizeof(struct user_pt_regs) / sizeof(elf_greg_t))]; +-typedef struct user_fpsimd_state elf_fpregset_t; +-#ifndef NT_FPREGSET +-#define NT_FPREGSET NT_PRFPREG +-#endif // NT_FPREGSET +-#elif defined(__mips__) +-#ifndef NT_FPREGSET +-#define NT_FPREGSET NT_PRFPREG +-#endif // NT_FPREGSET +-#endif +-#else // __ANDROID__ + #include +-#endif // __ANDROID__ diff --git a/srcpkgs/llvm6.0/files/patches/llvm/0001-AMDGPU-Fix-bug-31610.patch b/srcpkgs/llvm6.0/files/patches/llvm/0001-AMDGPU-Fix-bug-31610.patch new file mode 100644 index 0000000000..d19885883f --- /dev/null +++ b/srcpkgs/llvm6.0/files/patches/llvm/0001-AMDGPU-Fix-bug-31610.patch @@ -0,0 +1,74 @@ +From bc72a21666a9efc78e71b0296313f6e1449649fa Mon Sep 17 00:00:00 2001 +From: Konstantin Zhuravlyov +Date: Wed, 22 Mar 2017 21:48:18 +0000 +Subject: [PATCH] [AMDGPU] Fix bug 31610 + +Differential Revision: https://reviews.llvm.org/D31258 + + +git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298551 91177308-0d34-0410-b5e6-96231b3b80d8 +--- + lib/Target/AMDGPU/AMDGPURuntimeMetadata.h | 8 ++++---- + lib/Target/AMDGPU/MCTargetDesc/AMDGPURuntimeMD.cpp | 5 ++--- + 2 files changed, 6 insertions(+), 7 deletions(-) + +diff --git a/lib/Target/AMDGPU/AMDGPURuntimeMetadata.h b/lib/Target/AMDGPU/AMDGPURuntimeMetadata.h +index ed147ff4c43..36e7a0c42a9 100644 +--- a/lib/Target/AMDGPU/AMDGPURuntimeMetadata.h ++++ b/lib/Target/AMDGPU/AMDGPURuntimeMetadata.h +@@ -40,8 +40,8 @@ namespace AMDGPU { + namespace RuntimeMD { + + // Version and revision of runtime metadata +- const unsigned char MDVersion = 2; +- const unsigned char MDRevision = 0; ++ const uint32_t MDVersion = 2; ++ const uint32_t MDRevision = 0; + + // Name of keys for runtime metadata. + namespace KeyName { +@@ -215,7 +215,7 @@ namespace RuntimeMD { + struct Metadata { + std::string Name; + std::string Language; +- std::vector LanguageVersion; ++ std::vector LanguageVersion; + std::vector ReqdWorkGroupSize; + std::vector WorkGroupSizeHint; + std::string VecTypeHint; +@@ -265,7 +265,7 @@ namespace RuntimeMD { + namespace Program { + // In-memory representation of program information. + struct Metadata { +- std::vector MDVersionSeq; ++ std::vector MDVersionSeq; + std::vector PrintfInfo; + std::vector Kernels; + +diff --git a/lib/Target/AMDGPU/MCTargetDesc/AMDGPURuntimeMD.cpp b/lib/Target/AMDGPU/MCTargetDesc/AMDGPURuntimeMD.cpp +index 0e87d750f5d..7c96898297c 100644 +--- a/lib/Target/AMDGPU/MCTargetDesc/AMDGPURuntimeMD.cpp ++++ b/lib/Target/AMDGPU/MCTargetDesc/AMDGPURuntimeMD.cpp +@@ -49,7 +49,6 @@ static cl::opt + CheckRuntimeMDParser("amdgpu-check-rtmd-parser", cl::Hidden, + cl::desc("Check AMDGPU runtime metadata YAML parser")); + +-LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(uint8_t) + LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(uint32_t) + LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(std::string) + LLVM_YAML_IS_SEQUENCE_VECTOR(Kernel::Metadata) +@@ -297,9 +296,9 @@ static Kernel::Metadata getRuntimeMDForKernel(const Function &F) { + auto Node = MD->getOperand(0); + if (Node->getNumOperands() > 1) { + Kernel.Language = "OpenCL C"; +- uint16_t Major = mdconst::extract(Node->getOperand(0)) ++ uint32_t Major = mdconst::extract(Node->getOperand(0)) + ->getZExtValue(); +- uint16_t Minor = mdconst::extract(Node->getOperand(1)) ++ uint32_t Minor = mdconst::extract(Node->getOperand(1)) + ->getZExtValue(); + Kernel.LanguageVersion.push_back(Major); + Kernel.LanguageVersion.push_back(Minor); +-- +2.12.2 + diff --git a/srcpkgs/llvm6.0/files/patches/llvm/llvm-003-musl.patch b/srcpkgs/llvm6.0/files/patches/llvm/llvm-003-musl.patch new file mode 100644 index 0000000000..9a83da45cc --- /dev/null +++ b/srcpkgs/llvm6.0/files/patches/llvm/llvm-003-musl.patch @@ -0,0 +1,79 @@ +From faca3fbd15d0c3108493c3c54cd93138e049ac43 Mon Sep 17 00:00:00 2001 +From: Andrea Brancaleoni +Date: Tue, 8 Sep 2015 22:03:02 +0200 +Subject: [PATCH 3/3] musl + +--- + include/llvm/Analysis/TargetLibraryInfo.h | 9 +++++++++ + lib/Analysis/TargetLibraryInfo.cpp | 5 +++-- + lib/Support/DynamicLibrary.cpp | 2 +- + lib/Support/Unix/Signals.inc | 6 +++--- + utils/unittest/googletest/src/gtest.cc | 1 + + 5 files changed, 17 insertions(+), 6 deletions(-) + +diff --git a/include/llvm/Analysis/TargetLibraryInfo.h b/include/llvm/Analysis/TargetLibraryInfo.h +index e0a1ee3..465b65a 100644 +--- a/include/llvm/Analysis/TargetLibraryInfo.h ++++ b/include/llvm/Analysis/TargetLibraryInfo.h +@@ -18,6 +18,15 @@ + #include "llvm/IR/Module.h" + #include "llvm/Pass.h" + ++#undef fopen64 ++#undef fseeko64 ++#undef fstat64 ++#undef fstatvfs64 ++#undef ftello64 ++#undef lstat64 ++#undef stat64 ++#undef tmpfile64 ++ + namespace llvm { + /// VecDesc - Describes a possible vectorization of a function. + /// Function 'VectorFnName' is equivalent to 'ScalarFnName' vectorized +diff --git a/utils/unittest/googletest/src/gtest.cc b/utils/unittest/googletest/src/gtest.cc +index 5780764..1d548c1 100644 +--- a/utils/unittest/googletest/src/gtest.cc ++++ b/utils/unittest/googletest/src/gtest.cc +@@ -120,6 +120,7 @@ + + #if GTEST_CAN_STREAM_RESULTS_ + # include // NOLINT ++# include // NOLINT + # include // NOLINT + #endif + +-- +2.5.1 + +--- llvm-5.0.0.src/lib/Analysis/TargetLibraryInfo.cpp.orig ++++ llvm-5.0.0.src/lib/Analysis/TargetLibraryInfo.cpp +@@ -439,14 +439,15 @@ + } + + // The following functions are available on at least Linux: +- if (!T.isOSLinux()) { ++ if (!T.isOSLinux()) ++ TLI.setUnavailable(LibFunc_memalign); ++ if (1 /*!T.isGlibc()*/) { + TLI.setUnavailable(LibFunc_dunder_strdup); + TLI.setUnavailable(LibFunc_dunder_strtok_r); + TLI.setUnavailable(LibFunc_dunder_isoc99_scanf); + TLI.setUnavailable(LibFunc_dunder_isoc99_sscanf); + TLI.setUnavailable(LibFunc_under_IO_getc); + TLI.setUnavailable(LibFunc_under_IO_putc); +- TLI.setUnavailable(LibFunc_memalign); + TLI.setUnavailable(LibFunc_fopen64); + TLI.setUnavailable(LibFunc_fseeko64); + TLI.setUnavailable(LibFunc_fstat64); +--- llvm-5.0.0.src/lib/Support/Unix/DynamicLibrary.inc.orig ++++ llvm-5.0.0.src/lib/Support/Unix/DynamicLibrary.inc +@@ -103,7 +103,7 @@ + + // This macro returns the address of a well-known, explicit symbol + #define EXPLICIT_SYMBOL(SYM) \ +- if (!strcmp(SymbolName, #SYM)) return &SYM ++ if (!strcmp(SymbolName, #SYM)) return (void *)&SYM + + // Under glibc we have a weird situation. The stderr/out/in symbols are both + // macros and global variables because of standards requirements. So, we diff --git a/srcpkgs/llvm6.0/files/patches/llvm/reverse-llvm-AMDGPU-Fix-an-interaction-between-WQM-and-polygon-stippling.patch b/srcpkgs/llvm6.0/files/patches/llvm/reverse-llvm-AMDGPU-Fix-an-interaction-between-WQM-and-polygon-stippling.patch new file mode 100644 index 0000000000..f23b916828 --- /dev/null +++ b/srcpkgs/llvm6.0/files/patches/llvm/reverse-llvm-AMDGPU-Fix-an-interaction-between-WQM-and-polygon-stippling.patch @@ -0,0 +1,140 @@ +From 25e2616626caafb896517e18cd8aa724fba2b200 Mon Sep 17 00:00:00 2001 +From: Tom Stellard +Date: Tue, 29 Nov 2016 03:41:28 +0000 +Subject: [PATCH] Merging r280589: + +------------------------------------------------------------------------ +r280589 | nhaehnle | 2016-09-03 05:26:32 -0700 (Sat, 03 Sep 2016) | 19 lines + +AMDGPU: Fix an interaction between WQM and polygon stippling + +Summary: +This fixes a rare bug in polygon stippling with non-monolithic pixel shaders. + +The underlying problem is as follows: the prolog part contains the polygon +stippling sequence, i.e. a kill. The main part then enables WQM based on the +_reduced_ exec mask, effectively undoing most of the polygon stippling. + +Since we cannot know whether polygon stippling will be used, the main part +of a non-monolithic shader must always return to exact mode to fix this +problem. + +Reviewers: arsenm, tstellarAMD, mareko + +Subscribers: arsenm, llvm-commits, kzhuravl + +Differential Revision: https://reviews.llvm.org/D23131 + +------------------------------------------------------------------------ + +git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_39@288105 91177308-0d34-0410-b5e6-96231b3b80d8 +--- + lib/Target/AMDGPU/SIInstructions.td | 1 + + lib/Target/AMDGPU/SIWholeQuadMode.cpp | 7 ----- + test/CodeGen/AMDGPU/wqm.ll | 49 ++++++++++++++++++++++++++++++++--- + 3 files changed, 46 insertions(+), 11 deletions(-) + +diff --git a/lib/Target/AMDGPU/SIInstructions.td b/lib/Target/AMDGPU/SIInstructions.td +index 18b7d5d..dde5f2f 100644 +--- a/lib/Target/AMDGPU/SIInstructions.td ++++ b/lib/Target/AMDGPU/SIInstructions.td +@@ -2029,6 +2029,7 @@ def SI_RETURN : PseudoInstSI < + let hasSideEffects = 1; + let SALU = 1; + let hasNoSchedulingInfo = 1; ++ let DisableWQM = 1; + } + + let Uses = [EXEC], Defs = [EXEC, VCC, M0], +diff --git a/lib/Target/AMDGPU/SIWholeQuadMode.cpp b/lib/Target/AMDGPU/SIWholeQuadMode.cpp +index b200c15..1534d58 100644 +--- a/lib/Target/AMDGPU/SIWholeQuadMode.cpp ++++ b/lib/Target/AMDGPU/SIWholeQuadMode.cpp +@@ -219,13 +219,6 @@ char SIWholeQuadMode::scanInstructions(MachineFunction &MF, + markInstruction(MI, Flags, Worklist); + GlobalFlags |= Flags; + } +- +- if (WQMOutputs && MBB.succ_empty()) { +- // This is a prolog shader. Make sure we go back to exact mode at the end. +- Blocks[&MBB].OutNeeds = StateExact; +- Worklist.push_back(&MBB); +- GlobalFlags |= StateExact; +- } + } + + return GlobalFlags; +diff --git a/test/CodeGen/AMDGPU/wqm.ll b/test/CodeGen/AMDGPU/wqm.ll +index 809a7ba..41e4264 100644 +--- a/test/CodeGen/AMDGPU/wqm.ll ++++ b/test/CodeGen/AMDGPU/wqm.ll +@@ -17,17 +17,18 @@ main_body: + ;CHECK-LABEL: {{^}}test2: + ;CHECK-NEXT: ; %main_body + ;CHECK-NEXT: s_wqm_b64 exec, exec +-;CHECK: image_sample + ;CHECK-NOT: exec +-;CHECK: _load_dword v0, +-define amdgpu_ps float @test2(<8 x i32> inreg %rsrc, <4 x i32> inreg %sampler, float addrspace(1)* inreg %ptr, <4 x i32> %c) { ++define amdgpu_ps void @test2(<8 x i32> inreg %rsrc, <4 x i32> inreg %sampler, float addrspace(1)* inreg %ptr, <4 x i32> %c) { + main_body: + %c.1 = call <4 x float> @llvm.SI.image.sample.v4i32(<4 x i32> %c, <8 x i32> %rsrc, <4 x i32> %sampler, i32 15, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0) + %c.2 = bitcast <4 x float> %c.1 to <4 x i32> + %c.3 = extractelement <4 x i32> %c.2, i32 0 + %gep = getelementptr float, float addrspace(1)* %ptr, i32 %c.3 + %data = load float, float addrspace(1)* %gep +- ret float %data ++ ++ call void @llvm.SI.export(i32 15, i32 1, i32 1, i32 0, i32 1, float %data, float undef, float undef, float undef) ++ ++ ret void + } + + ; ... but disabled for stores (and, in this simple case, not re-enabled). +@@ -414,6 +415,46 @@ entry: + ret void + } + ++; Must return to exact at the end of a non-void returning shader, ++; otherwise the EXEC mask exported by the epilog will be wrong. This is true ++; even if the shader has no kills, because a kill could have happened in a ++; previous shader fragment. ++; ++; CHECK-LABEL: {{^}}test_nonvoid_return: ++; CHECK: s_mov_b64 [[LIVE:s\[[0-9]+:[0-9]+\]]], exec ++; CHECK: s_wqm_b64 exec, exec ++; ++; CHECK: s_and_b64 exec, exec, [[LIVE]] ++; CHECK-NOT: exec ++define amdgpu_ps <4 x float> @test_nonvoid_return() nounwind { ++ %tex = call <4 x float> @llvm.SI.image.sample.v4i32(<4 x i32> undef, <8 x i32> undef, <4 x i32> undef, i32 15, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0) ++ %tex.i = bitcast <4 x float> %tex to <4 x i32> ++ %dtex = call <4 x float> @llvm.SI.image.sample.v4i32(<4 x i32> %tex.i, <8 x i32> undef, <4 x i32> undef, i32 15, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0) ++ ret <4 x float> %dtex ++} ++ ++; CHECK-LABEL: {{^}}test_nonvoid_return_unreachable: ++; CHECK: s_mov_b64 [[LIVE:s\[[0-9]+:[0-9]+\]]], exec ++; CHECK: s_wqm_b64 exec, exec ++; ++; CHECK: s_and_b64 exec, exec, [[LIVE]] ++; CHECK-NOT: exec ++define amdgpu_ps <4 x float> @test_nonvoid_return_unreachable(i32 inreg %c) nounwind { ++entry: ++ %tex = call <4 x float> @llvm.SI.image.sample.v4i32(<4 x i32> undef, <8 x i32> undef, <4 x i32> undef, i32 15, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0) ++ %tex.i = bitcast <4 x float> %tex to <4 x i32> ++ %dtex = call <4 x float> @llvm.SI.image.sample.v4i32(<4 x i32> %tex.i, <8 x i32> undef, <4 x i32> undef, i32 15, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0) ++ ++ %cc = icmp sgt i32 %c, 0 ++ br i1 %cc, label %if, label %else ++ ++if: ++ store volatile <4 x float> %dtex, <4 x float>* undef ++ unreachable ++ ++else: ++ ret <4 x float> %dtex ++} + + declare void @llvm.amdgcn.image.store.v4i32(<4 x float>, <4 x i32>, <8 x i32>, i32, i1, i1, i1, i1) #1 + declare void @llvm.amdgcn.buffer.store.f32(float, <4 x i32>, i32, i32, i1, i1) #1 diff --git a/srcpkgs/llvm6.0/template b/srcpkgs/llvm6.0/template new file mode 100644 index 0000000000..50e2ad79e7 --- /dev/null +++ b/srcpkgs/llvm6.0/template @@ -0,0 +1,102 @@ +# Template file for 'llvm6.0' +pkgname=llvm6.0 +version=6.0.1 +revision=4 +wrksrc="llvm-${version}.src" +lib32disabled=yes +build_style=cmake +configure_args=" + -DCMAKE_BUILD_TYPE=Release + -DLLVM_INSTALL_UTILS=ON + -DLLVM_BUILD_LLVM_DYLIB=ON + -DLLVM_LINK_LLVM_DYLIB=ON + -DLLVM_ENABLE_RTTI=ON + -DLLVM_ENABLE_FFI=ON + -DLLVM_BINUTILS_INCDIR=/usr/include" +short_desc="Low Level Virtual Machine (6.0.x series)" +maintainer="Juan RP " +homepage="https://www.llvm.org" +license="NCSA" +distfiles="https://www.llvm.org/releases/${version}/llvm-${version}.src.tar.xz" +checksum="b6d6c324f9c71494c0ccaf3dac1f16236d970002b42bb24a6c9e1634f7d0f4e2" + +# XXX Investigate ocaml bindings. +hostmakedepends="groff perl python zlib-devel libffi-devel swig" +makedepends="python-devel zlib-devel libffi-devel libedit-devel libxml2-devel binutils-devel libatomic-devel" +depends="libllvm6.0" +conflicts="llvm>=0 llvm3.9>=0" + +subpackages="libllvm6.0" + +post_extract() { + # patches + cd ${XBPS_BUILDDIR}/llvm-${version}.src + for i in ${FILESDIR}/patches/llvm/llvm-*.patch; do + msg_normal "Applying $i to llvm\n" + patch -sNp1 -i ${i} + done + +} + +pre_configure() { + # Vastly reduce size of debugging symbols: + CFLAGS=${CFLAGS/ -g/ -g1} + CXXFLAGS=${CXXFLAGS/ -g/ -g1} + + if [ "$CROSS_BUILD" ]; then + msg_normal "Building host tblgen\n" + mkdir -p build/HOST + cd build/HOST + CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \ + CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \ + cmake ../.. -DCMAKE_BUILD_TYPE=Release + make ${makejobs} -C utils/TableGen + make ${makejobs} -C tools/clang/utils/TableGen + configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/build/HOST/bin/llvm-tblgen" + configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/build/HOST/bin/clang-tblgen" + cd ../.. + fi + + case "$XBPS_TARGET_MACHINE" in + i686*) _arch="X86";; + x86_64*) _arch="X86";; + armv5*) _arch="Armv5te";; + armv6*) _arch="Armv6";; + armv7*) _arch="Armv7";; + aarch64*) _arch="AArch64";; + mips*) _arch="Mips";; + esac + configure_args+=" -DLLVM_TARGET_ARCH=${_arch}" + configure_args+=" -DLLVM_DEFAULT_TARGET_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}" +} + +do_install() { + vlicense LICENSE.TXT + + cd build + cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr -P cmake_install.cmake + + # Fix permissions of static libs + chmod -x ${DESTDIR}/usr/lib/*.a + + # Required for multilib. + if [ "$XBPS_TARGET_MACHINE" = "x86_64" ]; then + for _header in llvm-config; do + mv ${DESTDIR}/usr/include/llvm/Config/${_header}{,-64}.h + vinstall ${FILESDIR}/llvm-Config-${_header}.h 644 \ + usr/include/llvm/Config ${_header}.h + done + fi + + # Remove llvm-config-host in cross builds. + if [ "$CROSS_BUILD" ]; then + rm -f ${DESTDIR}/usr/bin/llvm-config-host + fi +} + +libllvm6.0_package() { + short_desc+=" - runtime library" + pkg_install() { + vmove "usr/lib/libLLVM-*.so*" + } +} diff --git a/srcpkgs/llvm6.0/update b/srcpkgs/llvm6.0/update new file mode 100644 index 0000000000..3d09eaff37 --- /dev/null +++ b/srcpkgs/llvm6.0/update @@ -0,0 +1,2 @@ +site=https://releases.llvm.org/ +pattern="'\K[\d\.]*(?=')"