aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/builtins.def
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/builtins.def')
-rw-r--r--src/runtime/builtins.def301
1 files changed, 301 insertions, 0 deletions
diff --git a/src/runtime/builtins.def b/src/runtime/builtins.def
new file mode 100644
index 0000000..b94807b
--- /dev/null
+++ b/src/runtime/builtins.def
@@ -0,0 +1,301 @@
+def vecf : float2 float3 float4 float8 float16
+def veci : int2 int3 int4 int8 int16
+
+def vec : $vecf $veci
+def gentype : float $vecf
+
+// gentype acos(gentype)
+// REPL is defined in src/core/cpu/builtins.cpp
+//native float acos float : x:float
+ //return std::acos(x);
+//end
+
+//native $type acos $vecf : x:$type
+ //REPL($vecdim)
+ //result[i] = std::acos(x[i]);
+//end
+
+// gentype acosh(gentype)
+//native float acosh float : x:float
+ //return boost::math::acosh(x);
+//end
+
+//native $type acosh $vecf : x:$type
+ //REPL($vecdim)
+ //result[i] = boost::math::acosh(x[i]);
+//end
+
+// gentype acospi(gentype)
+//func float acospi float : x:float
+ //return acos(x) / M_PI;
+//end
+
+//native $type acospi $vecf : x:$type
+ //REPL($vecdim)
+ //result[i] = std::acos(x[i]) / M_PI;
+//end
+
+// gentype asin (gentype)
+//native float asin float : x:float
+ //return std::asin(x);
+//end
+
+//native $type asin $vecf : x:$type
+ //REPL($vecdim)
+ //result[i] = std::asin(x[i]);
+//end
+
+// gentype asinh (gentype)
+//native float asinh float : x:float
+ //return boost::math::asinh(x);
+//end
+
+//native $type asinh $vecf : x:$type
+ //REPL($vecdim)
+ //result[i] = boost::math::asinh(x[i]);
+//end
+
+// gentype asinpi (gentype x)
+//func float asinpi float : x:float
+ //return asin(x) / M_PI;
+//end
+
+//native $type asinpi $vecf : x:$type
+ //REPL($vecdim)
+ //result[i] = std::asin(x[i]) / M_PI;
+//end
+
+// gentype atan (gentype y_over_x)
+//native float atan float : y_over_x:float
+ //return std::atan(y_over_x);
+//end
+
+//native $type atan $vecf : y_over_x:$type
+ //REPL($vecdim)
+ //result[i] = std::atan(y_over_x[i]);
+//end
+
+// gentype atan2 (gentype y, gentype x)
+//func float atan2 float : x:float y:float
+ //return atan(y / x);
+//end
+
+//native $type atan2 $vecf : x:$type y:$type
+ //REPL($vecdim)
+ //result[i] = std::atan(y[i] / x[i]);
+//end
+
+// gentype atanh (gentype)
+//native float atanh float : x:float
+ //return boost::math::atanh(x);
+//end
+
+//native $type atanh $vecf : x:$type
+ //REPL($vecdim)
+ //result[i] = boost::math::atanh(x[i]);
+//end
+
+// gentype atanpi (gentype x)
+//func float atanpi float : x:float
+ //return atan(x) / M_PI;
+//end
+
+//native $type atanpi $vecf : x:$type
+ //REPL($vecdim)
+ //result[i] = std::atan(x[i]) / M_PI;
+//end
+
+// gentype atan2pi (gentype y, gentype x)
+//func float atan2pi float : x:float y:float
+ //return atan2(y, x) / M_PI;
+//end
+//
+//native $type atan2pi $vecf : x:$type y:$type
+ //REPL($vecdim)
+ //result[i] = std::atan(y[i] / x[i]) / M_PI;
+//end
+
+// gentype cbrt (gentype)
+//native float cbrt float : x:float
+ //return boost::math::cbrt(x);
+//end
+//
+//native $type cbrt $vecf : x:$type
+ //REPL($vecdim)
+ //result[i] = boost::math::cbrt(x[i]);
+//end
+
+// gentype ceil (gentype)
+//native float ceil float : x:float
+ //return std::ceil(x);
+//end
+//
+//native $type ceil $vecf : x:$type
+ //REPL($vecdim)
+ //result[i] = std::ceil(x[i]);
+//end
+
+// gentype copysign (gentype x, gentype y)
+//func $type copysign $gentype : x:$type y:$type
+ //return (
+ //(x < 0.0f & y > 0.0f) |
+ //(x > 0.0f & y < 0.0f)
+ //? -x : x);
+//end
+
+//gentype cos (gentype)
+//native float cos float : x:float
+ //return std::cos(x);
+//end
+
+//native $type cos $vecf : x:$type
+ //REPL($vecdim)
+ //result[i] = std::cos(x[i]);
+//end
+
+// gentype cosh (gentype)
+//native float cosh float : x:float
+ //return std::cosh(x);
+//end
+
+//native $type cosh $vecf : x:$type
+ //REPL($vecdim)
+ //result[i] = std::cosh(x[i]);
+//end
+
+// gentype cospi (gentype x)
+//func $type cospi $gentype : x:$type
+ //return cos(x * (float)M_PI);
+//end
+
+// TODO: gentype erfc (gentype)
+// TODO: gentype erf (gentype)
+
+// gentype exp(gentype x)
+//native float exp float : x:float
+ //return std::exp(x);
+//end
+//
+//native $type exp $vecf : x:$type
+ //REPL($vecdim)
+ //result[i] = std::exp(x[i]);
+//end
+//
+// gentype exp2(gentype x)
+//native float exp2 float : x:float
+ //return exp2f(x);
+//end
+//
+//native $type exp2 $vecf : x:$type
+ //REPL($vecdim)
+ //result[i] = exp2f(x[i]);
+//end
+//
+//// gentype exp10(gentype x)
+//native float exp10 float : x:float
+ //return exp10f(x);
+//end
+//
+//native $type exp10 $vecf : x:$type
+ //REPL($vecdim)
+ //result[i] = exp10f(x[i]);
+//end
+//
+//// gentype expm1(gentype x)
+//func $type expm1 $gentype : x:$type
+ //return exp(x) - 1.0f;
+//end
+//
+//// gentype fdim(x, y)
+//func $type fdim $gentype : x:$type y:$type
+ //return (x > y ? x - y : 0.0f);
+//end
+//
+// gentype floor(gentype x) (TODO: SSE fast path : float->int->float)
+//native float floor float : x:float
+ //return std::floor(x);
+//end
+//
+//native $type floor $vecf : x:$type
+ //REPL($vecdim)
+ //result[i] = std::floor(x[i]);
+//end
+//
+//// gentype fma(a, b, c) : a*b + c (TODO)
+//func $type fma $gentype : a:$type b:$type c:$type
+ //return (a * b) + c;
+//end
+//
+//// gentype trunc(x)
+//native float trunc float : x:float
+ //return boost::math::trunc(x);
+//end
+//
+//native $type trunc $vecf : x:$type
+ //REPL($vecdim)
+ //result[i] = boost::math::trunc(x[i]);
+//end
+//
+//// gentype fmod(x, y)
+//func $type fmod $gentype : x:$type y:$type
+ //return x - y * trunc(x / y);
+//end
+//
+// gentype fract(gentype x, gentype *iptr)
+//func $type fract $gentype : x:$type iptr:*$type
+ //*iptr = floor(x);
+ //return fmin(x - *iptr, 0x1.fffffep-1f);
+//end
+
+// gentype frexp(gentype x, intn *exp)
+//native float frexp float : x:float exp:*int
+ //return std::frexp(x, exp);
+//end
+//
+//native $type frexp $vecf : x:$type exp:*int$vecdim
+ //REPL($vecdim)
+ //result[i] = std::frexp(x[i], &exp[i]);
+//end
+//
+//// gentype sqrt(gentype x)
+//native float sqrt float : x:float
+ //return std::sqrt(x);
+//end
+//
+//native double sqrt double : x:double
+ //return std::sqrt(x);
+//end
+//
+//native double log double : x:double
+ //return std::log(x);
+//end
+//
+//native $type sqrt $vecf : x:$type
+ //REPL($vecdim)
+ //result[i] = std::sqrt(x[i]);
+//end
+//
+//// gentype hypot(gentype x, gentype y)
+//func $type hypot $gentype : x:$type y:$type
+ //return sqrt(x*x + y*y);
+//end
+
+// intn ilogb(gentype x)
+//native int ilogb float : x:float
+ //return ilogb(x);
+//end
+
+//native int$vecdim ilogb $vecf : x:$type
+ //REPL($vecdim)
+ //result[i] = ilogb(x[i]);
+//end
+
+// gentype ldexp(gentype x, intn n)
+//native float ldexp float : x:float n:int
+ //return std::ldexp(x, n);
+//end
+
+//native $type ldexp $vecf : x:$type n:int$vecdim
+ //REPL($vecdim)
+ //result[i] = std::ldexp(x[i], n[i]);
+//end