From: Luo Xionghu <[email protected]> translate native log to llvm.log2 for fast path.
Signed-off-by: Luo Xionghu <[email protected]> --- backend/src/libocl/tmpl/ocl_math.tmpl.cl | 2 +- backend/src/llvm/llvm_gen_backend.cpp | 4 ++-- backend/src/llvm/llvm_gen_ocl_function.hxx | 1 - 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/backend/src/libocl/tmpl/ocl_math.tmpl.cl b/backend/src/libocl/tmpl/ocl_math.tmpl.cl index fc0343c..64f702c 100644 --- a/backend/src/libocl/tmpl/ocl_math.tmpl.cl +++ b/backend/src/libocl/tmpl/ocl_math.tmpl.cl @@ -28,7 +28,7 @@ CONST float __gen_ocl_sin(float x) __asm("llvm.sin" ".f32"); CONST float __gen_ocl_cos(float x) __asm("llvm.cos" ".f32"); CONST float __gen_ocl_sqrt(float x) __asm("llvm.sqrt" ".f32"); PURE CONST float __gen_ocl_rsqrt(float x); -PURE CONST float __gen_ocl_log(float x); +CONST float __gen_ocl_log(float x) __asm("llvm.log2" ".f32"); PURE CONST float __gen_ocl_exp(float x); PURE CONST float __gen_ocl_pow(float x, float y); PURE CONST float __gen_ocl_rcp(float x); diff --git a/backend/src/llvm/llvm_gen_backend.cpp b/backend/src/llvm/llvm_gen_backend.cpp index 0f4c813..86bc1b9 100644 --- a/backend/src/llvm/llvm_gen_backend.cpp +++ b/backend/src/llvm/llvm_gen_backend.cpp @@ -2801,6 +2801,7 @@ error: case Intrinsic::trunc: case Intrinsic::sin: case Intrinsic::cos: + case Intrinsic::log2: this->newRegister(&I); break; default: @@ -2855,7 +2856,6 @@ error: case GEN_OCL_FBL: case GEN_OCL_CBIT: case GEN_OCL_RSQ: - case GEN_OCL_LOG: case GEN_OCL_EXP: case GEN_OCL_POW: case GEN_OCL_RCP: @@ -3273,6 +3273,7 @@ error: case Intrinsic::trunc: this->emitUnaryCallInst(I,CS,ir::OP_RNDZ); break; case Intrinsic::sin: this->emitUnaryCallInst(I,CS,ir::OP_SIN); break; case Intrinsic::cos: this->emitUnaryCallInst(I,CS,ir::OP_COS); break; + case Intrinsic::log2: this->emitUnaryCallInst(I,CS,ir::OP_LOG); break; default: NOT_IMPLEMENTED; } } else { @@ -3341,7 +3342,6 @@ error: ctx.REGION(dst, src, x.getIntegerValue()); break; } - case GEN_OCL_LOG: this->emitUnaryCallInst(I,CS,ir::OP_LOG); break; case GEN_OCL_EXP: this->emitUnaryCallInst(I,CS,ir::OP_EXP); break; case GEN_OCL_RSQ: this->emitUnaryCallInst(I,CS,ir::OP_RSQ); break; case GEN_OCL_RCP: this->emitUnaryCallInst(I,CS,ir::OP_RCP); break; diff --git a/backend/src/llvm/llvm_gen_ocl_function.hxx b/backend/src/llvm/llvm_gen_ocl_function.hxx index ae14d9f..d68cb72 100644 --- a/backend/src/llvm/llvm_gen_ocl_function.hxx +++ b/backend/src/llvm/llvm_gen_ocl_function.hxx @@ -21,7 +21,6 @@ DECL_LLVM_GEN_FUNCTION(GET_WORK_DIM, __gen_ocl_get_work_dim) // Math function DECL_LLVM_GEN_FUNCTION(FABS, __gen_ocl_fabs) DECL_LLVM_GEN_FUNCTION(RSQ, __gen_ocl_rsqrt) -DECL_LLVM_GEN_FUNCTION(LOG, __gen_ocl_log) DECL_LLVM_GEN_FUNCTION(EXP, __gen_ocl_exp) DECL_LLVM_GEN_FUNCTION(POW, __gen_ocl_pow) DECL_LLVM_GEN_FUNCTION(RCP, __gen_ocl_rcp) -- 1.9.1 _______________________________________________ Beignet mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/beignet
