Add rsqrt builtin. Based on patch by Cassie Epps!

llvm-svn: 162274
This commit is contained in:
Peter Collingbourne
2012-08-21 10:48:35 +00:00
parent e1d91f73ec
commit 354686be76
3 changed files with 8 additions and 0 deletions

View File

@@ -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>

View File

@@ -0,0 +1 @@
#define rsqrt(x) (1.f/sqrt(x))

6
libclc/test/rsqrt.cl Normal file
View File

@@ -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]);
}