Add fabs builtin.

llvm-svn: 157595
This commit is contained in:
Peter Collingbourne
2012-05-28 22:22:13 +00:00
parent 913869be45
commit 6f154f16cd
3 changed files with 10 additions and 0 deletions

View File

@@ -33,6 +33,7 @@
/* 6.11.2 Math Functions */
#include <clc/math/cos.h>
#include <clc/math/fabs.h>
#include <clc/math/sin.h>
#include <clc/math/sqrt.h>
#include <clc/math/native_cos.h>

View File

@@ -0,0 +1,6 @@
#undef fabs
#define fabs __clc_fabs
#define FUNCTION __clc_fabs
#define INTRINSIC "llvm.fabs"
#include <clc/math/unary_intrin.inc>

3
libclc/test/fabs.cl Normal file
View File

@@ -0,0 +1,3 @@
__kernel void foo(float *f) {
*f = fabs(*f);
}