diff options
author | Tom Stellard <thomas.stellard@amd.com> | 2013-12-20 02:08:46 +0000 |
---|---|---|
committer | Tom Stellard <thomas.stellard@amd.com> | 2013-12-20 02:08:46 +0000 |
commit | 1f3c9ba9f14f88e79fee4e0ada4406129211194d (patch) | |
tree | 7be819e60a9f44542c90d59b97e5ccb1ae0ba2c2 /libclc | |
parent | c0a5aaeab0de2cd345efb6afb372d7dff2c36ee7 (diff) | |
download | bcm5719-llvm-1f3c9ba9f14f88e79fee4e0ada4406129211194d.tar.gz bcm5719-llvm-1f3c9ba9f14f88e79fee4e0ada4406129211194d.zip |
Implement trunc builtin.
OpenCL C lang says that trunc rounds towards zero.
llvm.trunc.* intrinsic rounds to integer not larger in magnitude.
These definitions are equivalent.
Patch by: Jan Vesely
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 197769
Diffstat (limited to 'libclc')
-rw-r--r-- | libclc/generic/include/clc/clc.h | 1 | ||||
-rw-r--r-- | libclc/generic/include/clc/math/trunc.h | 9 |
2 files changed, 10 insertions, 0 deletions
diff --git a/libclc/generic/include/clc/clc.h b/libclc/generic/include/clc/clc.h index 8f0dbd33dc9..c14d072cc94 100644 --- a/libclc/generic/include/clc/clc.h +++ b/libclc/generic/include/clc/clc.h @@ -51,6 +51,7 @@ #include <clc/math/round.h> #include <clc/math/sin.h> #include <clc/math/sqrt.h> +#include <clc/math/trunc.h> #include <clc/math/native_cos.h> #include <clc/math/native_divide.h> #include <clc/math/native_exp.h> diff --git a/libclc/generic/include/clc/math/trunc.h b/libclc/generic/include/clc/math/trunc.h new file mode 100644 index 00000000000..d34f6619043 --- /dev/null +++ b/libclc/generic/include/clc/math/trunc.h @@ -0,0 +1,9 @@ +#undef trunc +#define trunc __clc_trunc + +#define __CLC_FUNCTION __clc_trunc +#define __CLC_INTRINSIC "llvm.trunc" +#include <clc/math/unary_intrin.inc> + +#undef __CLC_FUNCTION +#undef __CLC_INTRINSIC |