[Beignet] [PATCH 6/7] replace mad with llvm intrinsic.
xionghu.luo at intel.com
xionghu.luo at intel.com
Mon Mar 9 22:59:47 PDT 2015
From: Luo Xionghu <xionghu.luo at intel.com>
translate native mad to llvm.fma.
Signed-off-by: Luo Xionghu <xionghu.luo at intel.com>
---
backend/src/libocl/tmpl/ocl_math.tmpl.cl | 2 +-
backend/src/llvm/llvm_gen_backend.cpp | 9 ---------
backend/src/llvm/llvm_gen_ocl_function.hxx | 1 -
3 files changed, 1 insertion(+), 11 deletions(-)
diff --git a/backend/src/libocl/tmpl/ocl_math.tmpl.cl b/backend/src/libocl/tmpl/ocl_math.tmpl.cl
index 40b6401..d9e677b 100644
--- a/backend/src/libocl/tmpl/ocl_math.tmpl.cl
+++ b/backend/src/libocl/tmpl/ocl_math.tmpl.cl
@@ -2616,7 +2616,7 @@ OVERLOADABLE float ldexp(float x, int n) {
return __gen_ocl_internal_ldexp(x, n);
}
-PURE CONST float __gen_ocl_mad(float a, float b, float c);
+CONST float __gen_ocl_mad(float a, float b, float c) __asm("llvm.fma" ".f32");
PURE CONST float __gen_ocl_fmax(float a, float b);
PURE CONST float __gen_ocl_fmin(float a, float b);
diff --git a/backend/src/llvm/llvm_gen_backend.cpp b/backend/src/llvm/llvm_gen_backend.cpp
index 6549950..d9ac6e0 100644
--- a/backend/src/llvm/llvm_gen_backend.cpp
+++ b/backend/src/llvm/llvm_gen_backend.cpp
@@ -2738,7 +2738,6 @@ namespace gbe
case GEN_OCL_UPSAMPLE_SHORT:
case GEN_OCL_UPSAMPLE_INT:
case GEN_OCL_UPSAMPLE_LONG:
- case GEN_OCL_MAD:
case GEN_OCL_FMAX:
case GEN_OCL_FMIN:
case GEN_OCL_SADD_SAT_CHAR:
@@ -3323,14 +3322,6 @@ namespace gbe
ctx.I64MADSAT(getUnsignedType(ctx, I.getType()), dst, src0, src1, src2);
break;
}
- case GEN_OCL_MAD: {
- GBE_ASSERT(AI != AE); const ir::Register src0 = this->getRegister(*AI); ++AI;
- GBE_ASSERT(AI != AE); const ir::Register src1 = this->getRegister(*AI); ++AI;
- GBE_ASSERT(AI != AE); const ir::Register src2 = this->getRegister(*AI); ++AI;
- const ir::Register dst = this->getRegister(&I);
- ctx.MAD(getType(ctx, I.getType()), dst, src0, src1, src2);
- break;
- }
case GEN_OCL_FMAX:
case GEN_OCL_FMIN:{
GBE_ASSERT(AI != AE); const ir::Register src0 = this->getRegister(*AI); ++AI;
diff --git a/backend/src/llvm/llvm_gen_ocl_function.hxx b/backend/src/llvm/llvm_gen_ocl_function.hxx
index 2cc63bd..5f5451c 100644
--- a/backend/src/llvm/llvm_gen_ocl_function.hxx
+++ b/backend/src/llvm/llvm_gen_ocl_function.hxx
@@ -22,7 +22,6 @@ DECL_LLVM_GEN_FUNCTION(GET_WORK_DIM, __gen_ocl_get_work_dim)
DECL_LLVM_GEN_FUNCTION(RSQ, __gen_ocl_rsqrt)
DECL_LLVM_GEN_FUNCTION(POW, __gen_ocl_pow)
DECL_LLVM_GEN_FUNCTION(RCP, __gen_ocl_rcp)
-DECL_LLVM_GEN_FUNCTION(MAD, __gen_ocl_mad)
DECL_LLVM_GEN_FUNCTION(FMAX, __gen_ocl_fmax)
DECL_LLVM_GEN_FUNCTION(FMIN, __gen_ocl_fmin)
--
1.9.1
More information about the Beignet
mailing list