mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-15 04:00:56 +00:00
math: Add asin implementation
asin(x) = atan2(x, sqrt( 1-x^2 )) alternatively: asin(x) = PI/2 - acos(x) Use the atan2 implementation since it produces slightly shorter bitcode and R600 machine code. Signed-off-by: Aaron Watry <awatry@gmail.com> Reviewed-by: Jan Vesely <jan.vesely@rutgers.edu> llvm-svn: 217510
This commit is contained in:
parent
268beab921
commit
951ab64d19
@ -33,6 +33,7 @@
|
||||
|
||||
/* 6.11.2 Math Functions */
|
||||
#include <clc/math/acos.h>
|
||||
#include <clc/math/asin.h>
|
||||
#include <clc/math/atan.h>
|
||||
#include <clc/math/atan2.h>
|
||||
#include <clc/math/copysign.h>
|
||||
|
2
libclc/generic/include/clc/math/asin.h
Normal file
2
libclc/generic/include/clc/math/asin.h
Normal file
@ -0,0 +1,2 @@
|
||||
#define __CLC_BODY <clc/math/asin.inc>
|
||||
#include <clc/math/gentype.inc>
|
1
libclc/generic/include/clc/math/asin.inc
Normal file
1
libclc/generic/include/clc/math/asin.inc
Normal file
@ -0,0 +1 @@
|
||||
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE asin(__CLC_GENTYPE x);
|
@ -30,6 +30,7 @@ integer/sub_sat_if.ll
|
||||
integer/sub_sat_impl.ll
|
||||
integer/upsample.cl
|
||||
math/acos.cl
|
||||
math/asin.cl
|
||||
math/atan.cl
|
||||
math/atan2.cl
|
||||
math/copysign.cl
|
||||
|
8
libclc/generic/lib/math/asin.cl
Normal file
8
libclc/generic/lib/math/asin.cl
Normal file
@ -0,0 +1,8 @@
|
||||
#include <clc/clc.h>
|
||||
|
||||
#ifdef cl_khr_fp64
|
||||
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
|
||||
#endif
|
||||
|
||||
#define __CLC_BODY <asin.inc>
|
||||
#include <clc/math/gentype.inc>
|
3
libclc/generic/lib/math/asin.inc
Normal file
3
libclc/generic/lib/math/asin.inc
Normal file
@ -0,0 +1,3 @@
|
||||
_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE asin(__CLC_GENTYPE x) {
|
||||
return atan2(x, sqrt( (__CLC_GENTYPE)1.0 -(x*x) ));
|
||||
}
|
Loading…
Reference in New Issue
Block a user