[cfe-commits] [libclc] r162274 - in /libclc/trunk: generic/include/clc/clc.h generic/include/clc/math/rsqrt.h test/rsqrt.cl
Peter Collingbourne
peter at pcc.me.uk
Tue Aug 21 03:48:35 PDT 2012
Author: pcc
Date: Tue Aug 21 05:48:35 2012
New Revision: 162274
URL: http://llvm.org/viewvc/llvm-project?rev=162274&view=rev
Log:
Add rsqrt builtin. Based on patch by Cassie Epps!
Added:
libclc/trunk/generic/include/clc/math/rsqrt.h
libclc/trunk/test/rsqrt.cl
Modified:
libclc/trunk/generic/include/clc/clc.h
Modified: libclc/trunk/generic/include/clc/clc.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/clc.h?rev=162274&r1=162273&r2=162274&view=diff
==============================================================================
--- libclc/trunk/generic/include/clc/clc.h (original)
+++ libclc/trunk/generic/include/clc/clc.h Tue Aug 21 05:48:35 2012
@@ -53,6 +53,7 @@
#include <clc/math/native_log2.h>
#include <clc/math/native_sin.h>
#include <clc/math/native_sqrt.h>
+#include <clc/math/rsqrt.h>
/* 6.11.3 Integer Functions */
#include <clc/integer/abs.h>
Added: libclc/trunk/generic/include/clc/math/rsqrt.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/rsqrt.h?rev=162274&view=auto
==============================================================================
--- libclc/trunk/generic/include/clc/math/rsqrt.h (added)
+++ libclc/trunk/generic/include/clc/math/rsqrt.h Tue Aug 21 05:48:35 2012
@@ -0,0 +1 @@
+#define rsqrt(x) (1.f/sqrt(x))
Added: libclc/trunk/test/rsqrt.cl
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/test/rsqrt.cl?rev=162274&view=auto
==============================================================================
--- libclc/trunk/test/rsqrt.cl (added)
+++ libclc/trunk/test/rsqrt.cl Tue Aug 21 05:48:35 2012
@@ -0,0 +1,6 @@
+#pragma OPENCL EXTENSION cl_khr_fp64 : enable
+
+__kernel void foo(float4 *x, double4 *y) {
+ x[1] = rsqrt(x[0]);
+ y[1] = rsqrt(y[0]);
+}
More information about the cfe-commits
mailing list