summaryrefslogtreecommitdiff
path: root/backend/src/llvm/llvm_sampler_fix.cpp
diff options
context:
space:
mode:
authorYang Rong <rong.r.yang@intel.com>2017-09-20 16:17:50 +0800
committerYang Rong <rong.r.yang@intel.com>2017-09-21 17:43:12 +0800
commit269c230fbd8ad1e524abe169af88fadc405e5056 (patch)
tree95243f9c5df450d244b1a8388130cbc3e95eba04 /backend/src/llvm/llvm_sampler_fix.cpp
parent4aa4acc7a2ae7530dec031fa27cbd675eeb4dfb2 (diff)
downloadbeignet-269c230fbd8ad1e524abe169af88fadc405e5056.tar.gz
GBE: enable llvm5.0 support.
1. getOrInsertFunction without nullptr. 2. handle f16 rounding. 3. remove llvm value dump. 4. handle AddrSpaceCastInst when parsing block info. V2: use stripPointerCasts instead of BitCast and AddrSpaceCast. Signed-off-by: Yang Rong <rong.r.yang@intel.com> Reviewed-by: Ruiling Song <ruiling.song@intel.com>
Diffstat (limited to 'backend/src/llvm/llvm_sampler_fix.cpp')
-rw-r--r--backend/src/llvm/llvm_sampler_fix.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/backend/src/llvm/llvm_sampler_fix.cpp b/backend/src/llvm/llvm_sampler_fix.cpp
index c2497558..c9ec8175 100644
--- a/backend/src/llvm/llvm_sampler_fix.cpp
+++ b/backend/src/llvm/llvm_sampler_fix.cpp
@@ -81,7 +81,11 @@ namespace gbe {
#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 40
Module *M = I->getParent()->getParent()->getParent();
+#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 50
+ Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
+#else
Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType(), nullptr);
+#endif
Value *samplerVal = Builder.CreateCall(samplerCvt, {I->getOperand(0)});
#else
Value *samplerVal = I->getOperand(0);
@@ -119,7 +123,11 @@ namespace gbe {
Builder.SetInsertPoint(I);
#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 40
Module *M = I->getParent()->getParent()->getParent();
+#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 50
+ Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
+#else
Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType(), nullptr);
+#endif
Value *samplerVal = Builder.CreateCall(samplerCvt, {I->getOperand(0)});
#else
Value *samplerVal = I->getOperand(0);