]> git.pld-linux.org Git - packages/beignet.git/blob - beignet-llvm8-support.patch
- merged some Debian patches
[packages/beignet.git] / beignet-llvm8-support.patch
1 Description: Fix build with LLVM/Clang 8
2
3 Origin: (partly) FreeBSD https://svnweb.freebsd.org/ports/head/lang/beignet/files/patch-llvm8?view=markup
4 Author: Jan Beich, Rebecca N. Palmer
5
6 --- a/backend/src/CMakeLists.txt
7 +++ b/backend/src/CMakeLists.txt
8 @@ -168,6 +168,7 @@ add_dependencies(gbe beignet_bitcode)
9  endif (NOT (USE_STANDALONE_GBE_COMPILER STREQUAL "true"))
10  
11  add_library(gbeinterp SHARED gbe_bin_interpreter.cpp)
12 +target_link_libraries(gbeinterp ${LLVM_MODULE_LIBS} ${LLVM_SYSTEM_LIBS})
13  
14  if (LLVM_VERSION_NODOT VERSION_EQUAL 34)
15    find_library(TERMINFO NAMES tinfo ncurses)
16 --- a/backend/src/llvm/llvm_gen_backend.cpp
17 +++ b/backend/src/llvm/llvm_gen_backend.cpp
18 @@ -3073,14 +3073,22 @@ namespace gbe
19  
20  
21    static unsigned getChildNo(BasicBlock *bb) {
22 +#if LLVM_VERSION_MAJOR < 8
23      TerminatorInst *term = bb->getTerminator();
24 +#else
25 +    Instruction *term = bb->getTerminator();
26 +#endif
27      return term->getNumSuccessors();
28    }
29  
30    // return NULL if index out-range of children number
31    static BasicBlock *getChildPossible(BasicBlock *bb, unsigned index) {
32  
33 +#if LLVM_VERSION_MAJOR < 8
34      TerminatorInst *term = bb->getTerminator();
35 +#else
36 +    Instruction *term = bb->getTerminator();
37 +#endif
38      unsigned childNo = term->getNumSuccessors();
39      BasicBlock *child = NULL;
40      if(index < childNo) {
41 --- a/backend/src/backend/gen_register.hpp
42 +++ b/backend/src/backend/gen_register.hpp
43 @@ -225,6 +225,7 @@ namespace gbe
44                         uint32_t width,
45                         uint32_t hstride)
46      {
47 +      this->value.reg = 0;//avoid subgroup crash
48        this->type = type;
49        this->file = file;
50        this->nr = nr;
51 --- a/backend/src/libocl/tmpl/ocl_integer.tmpl.cl
52 +++ b/backend/src/libocl/tmpl/ocl_integer.tmpl.cl
53 @@ -216,13 +216,14 @@ OVERLOADABLE ulong mad_sat(ulong a, ulon
54    return __gen_ocl_mad_sat(a, b, c);
55  }
56  
57 -OVERLOADABLE uchar __rotate_left(uchar x, uchar y) { return (x << y) | (x >> (8 - y)); }
58 +// the 'volatile' is to make the LLVM optimizer leave these alone, as it would convert them to intrinsics (fshl/fshr) that we don't implement
59 +OVERLOADABLE uchar __rotate_left(uchar x, uchar y) { volatile uchar z; z = (x << y); return z | (x >> (8 - y)); }
60  OVERLOADABLE char __rotate_left(char x, char y) { return __rotate_left((uchar)x, (uchar)y); }
61 -OVERLOADABLE ushort __rotate_left(ushort x, ushort y) { return (x << y) | (x >> (16 - y)); }
62 +OVERLOADABLE ushort __rotate_left(ushort x, ushort y) { volatile ushort z; z = (x << y); return z | (x >> (16 - y)); }
63  OVERLOADABLE short __rotate_left(short x, short y) { return __rotate_left((ushort)x, (ushort)y); }
64 -OVERLOADABLE uint __rotate_left(uint x, uint y) { return (x << y) | (x >> (32 - y)); }
65 +OVERLOADABLE uint __rotate_left(uint x, uint y) { volatile uint z; z = (x << y); return z | (x >> (32 - y)); }
66  OVERLOADABLE int __rotate_left(int x, int y) { return __rotate_left((uint)x, (uint)y); }
67 -OVERLOADABLE ulong __rotate_left(ulong x, ulong y) { return (x << y) | (x >> (64 - y)); }
68 +OVERLOADABLE ulong __rotate_left(ulong x, ulong y) { volatile ulong z; z = (x << y); return z | (x >> (64 - y)); }
69  OVERLOADABLE long __rotate_left(long x, long y) { return __rotate_left((ulong)x, (ulong)y); }
70  #define DEF(type, m) OVERLOADABLE type rotate(type x, type y) { return __rotate_left(x, (type)(y & m)); }
71  DEF(char, 7)
This page took 0.035167 seconds and 3 git commands to generate.