diff options
author | Ruiling Song <ruiling.song@intel.com> | 2015-01-29 10:36:19 +0800 |
---|---|---|
committer | Zhigang Gong <zhigang.gong@intel.com> | 2015-01-29 13:05:49 +0800 |
commit | 3c407838c11c52be6f2ccb237884073566ed8c90 (patch) | |
tree | 4c6530f5826c588365c721819bf92d2a0e2b77b2 /backend | |
parent | 081221651d6d1a3c5721bbaf492c757f2b665c4d (diff) |
libocl: using mad() to implement dot()
Signed-off-by: Ruiling Song <ruiling.song@intel.com>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Diffstat (limited to 'backend')
-rw-r--r-- | backend/src/libocl/src/ocl_geometric.cl | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/backend/src/libocl/src/ocl_geometric.cl b/backend/src/libocl/src/ocl_geometric.cl index e469ff9f..cd09968b 100644 --- a/backend/src/libocl/src/ocl_geometric.cl +++ b/backend/src/libocl/src/ocl_geometric.cl @@ -27,13 +27,13 @@ OVERLOADABLE float dot(float p0, float p1) { return p0 * p1; } OVERLOADABLE float dot(float2 p0, float2 p1) { - return p0.x * p1.x + p0.y * p1.y; + return mad(p0.x, p1.x, p0.y * p1.y); } OVERLOADABLE float dot(float3 p0, float3 p1) { - return p0.x * p1.x + p0.y * p1.y + p0.z * p1.z; + return mad(p0.x, p1.x, mad(p0.y, p1.y, p0.z*p1.z)); } OVERLOADABLE float dot(float4 p0, float4 p1) { - return p0.x * p1.x + p0.y * p1.y + p0.z * p1.z + p0.w * p1.w; + return mad(p0.x, p1.x, mad(p0.y, p1.y, mad(p0.z, p1.z, p0.w * p1.w))); } OVERLOADABLE float length(float x) { return __gen_ocl_fabs(x); } |