Merge changes from topic 'f16-math'

* changes:
  Test f16 math functions in RsTest
  Implement f16 math functions in the runtime
  Generated .rsh files for f16 math functions
  Add RS math functions for F16.
diff --git a/api/rs_convert.spec b/api/rs_convert.spec
index 810ac76..9b53777 100644
--- a/api/rs_convert.spec
+++ b/api/rs_convert.spec
@@ -73,6 +73,28 @@
 arg: #2#1 v, compatible(#3)
 end:
 
+function: convert_#3#1
+version: UNRELEASED
+attrib: const
+w: 2, 3, 4
+t: f16
+t: u8, u16, u32, u64, i8, i16, i32, i64, f32, f64
+ret: #3#1
+arg: #2#1 v, compatible(#3)
+test: none
+end:
+
+function: convert_#3#1
+version: UNRELEASED
+attrib: const
+w: 2, 3, 4
+t: u8, u16, u32, u64, i8, i16, i32, i64, f32, f64
+t: f16
+ret: #3#1
+arg: #2#1 v, compatible(#3)
+test: none
+end:
+
 function: rsPackColorTo8888
 attrib: const
 ret: uchar4
diff --git a/api/rs_math.spec b/api/rs_math.spec
index abf08f9..070bb4f 100644
--- a/api/rs_math.spec
+++ b/api/rs_math.spec
@@ -48,6 +48,7 @@
  </ul>
 end:
 
+# TODO Add f16 versions of these constants.
 constant: M_1_PI
 value: 0.318309886183790671537767526745028724f
 summary: 1 / pi, as a 32 bit float
@@ -176,6 +177,16 @@
  See also @native_acos().
 end:
 
+function: acos
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: acosh
 version: 9
 attrib: const
@@ -190,6 +201,16 @@
  See also @native_acosh().
 end:
 
+function: acosh
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: acospi
 version: 9
 attrib: const
@@ -206,6 +227,16 @@
  See also @native_acospi().
 end:
 
+function: acospi
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: asin
 version: 9
 attrib: const
@@ -220,6 +251,16 @@
  See also @native_asin().
 end:
 
+function: asin
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: asinh
 version: 9
 attrib: const
@@ -234,6 +275,16 @@
  See also @native_asinh().
 end:
 
+function: asinh
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: asinpi
 version: 9
 attrib: const
@@ -250,6 +301,16 @@
  See also @native_asinpi().
 end:
 
+function: asinpi
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: atan
 version: 9
 attrib: const
@@ -264,6 +325,16 @@
  See also @native_atan().
 end:
 
+function: atan
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: atan2
 version: 9
 attrib: const
@@ -279,6 +350,17 @@
  See also @native_atan2().
 end:
 
+function: atan2
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 numerator
+arg: #2#1 denominator
+test: none
+end:
+
 function: atan2pi
 version: 9
 attrib: const
@@ -296,6 +378,17 @@
  See also @native_atan2pi().
 end:
 
+function: atan2pi
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 numerator
+arg: #2#1 denominator
+test: none
+end:
+
 function: atanh
 version: 9
 attrib: const
@@ -310,6 +403,16 @@
  See also @native_atanh().
 end:
 
+function: atanh
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: atanpi
 version: 9
 attrib: const
@@ -326,6 +429,16 @@
  See also @native_atanpi().
 end:
 
+function: atanpi
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: cbrt
 version: 9
 attrib: const
@@ -340,6 +453,16 @@
  See also @native_cbrt().
 end:
 
+function: cbrt
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: ceil
 version: 9
 attrib: const
@@ -356,6 +479,16 @@
  See also @floor().
 end:
 
+function: ceil
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: clamp
 version: 9
 attrib: const
@@ -409,6 +542,30 @@
 arg: #2 max_value, above(min_value)
 end:
 
+function: clamp
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 value
+arg: #2#1 min_value
+arg: #2#1 max_value, above(min_value)
+test: none
+end:
+
+function: clamp
+version: UNRELEASED
+attrib: const
+w: 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 value
+arg: #2 min_value
+arg: #2 max_value, above(min_value)
+test: none
+end:
+
 function: clz
 version: 9
 attrib: const
@@ -423,6 +580,7 @@
  For example, <code>clz((char)0x03)</code> returns 6.
 end:
 
+# TODO add f16 copysign
 function: copysign
 version: 9
 attrib: const
@@ -454,6 +612,16 @@
  See also @native_cos().
 end:
 
+function: cos
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: cosh
 version: 9
 attrib: const
@@ -468,6 +636,16 @@
  See also @native_cosh().
 end:
 
+function: cosh
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: cospi
 version: 9
 attrib: const
@@ -484,6 +662,16 @@
  See also @native_cospi().
 end:
 
+function: cospi
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: degrees
 version: 9
 attrib: const
@@ -496,6 +684,16 @@
  Converts from radians to degrees.
 end:
 
+function: degrees
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: erf
 version: 9
 attrib: const
@@ -508,6 +706,16 @@
  Returns the error function.
 end:
 
+function: erf
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: erfc
 version: 9
 attrib: const
@@ -520,6 +728,16 @@
  Returns the complementary error function.
 end:
 
+function: erfc
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: exp
 version: 9
 attrib: const
@@ -534,6 +752,16 @@
  See also @native_exp().
 end:
 
+function: exp
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: exp10
 version: 9
 attrib: const
@@ -548,6 +776,16 @@
  See also @native_exp10().
 end:
 
+function: exp10
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: exp2
 version: 9
 attrib: const
@@ -562,6 +800,16 @@
  See also @native_exp2().
 end:
 
+function: exp2
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: expm1
 version: 9
 attrib: const
@@ -576,6 +824,16 @@
  See also @native_expm1().
 end:
 
+function: expm1
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: fabs
 version: 9
 attrib: const
@@ -590,6 +848,16 @@
  For integers, use @abs().
 end:
 
+function: fabs
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: fdim
 version: 9
 attrib: const
@@ -605,6 +873,17 @@
  If a &gt; b, returns (a - b) otherwise returns 0f.
 end:
 
+function: fdim
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 a
+arg: #2#1 b
+test: none
+end:
+
 function: floor
 version: 9
 attrib: const
@@ -621,6 +900,16 @@
  See also @ceil().
 end:
 
+function: floor
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: fma
 version: 9
 attrib: const
@@ -639,6 +928,18 @@
  This extra precision is not guaranteed in rs_fp_relaxed mode.
 end:
 
+function: fma
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 multiplicand1
+arg: #2#1 multiplicand2
+arg: #2#1 offset
+test: none
+end:
+
 function: fmax
 version: 9
 attrib: const
@@ -655,6 +956,17 @@
 end:
 
 function: fmax
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 a
+arg: #2#1 b
+test: none
+end:
+
+function: fmax
 version: 9
 attrib: const
 w: 2, 3, 4
@@ -664,6 +976,17 @@
 arg: #2 b
 end:
 
+function: fmax
+version: UNRELEASED
+attrib: const
+w: 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 a
+arg: #2 b
+test: none
+end:
+
 function: fmin
 version: 9
 attrib: const
@@ -680,6 +1003,17 @@
 end:
 
 function: fmin
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 a
+arg: #2#1 b
+test: none
+end:
+
+function: fmin
 version: 9
 attrib: const
 w: 2, 3, 4
@@ -689,6 +1023,17 @@
 arg: #2 b
 end:
 
+function: fmin
+version: UNRELEASED
+attrib: const
+w: 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 a
+arg: #2 b
+test: none
+end:
+
 function: fmod
 version: 9
 attrib: const
@@ -706,6 +1051,18 @@
  while <code>@remainder(-3.8f, 2.f)</code> returns 0.2f (-3.8f - -2.f * 2.f).
 end:
 
+function: fmod
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 numerator
+arg: #2#1 denominator
+test: none
+end:
+
+# TODO Add (both variants) of fract for f16
 function: fract
 version: 9
 w: 1, 2, 3, 4
@@ -733,6 +1090,7 @@
  return fract(v, &unused);
 end:
 
+# TODO Add f16 frexp
 function: frexp
 version: 9
 w: 1, 2, 3, 4
@@ -812,6 +1170,18 @@
  See also @native_hypot().
 end:
 
+function: hypot
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 a
+arg: #2#1 b
+test: none
+end:
+
+# TODO Add f16 ilogb.  Should its return be short?
 function: ilogb
 version: 9
 attrib: const
@@ -847,6 +1217,17 @@
  See @frexp() for the reverse operation.
 end:
 
+# TODO Should this parameter be a short?
+function: ldexp
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+ret: half#1
+arg: half#1 mantissa
+arg: int#1 exponent
+test: none
+end:
+
 function: ldexp
 version: 9
 attrib: const
@@ -856,6 +1237,16 @@
 arg: int exponent
 end:
 
+function: ldexp
+version: UNRELEASED
+attrib: const
+w: 2, 3, 4
+ret: half#1
+arg: half#1 mantissa
+arg: int exponent
+test: none
+end:
+
 function: lgamma
 version: 9
 attrib: const
@@ -872,6 +1263,16 @@
 end:
 
 function: lgamma
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
+function: lgamma
 version: 9
 w: 1, 2, 3, 4
 t: f32
@@ -882,6 +1283,16 @@
 #TODO Temporary until bionic & associated drivers are fixed
 end:
 
+function: lgamma
+version: UNRELEASED
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+arg: int#1* sign_of_gamma
+test: none
+end:
+
 function: log
 version: 9
 attrib: const
@@ -896,6 +1307,16 @@
  See also @native_log().
 end:
 
+function: log
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: log10
 version: 9
 attrib: const
@@ -910,6 +1331,16 @@
  See also @native_log10().
 end:
 
+function: log10
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: log1p
 version: 9
 attrib: const
@@ -924,6 +1355,16 @@
  See also @native_log1p().
 end:
 
+function: log1p
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: log2
 version: 9
 attrib: const
@@ -938,6 +1379,16 @@
  See also @native_log2().
 end:
 
+function: log2
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: logb
 version: 9
 attrib: const
@@ -957,6 +1408,16 @@
  @ilogb() is similar but returns an integer.
 end:
 
+function: logb
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: mad
 version: 9
 attrib: const
@@ -975,6 +1436,18 @@
  In rs_fp_relaxed mode, mad() may not do the rounding after multiplicaiton.
 end:
 
+function: mad
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 multiplicand1
+arg: #2#1 multiplicand2
+arg: #2#1 offset
+test: none
+end:
+
 function: max
 version: 9
 attrib: const
@@ -989,6 +1462,17 @@
 end:
 
 function: max
+version:UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 a
+arg: #2#1 b
+test: none
+end:
+
+function: max
 version: 9
 attrib: const
 w: 2, 3, 4
@@ -999,6 +1483,17 @@
 end:
 
 function: max
+version: UNRELEASED
+attrib: const
+w: 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 a
+arg: #2 b
+test: none
+end:
+
+function: max
 version: 9 20
 attrib: const
 w: 1
@@ -1082,6 +1577,17 @@
 end:
 
 function: min
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 a
+arg: #2#1 b
+test: none
+end:
+
+function: min
 version: 9
 attrib: const
 w: 2, 3, 4
@@ -1092,6 +1598,17 @@
 end:
 
 function: min
+version: UNRELEASED
+attrib: const
+w: 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 a
+arg: #2 b
+test: none
+end:
+
+function: min
 version: 9 20
 attrib: const
 w: 1
@@ -1179,6 +1696,18 @@
 end:
 
 function: mix
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 start
+arg: #2#1 stop
+arg: #2#1 fraction
+test: none
+end:
+
+function: mix
 version: 9
 attrib: const
 w: 2, 3, 4
@@ -1189,6 +1718,19 @@
 arg: #2 fraction
 end:
 
+function: mix
+version: UNRELEASED
+attrib: const
+w: 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 start
+arg: #2#1 stop
+arg: #2 fraction
+test: none
+end:
+
+# TODO Add f16 modf
 function: modf
 version: 9
 w: 1, 2, 3, 4
@@ -1218,6 +1760,17 @@
  Returns a NaN value (Not a Number).
 end:
 
+function: nan_half
+version: UNRELEASED
+attrib: const
+t: f16
+ret: #1
+summary: Not a Number
+description:
+  Returns a half-precision floating point NaN value (Not a Number).
+test: none
+end:
+
 function: native_acos
 version: 21
 attrib: const
@@ -1236,6 +1789,17 @@
 test: limited(0.0005)
 end:
 
+function: native_acos
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+# TODO Need range(-1,1) here similar to the float version?
+arg: #2#1 v
+test: none
+end:
+
 function: native_acosh
 version: 21
 attrib: const
@@ -1252,6 +1816,16 @@
 test: limited(0.0005)
 end:
 
+function: native_acosh
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: native_acospi
 version: 21
 attrib: const
@@ -1272,6 +1846,17 @@
 test: limited(0.0005)
 end:
 
+function: native_acospi
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+# TODO Need range(-1,1) here similar to the float version?
+arg: #2#1 v
+test: none
+end:
+
 function: native_asin
 version: 21
 attrib: const
@@ -1290,6 +1875,17 @@
 test: limited(0.0005)
 end:
 
+function: native_asin
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+# TODO Need range(-1,1) here similar to the float version?
+arg: #2#1 v
+test: none
+end:
+
 function: native_asinh
 version: 21
 attrib: const
@@ -1306,6 +1902,16 @@
 test: limited(0.0005)
 end:
 
+function: native_asinh
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: native_asinpi
 version: 21
 attrib: const
@@ -1326,6 +1932,17 @@
 test: limited(0.0005)
 end:
 
+function: native_asinpi
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+# TODO Need range(-1,1) here similar to the float version?
+arg: #2#1 v
+test: none
+end:
+
 function: native_atan
 version: 21
 attrib: const
@@ -1342,6 +1959,17 @@
 test: limited(0.0005)
 end:
 
+function: native_atan
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+# TODO Need range(-1,1) here similar to the float version?
+arg: #2#1 v
+test: none
+end:
+
 function: native_atan2
 version: 21
 attrib: const
@@ -1359,6 +1987,17 @@
 test: limited(0.0005)
 end:
 
+function: native_atan2
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 numerator
+arg: #2#1 denominator
+test: none
+end:
+
 function: native_atan2pi
 version: 21
 attrib: const
@@ -1379,6 +2018,17 @@
 test: limited(0.0005)
 end:
 
+function: native_atan2pi
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 numerator
+arg: #2#1 denominator
+test: none
+end:
+
 function: native_atanh
 version: 21
 attrib: const
@@ -1395,6 +2045,17 @@
 test: limited(0.0005)
 end:
 
+function: native_atanh
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+# TODO Need range(-1,1) here similar to the float version?
+arg: #2#1 v
+test: none
+end:
+
 function: native_atanpi
 version: 21
 attrib: const
@@ -1413,6 +2074,17 @@
 test: limited(0.0005)
 end:
 
+function: native_atanpi
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+# TODO Need range(-1,1) here similar to the float version?
+arg: #2#1 v
+test: none
+end:
+
 function: native_cbrt
 version: 21
 attrib: const
@@ -1427,6 +2099,16 @@
  See also @cbrt().
 end:
 
+function: native_cbrt
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: native_cos
 version: 21
 attrib: const
@@ -1441,6 +2123,16 @@
  See also @cos().
 end:
 
+function: native_cos
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: native_cosh
 version: 21
 attrib: const
@@ -1455,6 +2147,16 @@
  See also @cosh().
 end:
 
+function: native_cosh
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: native_cospi
 version: 21
 attrib: const
@@ -1471,6 +2173,16 @@
  See also @cospi().
 end:
 
+function: native_cospi
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: native_divide
 version: 21
 attrib: const
@@ -1484,6 +2196,17 @@
  Computes the approximate division of two values.
 end:
 
+function: native_divide
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 left_vector
+arg: #2#1 right_vector
+test: none
+end:
+
 function: native_exp
 version: 18
 attrib: const
@@ -1502,6 +2225,17 @@
 test: limited
 end:
 
+function: native_exp
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+# TODO Need range(-86, 86) here similar to the float version?
+arg: #2#1 v
+test: none
+end:
+
 function: native_exp10
 version: 18
 attrib: const
@@ -1520,6 +2254,17 @@
 test: limited
 end:
 
+function: native_exp10
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+# TODO Need range(-37, 37) here similar to the float version?
+arg: #2#1 v
+test: none
+end:
+
 function: native_exp2
 version: 18
 attrib: const
@@ -1538,6 +2283,17 @@
 test: limited
 end:
 
+function: native_exp2
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+# TODO Need range(-125, 125) here similar to the float version?
+arg: #2#1 v
+test: none
+end:
+
 function: native_expm1
 version: 21
 attrib: const
@@ -1552,6 +2308,16 @@
  See also @expm1().
 end:
 
+function: native_expm1
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: native_hypot
 version: 21
 attrib: const
@@ -1567,6 +2333,17 @@
  See also @hypot().
 end:
 
+function: native_hypot
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 a
+arg: #2#1 b
+test: none
+end:
+
 function: native_log
 version: 18
 attrib: const
@@ -1584,6 +2361,17 @@
 test: limited
 end:
 
+function: native_log
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+# TODO Need range(10e-10,10e10) here similar to the float version?
+arg: #2#1 v
+test: none
+end:
+
 function: native_log10
 version: 18
 attrib: const
@@ -1601,6 +2389,17 @@
 test: limited
 end:
 
+function: native_log10
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+# TODO Need range(10e-10,10e10) here similar to the float version?
+arg: #2#1 v
+test: none
+end:
+
 function: native_log1p
 version: 21
 attrib: const
@@ -1615,6 +2414,16 @@
  See also @log1p().
 end:
 
+function: native_log1p
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: native_log2
 version: 18
 attrib: const
@@ -1632,6 +2441,17 @@
 test: limited
 end:
 
+function: native_log2
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+# TODO Need range(10e-10,10e10) here similar to the float version?
+arg: #2#1 v
+test: none
+end:
+
 function: native_powr
 version: 18
 attrib: const
@@ -1648,6 +2468,19 @@
 test: limited
 end:
 
+function: native_powr
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+# TODO Need range(0, 256) here similar to the float version?
+arg: #2#1 base
+# TODO Need range(-15,15) here similar to the float version?
+arg: #2#1 exponent
+test: none
+end:
+
 function: native_recip
 version: 21
 attrib: const
@@ -1662,6 +2495,16 @@
  See also @half_recip().
 end:
 
+function: native_recip
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: native_rootn
 version: 21
 attrib: const
@@ -1677,6 +2520,17 @@
  See also @rootn().
 end:
 
+function: native_rootn
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+arg: int#1 n
+test: none
+end:
+
 function: native_rsqrt
 version: 21
 attrib: const
@@ -1691,6 +2545,16 @@
  See also @rsqrt(), @half_rsqrt().
 end:
 
+function: native_rsqrt
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: native_sin
 version: 21
 attrib: const
@@ -1705,6 +2569,16 @@
  See also @sin().
 end:
 
+function: native_sin
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: native_sincos
 version: 21
 w: 1, 2, 3, 4
@@ -1721,6 +2595,16 @@
 test: limited(0.0005)
 end:
 
+function: native_sincos
+version: UNRELEASED
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+arg: #2#1* cos
+test: none
+end:
+
 function: native_sinh
 version: 21
 attrib: const
@@ -1735,6 +2619,16 @@
  See also @sinh().
 end:
 
+function: native_sinh
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: native_sinpi
 version: 21
 attrib: const
@@ -1751,6 +2645,16 @@
  See also @sinpi().
 end:
 
+function: native_sinpi
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: native_sqrt
 version: 21
 attrib: const
@@ -1765,6 +2669,16 @@
  See also @sqrt(), @half_sqrt().
 end:
 
+function: native_sqrt
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: native_tan
 version: 21
 attrib: const
@@ -1777,6 +2691,16 @@
  Returns the approximate tangent of an angle measured in radians.
 end:
 
+function: native_tan
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: native_tanh
 version: 21
 attrib: const
@@ -1791,6 +2715,16 @@
  See also @tanh().
 end:
 
+function: native_tanh
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: native_tanpi
 version: 21
 attrib: const
@@ -1807,6 +2741,17 @@
  See also @tanpi().
 end:
 
+function: native_tanpi
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
+# TODO add f16 nextafter
 function: nextafter
 version: 9
 attrib: const
@@ -1839,6 +2784,17 @@
  base to be non-negative.
 end:
 
+function: pow
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 base
+arg: #2#1 exponent
+test: none
+end:
+
 function: pown
 version: 9
 attrib: const
@@ -1855,6 +2811,17 @@
  base to be non-negative.
 end:
 
+function: pown
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 base
+arg: int#1 exponent
+test: none
+end:
+
 function: powr
 version: 9
 attrib: const
@@ -1873,6 +2840,18 @@
  See also @native_powr().
 end:
 
+function: powr
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+# TODO Need range(0,3000) here similar to the float version?
+arg: #2#1 base
+arg: #2#1 exponent
+test: none
+end:
+
 function: radians
 version: 9
 attrib: const
@@ -1885,6 +2864,16 @@
  Converts from degrees to radians.
 end:
 
+function: radians
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: remainder
 version: 9
 attrib: const
@@ -1903,6 +2892,17 @@
  while <code>remainder(-3.8f, 2.f)</code> returns 0.2f (-3.8f - -2.f * 2.f).
 end:
 
+function: remainder
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 numerator
+arg: #2#1 denominator
+test: none
+end:
+
 function: remquo
 version: 9
 w: 1, 2, 3, 4
@@ -1927,6 +2927,17 @@
 test: custom
 end:
 
+function: remquo
+version: UNRELEASED
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 numerator
+arg: #2#1 denominator
+arg: int#1* quotient
+test: none
+end:
+
 function: rint
 version: 9
 attrib: const
@@ -1945,6 +2956,16 @@
  @round() is similar but rounds away from zero.  @trunc() truncates the decimal fraction.
 end:
 
+function: rint
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: rootn
 version: 9
 attrib: const
@@ -1960,6 +2981,17 @@
  See also @native_rootn().
 end:
 
+function: rootn
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+arg: int#1 n
+test: none
+end:
+
 function: round
 version: 9
 attrib: const
@@ -1978,6 +3010,16 @@
  @rint() is similar but rounds half values toward even.  @trunc() truncates the decimal fraction.
 end:
 
+function: round
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: rsqrt
 version: 9
 attrib: const
@@ -1992,6 +3034,16 @@
  See also @half_rsqrt(), @native_rsqrt().
 end:
 
+function: rsqrt
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: sign
 version: 9
 attrib: const
@@ -2008,6 +3060,16 @@
  else return 0.f;
 end:
 
+function: sign
+version:UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: sin
 version: 9
 attrib: const
@@ -2022,6 +3084,16 @@
  See also @native_sin().
 end:
 
+function: sin
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: sincos
 version: 9
 w: 1, 2, 3, 4
@@ -2036,6 +3108,16 @@
  See also @native_sincos().
 end:
 
+function: sincos
+version: UNRELEASED
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+arg: #2#1* cos
+test: none
+end:
+
 function: sinh
 version: 9
 attrib: const
@@ -2050,6 +3132,16 @@
  See also @native_sinh().
 end:
 
+function: sinh
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: sinpi
 version: 9
 attrib: const
@@ -2066,6 +3158,16 @@
  See also @native_sinpi().
 end:
 
+function: sinpi
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: sqrt
 version: 9
 attrib: const
@@ -2080,6 +3182,16 @@
  See also @half_sqrt(), @native_sqrt().
 end:
 
+function: sqrt
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: step
 version: 9
 attrib: const
@@ -2098,6 +3210,17 @@
 end:
 
 function: step
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 edge
+arg: #2#1 v
+test: none
+end:
+
+function: step
 version: 9
 attrib: const
 w: 2, 3, 4
@@ -2108,6 +3231,17 @@
 end:
 
 function: step
+version: UNRELEASED
+attrib: const
+w: 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 edge
+arg: #2 v
+test: none
+end:
+
+function: step
 version: 21
 attrib: const
 w: 2, 3, 4
@@ -2117,6 +3251,17 @@
 arg: #2#1 v
 end:
 
+function: step
+version: UNRELEASED
+attrib: const
+w: 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2 edge
+arg: #2#1 v
+test: none
+end:
+
 function: tan
 version: 9
 attrib: const
@@ -2131,6 +3276,16 @@
  See also @native_tan().
 end:
 
+function: tan
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: tanh
 version: 9
 attrib: const
@@ -2145,6 +3300,16 @@
  See also @native_tanh().
 end:
 
+function: tanh
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: tanpi
 version: 9
 attrib: const
@@ -2161,6 +3326,16 @@
  See also @native_tanpi().
 end:
 
+function: tanpi
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: tgamma
 version: 9
 attrib: const
@@ -2175,6 +3350,16 @@
  See also @lgamma().
 end:
 
+function: tgamma
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: trunc
 version: 9
 attrib: const
@@ -2191,6 +3376,16 @@
  See @rint() and @round() for other rounding options.
 end:
 
+function: trunc
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
 function: rsClamp
 # TODO Why always_inline?
 attrib: const, always_inline
diff --git a/api/rs_vector_math.spec b/api/rs_vector_math.spec
index a699d33..90edb86 100644
--- a/api/rs_vector_math.spec
+++ b/api/rs_vector_math.spec
@@ -48,6 +48,17 @@
 test: vector
 end:
 
+function: cross
+version: UNRELEASED
+attrib: const
+w: 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 left_vector
+arg: #2#1 right_vector
+test: none
+end:
+
 function: distance
 version: 9
 attrib: const
@@ -64,6 +75,17 @@
 test: vector
 end:
 
+function: distance
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2
+arg: #2#1 left_vector
+arg: #2#1 right_vector
+test: none
+end:
+
 function: dot
 version: 9
 attrib: const
@@ -78,6 +100,17 @@
 test: vector
 end:
 
+function: dot
+version: UNRELEASED
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2
+arg: #2#1 left_vector
+arg: #2#1 right_vector
+test: none
+end:
+
 function: fast_distance
 version: 17
 attrib: const
@@ -136,6 +169,7 @@
 test: vector
 end:
 
+# TODO Add f16 length
 function: length
 version: 9
 attrib: const
@@ -197,6 +231,7 @@
 test: vector
 end:
 
+# TODO Add f16 normalize
 function: normalize
 version: 9
 attrib: const
diff --git a/driver/runtime/arch/clamp.c b/driver/runtime/arch/clamp.c
index 86d6f96..22e30da 100644
--- a/driver/runtime/arch/clamp.c
+++ b/driver/runtime/arch/clamp.c
@@ -26,6 +26,7 @@
     return amount < low ? low : (amount > high ? high : amount);                    \
 }
 
+S_CLAMP(half);
 //_CLAMP(float);  implemented in .ll
 S_CLAMP(double);
 S_CLAMP(char);
@@ -90,6 +91,7 @@
     return r;                                                                       \
 }
 
+V_CLAMP(half);
 //V_CLAMP(float);  implemented in .ll
 V_CLAMP(double);
 V_CLAMP(char);
diff --git a/driver/runtime/rs_cl.c b/driver/runtime/rs_cl.c
index 884adfd..65ce94e 100644
--- a/driver/runtime/rs_cl.c
+++ b/driver/runtime/rs_cl.c
@@ -1520,3 +1520,541 @@
 #undef IN_FUNC_IN
 #undef XN_FUNC_XN_XN_BODY
 #undef IN_FUNC_IN_IN_BODY
+
+typedef union {
+  half hval;
+  short sval;
+} fp16_shape_type;
+
+/* half h = unsigned short s; */
+#define SET_HALF_WORD(h, s) \
+do {                        \
+  fp16_shape_type fp16_u;   \
+  fp16_u.sval = (s);        \
+  (h) = fp16_u.hval;        \
+} while (0)
+
+static const unsigned short kHalfPositiveInfinity = 0x7c00;
+
+/* Define f16 functions of the form
+ *     HN output = fn(HN input)
+ * where HN is scalar or vector half type
+ */
+#define HN_FUNC_HN(fn)                                                    \
+extern half __attribute__((overloadable)) fn(half h) {                    \
+    return (half) fn((float) h);                                          \
+}                                                                         \
+extern half2 __attribute__((overloadable)) fn(half2 v) {                  \
+  return convert_half2(fn(convert_float2(v)));                            \
+}                                                                         \
+extern half3 __attribute__((overloadable)) fn(half3 v) {                  \
+  return convert_half3(fn(convert_float3(v)));                            \
+}                                                                         \
+extern half4 __attribute__((overloadable)) fn(half4 v) {                  \
+  return convert_half4(fn(convert_float4(v)));                            \
+}
+
+/* Define f16 functions of the form
+ *     HN output = fn(HN input1, HN input2)
+ * where HN is scalar or vector half type
+ */
+#define HN_FUNC_HN_HN(fn)                                                 \
+extern half __attribute__((overloadable)) fn(half h1, half h2) {          \
+    return (half) fn((float) h1, (float) h2);                             \
+}                                                                         \
+extern half2 __attribute__((overloadable)) fn(half2 v1, half2 v2) {       \
+  return convert_half2(fn(convert_float2(v1),                             \
+                          convert_float2(v2)));                           \
+}                                                                         \
+extern half3 __attribute__((overloadable)) fn(half3 v1, half3 v2) {       \
+  return convert_half3(fn(convert_float3(v1),                             \
+                          convert_float3(v2)));                           \
+}                                                                         \
+extern half4 __attribute__((overloadable)) fn(half4 v1, half4 v2) {       \
+  return convert_half4(fn(convert_float4(v1),                             \
+                          convert_float4(v2)));                           \
+}
+
+/* Define f16 functions of the form
+ *     HN output = fn(HN input1, half input2)
+ * where HN is scalar or vector half type
+ */
+#define HN_FUNC_HN_H(fn)                                                  \
+extern half2 __attribute__((overloadable)) fn(half2 v1, half v2) {        \
+  return convert_half2(fn(convert_float2(v1), (float) v2));               \
+}                                                                         \
+extern half3 __attribute__((overloadable)) fn(half3 v1, half v2) {        \
+  return convert_half3(fn(convert_float3(v1), (float) v2));               \
+}                                                                         \
+extern half4 __attribute__((overloadable)) fn(half4 v1, half v2) {        \
+  return convert_half4(fn(convert_float4(v1), (float) v2));               \
+}
+
+/* Define f16 functions of the form
+ *     HN output = fn(HN input1, HN input2, HN input3)
+ * where HN is scalar or vector half type
+ */
+#define HN_FUNC_HN_HN_HN(fn)                                                   \
+extern half __attribute__((overloadable)) fn(half h1, half h2, half h3) {      \
+    return (half) fn((float) h1, (float) h2, (float) h3);                      \
+}                                                                              \
+extern half2 __attribute__((overloadable)) fn(half2 v1, half2 v2, half2 v3) {  \
+  return convert_half2(fn(convert_float2(v1),                                  \
+                          convert_float2(v2),                                  \
+                          convert_float2(v3)));                                \
+}                                                                              \
+extern half3 __attribute__((overloadable)) fn(half3 v1, half3 v2, half3 v3) {  \
+  return convert_half3(fn(convert_float3(v1),                                  \
+                          convert_float3(v2),                                  \
+                          convert_float3(v3)));                                \
+}                                                                              \
+extern half4 __attribute__((overloadable)) fn(half4 v1, half4 v2, half4 v3) {  \
+  return convert_half4(fn(convert_float4(v1),                                  \
+                          convert_float4(v2),                                  \
+                          convert_float4(v3)));                                \
+}
+
+/* Define f16 functions of the form
+ *     HN output = fn(HN input1, IN input2)
+ * where HN is scalar or vector half type and IN the equivalent integer type
+ * of same vector length.
+ */
+#define HN_FUNC_HN_IN(fn)                                                 \
+extern half __attribute__((overloadable)) fn(half h1, int v) {            \
+    return (half) fn((float) h1, v);                                      \
+}                                                                         \
+extern half2 __attribute__((overloadable)) fn(half2 v1, int2 v2) {        \
+  return convert_half2(fn(convert_float2(v1), v2));                       \
+}                                                                         \
+extern half3 __attribute__((overloadable)) fn(half3 v1, int3 v2) {        \
+  return convert_half3(fn(convert_float3(v1), v2));                       \
+}                                                                         \
+extern half4 __attribute__((overloadable)) fn(half4 v1, int4 v2) {        \
+  return convert_half4(fn(convert_float4(v1), v2));                       \
+}
+
+/* Define f16 functions of the form
+ *     half output = fn(HN input1)
+ * where HN is a scalar or vector half type.
+ */
+#define H_FUNC_HN(fn)                                                     \
+extern half __attribute__((overloadable)) fn(half h) {                    \
+    return (half) fn((float) h);                                          \
+}                                                                         \
+extern half __attribute__((overloadable)) fn(half2 v) {                   \
+  return fn(convert_float2(v));                                           \
+}                                                                         \
+extern half __attribute__((overloadable)) fn(half3 v) {                   \
+  return fn(convert_float3(v));                                           \
+}                                                                         \
+extern half __attribute__((overloadable)) fn(half4 v) {                   \
+  return fn(convert_float4(v));                                           \
+}
+
+/* Define f16 functions of the form
+ *     half output = fn(HN input1, HN input2)
+ * where HN is a scalar or vector half type.
+ */
+#define H_FUNC_HN_HN(fn)                                                  \
+extern half __attribute__((overloadable)) fn(half h1, half h2) {          \
+    return (half) fn((float) h1, (float) h2);                             \
+}                                                                         \
+extern half __attribute__((overloadable)) fn(half2 v1, half2 v2) {        \
+  return fn(convert_float2(v1), convert_float2(v2));                      \
+}                                                                         \
+extern half __attribute__((overloadable)) fn(half3 v1, half3 v2) {        \
+  return fn(convert_float3(v1), convert_float3(v2));                      \
+}                                                                         \
+extern half __attribute__((overloadable)) fn(half4 v1, half4 v2) {        \
+  return fn(convert_float4(v1), convert_float4(v2));                      \
+}
+
+/* Define f16 functions of the form
+ *     HN output = fn(HN input1, HN input2)
+ * where HN is a vector half type.  The functions are defined to call the
+ * scalar function of the same name.
+ */
+#define SCALARIZE_HN_FUNC_HN_HN(fn)                                       \
+extern half2 __attribute__((overloadable)) fn(half2 v1, half2 v2) {       \
+  half2 ret;                                                              \
+  ret.x = fn(v1.x, v2.x);                                                 \
+  ret.y = fn(v1.y, v2.y);                                                 \
+  return ret;                                                             \
+}                                                                         \
+extern half3 __attribute__((overloadable)) fn(half3 v1, half3 v2) {       \
+  half3 ret;                                                              \
+  ret.x = fn(v1.x, v2.x);                                                 \
+  ret.y = fn(v1.y, v2.y);                                                 \
+  ret.z = fn(v1.z, v2.z);                                                 \
+  return ret;                                                             \
+}                                                                         \
+extern half4 __attribute__((overloadable)) fn(half4 v1, half4 v2) {       \
+  half4 ret;                                                              \
+  ret.x = fn(v1.x, v2.x);                                                 \
+  ret.y = fn(v1.y, v2.y);                                                 \
+  ret.z = fn(v1.z, v2.z);                                                 \
+  ret.w = fn(v1.w, v2.w);                                                 \
+  return ret;                                                             \
+}                                                                         \
+
+HN_FUNC_HN(acos);
+HN_FUNC_HN(acosh);
+HN_FUNC_HN(acospi);
+HN_FUNC_HN(asin);
+HN_FUNC_HN(asinh);
+HN_FUNC_HN(asinpi);
+HN_FUNC_HN(atan);
+HN_FUNC_HN(atanh);
+HN_FUNC_HN(atanpi);
+HN_FUNC_HN_HN(atan2);
+HN_FUNC_HN_HN(atan2pi);
+
+HN_FUNC_HN(cbrt);
+HN_FUNC_HN(ceil);
+
+// TODO Add copysign
+
+HN_FUNC_HN(cos);
+HN_FUNC_HN(cosh);
+HN_FUNC_HN(cospi);
+
+extern half3 __attribute__((overloadable)) cross(half3 lhs, half3 rhs) {
+    half3 r;
+    r.x = lhs.y * rhs.z  - lhs.z * rhs.y;
+    r.y = lhs.z * rhs.x  - lhs.x * rhs.z;
+    r.z = lhs.x * rhs.y  - lhs.y * rhs.x;
+    return r;
+}
+
+extern half4 __attribute__((overloadable)) cross(half4 lhs, half4 rhs) {
+    half4 r;
+    r.x = lhs.y * rhs.z  - lhs.z * rhs.y;
+    r.y = lhs.z * rhs.x  - lhs.x * rhs.z;
+    r.z = lhs.x * rhs.y  - lhs.y * rhs.x;
+    r.w = 0.f;
+    return r;
+}
+
+HN_FUNC_HN(degrees);
+H_FUNC_HN_HN(distance);
+H_FUNC_HN_HN(dot);
+
+HN_FUNC_HN(erf);
+HN_FUNC_HN(erfc);
+HN_FUNC_HN(exp);
+HN_FUNC_HN(exp10);
+HN_FUNC_HN(exp2);
+HN_FUNC_HN(expm1);
+
+HN_FUNC_HN(fabs);
+HN_FUNC_HN_HN(fdim);
+HN_FUNC_HN(floor);
+HN_FUNC_HN_HN_HN(fma);
+HN_FUNC_HN_HN(fmax);
+HN_FUNC_HN_H(fmax);
+HN_FUNC_HN_HN(fmin);
+HN_FUNC_HN_H(fmin);
+HN_FUNC_HN_HN(fmod);
+
+// TODO Add (both variants) of fract
+// TODO Add frexp
+
+HN_FUNC_HN_HN(hypot);
+
+// TODO Add ilogb
+
+HN_FUNC_HN_IN(ldexp);
+extern half2 __attribute__((overloadable)) ldexp(half2 v, int exponent) {
+    return convert_half2(ldexp(convert_float2(v), exponent));
+}
+extern half3 __attribute__((overloadable)) ldexp(half3 v, int exponent) {
+    return convert_half3(ldexp(convert_float3(v), exponent));
+}
+extern half4 __attribute__((overloadable)) ldexp(half4 v, int exponent) {
+    return convert_half4(ldexp(convert_float4(v), exponent));
+}
+
+H_FUNC_HN(length);
+HN_FUNC_HN(lgamma);
+
+extern half __attribute__((overloadable)) lgamma(half h, int *signp) {
+    return (half) lgamma((float) h, signp);
+}
+extern half2 __attribute__((overloadable)) lgamma(half2 v, int2 *signp) {
+    return convert_half2(lgamma(convert_float2(v), signp));
+}
+extern half3 __attribute__((overloadable)) lgamma(half3 v, int3 *signp) {
+    return convert_half3(lgamma(convert_float3(v), signp));
+}
+extern half4 __attribute__((overloadable)) lgamma(half4 v, int4 *signp) {
+    return convert_half4(lgamma(convert_float4(v), signp));
+}
+
+HN_FUNC_HN(log);
+HN_FUNC_HN(log10);
+HN_FUNC_HN(log1p);
+HN_FUNC_HN(log2);
+HN_FUNC_HN(logb);
+
+HN_FUNC_HN_HN_HN(mad);
+HN_FUNC_HN_HN(max);
+HN_FUNC_HN_H(max); // TODO can this be arch-specific similar to _Z3maxDv2_ff?
+HN_FUNC_HN_HN(min);
+HN_FUNC_HN_H(min); // TODO can this be arch-specific similar to _Z3minDv2_ff?
+
+extern half __attribute__((overloadable)) mix(half start, half stop, half amount) {
+    return start + (stop - start) * amount;
+}
+extern half2 __attribute__((overloadable)) mix(half2 start, half2 stop, half2 amount) {
+    return start + (stop - start) * amount;
+}
+extern half3 __attribute__((overloadable)) mix(half3 start, half3 stop, half3 amount) {
+    return start + (stop - start) * amount;
+}
+extern half4 __attribute__((overloadable)) mix(half4 start, half4 stop, half4 amount) {
+    return start + (stop - start) * amount;
+}
+extern half2 __attribute__((overloadable)) mix(half2 start, half2 stop, half amount) {
+    return start + (stop - start) * amount;
+}
+extern half3 __attribute__((overloadable)) mix(half3 start, half3 stop, half amount) {
+    return start + (stop - start) * amount;
+}
+extern half4 __attribute__((overloadable)) mix(half4 start, half4 stop, half amount) {
+    return start + (stop - start) * amount;
+}
+
+// TODO Define modf.  Does it make sense to delegate to the float?
+
+half __attribute__((overloadable)) nan_half() {
+  unsigned short nan_short = kHalfPositiveInfinity | 0x0200;
+  half nan;
+  SET_HALF_WORD(nan, nan_short);
+  return nan;
+}
+
+// TODO Add nextafter
+
+HN_FUNC_HN(normalize);
+
+HN_FUNC_HN_HN(pow);
+HN_FUNC_HN_IN(pown);
+HN_FUNC_HN_HN(powr);
+HN_FUNC_HN(radians);
+HN_FUNC_HN_HN(remainder);
+
+extern half __attribute__((overloadable)) remquo(half n, half d, int *quo) {
+    return (float) remquo((float) n, (float) d, quo);
+}
+extern half2 __attribute__((overloadable)) remquo(half2 n, half2 d, int2 *quo) {
+    return convert_half2(remquo(convert_float2(d), convert_float2(n), quo));
+}
+extern half3 __attribute__((overloadable)) remquo(half3 n, half3 d, int3 *quo) {
+    return convert_half3(remquo(convert_float3(d), convert_float3(n), quo));
+}
+extern half4 __attribute__((overloadable)) remquo(half4 n, half4 d, int4 *quo) {
+    return convert_half4(remquo(convert_float4(d), convert_float4(n), quo));
+}
+
+HN_FUNC_HN(rint);
+HN_FUNC_HN_IN(rootn);
+HN_FUNC_HN(round);
+HN_FUNC_HN(rsqrt);
+
+extern half __attribute__((overloadable)) sign(half h) {
+    if (h > 0) return (half) 1.f;
+    if (h < 0) return (half) -1.f;
+    return h;
+}
+extern half2 __attribute__((overloadable)) sign(half2 v) {
+    half2 ret;
+    ret.x = sign(v.x);
+    ret.y = sign(v.y);
+    return ret;
+}
+extern half3 __attribute__((overloadable)) sign(half3 v) {
+    half3 ret;
+    ret.x = sign(v.x);
+    ret.y = sign(v.y);
+    ret.z = sign(v.z);
+    return ret;
+}
+extern half4 __attribute__((overloadable)) sign(half4 v) {
+    half4 ret;
+    ret.x = sign(v.x);
+    ret.y = sign(v.y);
+    ret.z = sign(v.z);
+    ret.w = sign(v.w);
+    return ret;
+}
+
+HN_FUNC_HN(sin);
+
+extern half __attribute__((overloadable)) sincos(half v, half *cosptr) {
+    *cosptr = cos(v);
+    return sin(v);
+}
+// TODO verify if LLVM eliminates the duplicate convert_float2
+extern half2 __attribute__((overloadable)) sincos(half2 v, half2 *cosptr) {
+    *cosptr = cos(v);
+    return sin(v);
+}
+extern half3 __attribute__((overloadable)) sincos(half3 v, half3 *cosptr) {
+    *cosptr = cos(v);
+    return sin(v);
+}
+extern half4 __attribute__((overloadable)) sincos(half4 v, half4 *cosptr) {
+    *cosptr = cos(v);
+    return sin(v);
+}
+
+HN_FUNC_HN(sinh);
+HN_FUNC_HN(sinpi);
+HN_FUNC_HN(sqrt);
+
+extern half __attribute__((overloadable)) step(half edge, half v) {
+    return (v < edge) ? 0.f : 1.f;
+}
+extern half2 __attribute__((overloadable)) step(half2 edge, half2 v) {
+    half2 r;
+    r.x = (v.x < edge.x) ? 0.f : 1.f;
+    r.y = (v.y < edge.y) ? 0.f : 1.f;
+    return r;
+}
+extern half3 __attribute__((overloadable)) step(half3 edge, half3 v) {
+    half3 r;
+    r.x = (v.x < edge.x) ? 0.f : 1.f;
+    r.y = (v.y < edge.y) ? 0.f : 1.f;
+    r.z = (v.z < edge.z) ? 0.f : 1.f;
+    return r;
+}
+extern half4 __attribute__((overloadable)) step(half4 edge, half4 v) {
+    half4 r;
+    r.x = (v.x < edge.x) ? 0.f : 1.f;
+    r.y = (v.y < edge.y) ? 0.f : 1.f;
+    r.z = (v.z < edge.z) ? 0.f : 1.f;
+    r.w = (v.w < edge.w) ? 0.f : 1.f;
+    return r;
+}
+extern half2 __attribute__((overloadable)) step(half2 edge, half v) {
+    half2 r;
+    r.x = (v < edge.x) ? 0.f : 1.f;
+    r.y = (v < edge.y) ? 0.f : 1.f;
+    return r;
+}
+extern half3 __attribute__((overloadable)) step(half3 edge, half v) {
+    half3 r;
+    r.x = (v < edge.x) ? 0.f : 1.f;
+    r.y = (v < edge.y) ? 0.f : 1.f;
+    r.z = (v < edge.z) ? 0.f : 1.f;
+    return r;
+}
+extern half4 __attribute__((overloadable)) step(half4 edge, half v) {
+    half4 r;
+    r.x = (v < edge.x) ? 0.f : 1.f;
+    r.y = (v < edge.y) ? 0.f : 1.f;
+    r.z = (v < edge.z) ? 0.f : 1.f;
+    r.w = (v < edge.w) ? 0.f : 1.f;
+    return r;
+}
+extern half2 __attribute__((overloadable)) step(half edge, half2 v) {
+    half2 r;
+    r.x = (v.x < edge) ? 0.f : 1.f;
+    r.y = (v.y < edge) ? 0.f : 1.f;
+    return r;
+}
+extern half3 __attribute__((overloadable)) step(half edge, half3 v) {
+    half3 r;
+    r.x = (v.x < edge) ? 0.f : 1.f;
+    r.y = (v.y < edge) ? 0.f : 1.f;
+    r.z = (v.z < edge) ? 0.f : 1.f;
+    return r;
+}
+extern half4 __attribute__((overloadable)) step(half edge, half4 v) {
+    half4 r;
+    r.x = (v.x < edge) ? 0.f : 1.f;
+    r.y = (v.y < edge) ? 0.f : 1.f;
+    r.z = (v.z < edge) ? 0.f : 1.f;
+    r.w = (v.w < edge) ? 0.f : 1.f;
+    return r;
+}
+
+HN_FUNC_HN(tan);
+HN_FUNC_HN(tanh);
+HN_FUNC_HN(tanpi);
+HN_FUNC_HN(tgamma);
+HN_FUNC_HN(trunc); // TODO: rethink: needs half-specific implementation?
+
+HN_FUNC_HN(native_acos);
+HN_FUNC_HN(native_acosh);
+HN_FUNC_HN(native_acospi);
+HN_FUNC_HN(native_asin);
+HN_FUNC_HN(native_asinh);
+HN_FUNC_HN(native_asinpi);
+HN_FUNC_HN(native_atan);
+HN_FUNC_HN(native_atanh);
+HN_FUNC_HN(native_atanpi);
+HN_FUNC_HN_HN(native_atan2);
+HN_FUNC_HN_HN(native_atan2pi);
+
+HN_FUNC_HN(native_cbrt);
+HN_FUNC_HN(native_cos);
+HN_FUNC_HN(native_cosh);
+HN_FUNC_HN(native_cospi);
+
+H_FUNC_HN_HN(native_distance);
+HN_FUNC_HN_HN(native_divide);
+
+HN_FUNC_HN(native_exp);
+HN_FUNC_HN(native_exp10);
+HN_FUNC_HN(native_exp2);
+HN_FUNC_HN(native_expm1);
+
+HN_FUNC_HN_HN(native_hypot);
+H_FUNC_HN(native_length);
+
+HN_FUNC_HN(native_log);
+HN_FUNC_HN(native_log10);
+HN_FUNC_HN(native_log1p);
+HN_FUNC_HN(native_log2);
+
+HN_FUNC_HN(native_normalize);
+
+HN_FUNC_HN_HN(native_powr); // TODO are parameter limits different for half?
+
+HN_FUNC_HN(native_recip);
+HN_FUNC_HN_IN(native_rootn);
+HN_FUNC_HN(native_rsqrt);
+
+HN_FUNC_HN(native_sin);
+
+extern half __attribute__((overloadable)) native_sincos(half v, half *cosptr) {
+    return sincos(v, cosptr);
+}
+extern half2 __attribute__((overloadable)) native_sincos(half2 v, half2 *cosptr) {
+    return sincos(v, cosptr);
+}
+extern half3 __attribute__((overloadable)) native_sincos(half3 v, half3 *cosptr) {
+    return sincos(v, cosptr);
+}
+extern half4 __attribute__((overloadable)) native_sincos(half4 v, half4 *cosptr) {
+    return sincos(v, cosptr);
+}
+
+HN_FUNC_HN(native_sinh);
+HN_FUNC_HN(native_sinpi);
+HN_FUNC_HN(native_sqrt);
+
+HN_FUNC_HN(native_tan);
+HN_FUNC_HN(native_tanh);
+HN_FUNC_HN(native_tanpi);
+
+#undef HN_FUNC_HN
+#undef HN_FUNC_HN_HN
+#undef HN_FUNC_HN_H
+#undef HN_FUNC_HN_HN_HN
+#undef HN_FUNC_HN_IN
+#undef H_FUNC_HN
+#undef H_FUNC_HN_HN
+#undef SCALARIZE_HN_FUNC_HN_HN
+
diff --git a/driver/runtime/rs_convert.c b/driver/runtime/rs_convert.c
index 53c321b..4656d10 100644
--- a/driver/runtime/rs_convert.c
+++ b/driver/runtime/rs_convert.c
@@ -38,6 +38,7 @@
                         CVT_FUNC_2(type, int)       \
                         CVT_FUNC_2(type, ulong)     \
                         CVT_FUNC_2(type, long)      \
+                        CVT_FUNC_2(type, half)      \
                         CVT_FUNC_2(type, float)     \
                         CVT_FUNC_2(type, double)
 
@@ -49,6 +50,7 @@
 CVT_FUNC(uint)
 CVT_FUNC(long)
 CVT_FUNC(ulong)
+CVT_FUNC(half)
 CVT_FUNC(float)
 CVT_FUNC(double)
 
diff --git a/java/tests/RsTest/src/com/android/rs/test/RSTestCore.java b/java/tests/RsTest/src/com/android/rs/test/RSTestCore.java
index 46773ef..efed0bf 100644
--- a/java/tests/RsTest/src/com/android/rs/test/RSTestCore.java
+++ b/java/tests/RsTest/src/com/android/rs/test/RSTestCore.java
@@ -98,6 +98,7 @@
         unitTests.add(new UT_math_conformance(this, mRes, mCtx));
         unitTests.add(new UT_math_agree(this, mRes, mCtx));
         unitTests.add(new UT_fp16(this, mRes, mCtx));
+        unitTests.add(new UT_math_fp16(this, mRes, mCtx));
         unitTests.add(new UT_min(this, mRes, mCtx));
         unitTests.add(new UT_int4(this, mRes, mCtx));
         unitTests.add(new UT_element(this, mRes, mCtx));
diff --git a/java/tests/RsTest/src/com/android/rs/test/UT_math_fp16.java b/java/tests/RsTest/src/com/android/rs/test/UT_math_fp16.java
new file mode 100644
index 0000000..8b705c2
--- /dev/null
+++ b/java/tests/RsTest/src/com/android/rs/test/UT_math_fp16.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.rs.test;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.renderscript.*;
+
+// IMPORTANT: This whole test fails on 32-bit x86.
+public class UT_math_fp16 extends UnitTest {
+    private Resources mRes;
+    private Allocation testAllocation1, testAllocation2;
+
+    protected UT_math_fp16(RSTestCore rstc, Resources res, Context ctx) {
+        super(rstc, "Math_fp16", ctx);
+        mRes = res;
+    }
+
+    public void run() {
+        RenderScript pRS = RenderScript.create(mCtx);
+        ScriptC_math_fp16 s = new ScriptC_math_fp16(pRS);
+        pRS.setMessageHandler(mRsMessage);
+
+        s.invoke_testFp16Math();
+
+        pRS.finish();
+        waitForMessage();
+        pRS.destroy();
+    }
+}
diff --git a/java/tests/RsTest/src/com/android/rs/test/math_fp16.rs b/java/tests/RsTest/src/com/android/rs/test/math_fp16.rs
new file mode 100644
index 0000000..121c8b5
--- /dev/null
+++ b/java/tests/RsTest/src/com/android/rs/test/math_fp16.rs
@@ -0,0 +1,340 @@
+#include "shared.rsh"
+
+static volatile half h1;
+static volatile half2 h2;
+static volatile half3 h3;
+static volatile half4 h4;
+
+static volatile int i1;
+static volatile int2 i2;
+static volatile int3 i3;
+static volatile int4 i4;
+
+#define TEST_HN_FUNC_HN(fn) \
+    h1 = fn(h1);            \
+    h2 = fn(h2);            \
+    h3 = fn(h3);            \
+    h4 = fn(h4);
+
+#define TEST_IN_FUNC_HN(fn) \
+    i1 = fn(h1);            \
+    i2 = fn(h2);            \
+    i3 = fn(h3);            \
+    i4 = fn(h4);
+
+#define TEST_HN_FUNC_HN_HN(fn)  \
+    h1 = fn(h1, h1);            \
+    h2 = fn(h2, h2);            \
+    h3 = fn(h3, h3);            \
+    h4 = fn(h4, h4);
+
+#define TEST_HN_FUNC_HN_IN(fn)  \
+    h1 = fn(h1, i1);            \
+    h2 = fn(h2, i2);            \
+    h3 = fn(h3, i3);            \
+    h4 = fn(h4, i4);
+
+#define TEST_HN_FUNC_HN_PIN(fn) \
+    h1 = fn(h1, (int *) &i1);   \
+    h2 = fn(h2, (int2 *) &i2);  \
+    h3 = fn(h3, (int3 *) &i3);  \
+    h4 = fn(h4, (int4 *) &i4);
+
+#define TEST_HN_FUNC_HN_I(fn)  \
+    h1 = fn(h1, i1);           \
+    h2 = fn(h2, i1);           \
+    h3 = fn(h3, i1);           \
+    h4 = fn(h4, i1);
+
+#define TEST_HN_FUNC_HN_H(fn)  \
+    h1 = fn(h1, h1);           \
+    h2 = fn(h2, h1);           \
+    h3 = fn(h3, h1);           \
+    h4 = fn(h4, h1);
+
+#define TEST_HN_FUNC_H_HN(fn)  \
+    h1 = fn(h1, h1);           \
+    h2 = fn(h1, h2);           \
+    h3 = fn(h1, h3);           \
+    h4 = fn(h1, h4);           \
+
+#define TEST_HN_FUNC_HN_PHN(fn) \
+    h1 = fn(h1, (half *) &h1);  \
+    h2 = fn(h2, (half2 *) &h2); \
+    h3 = fn(h3, (half3 *) &h3); \
+    h4 = fn(h4, (half4 *) &h4); \
+
+#define TEST_HN_FUNC_HN_HN_HN(fn)   \
+    h1 = fn(h1, h1, h1);            \
+    h2 = fn(h2, h2, h2);            \
+    h3 = fn(h3, h3, h3);            \
+    h4 = fn(h4, h4, h4);
+
+#define TEST_HN_FUNC_HN_HN_H(fn)   \
+    h1 = fn(h1, h1, h1);           \
+    h2 = fn(h2, h2, h1);           \
+    h3 = fn(h3, h3, h1);           \
+    h4 = fn(h4, h4, h1);
+
+#define TEST_HN_FUNC_HN_HN_PIN(fn) \
+    h1 = fn(h1, h1, (int *) &i1);  \
+    h2 = fn(h2, h2, (int2 *) &i2); \
+    h3 = fn(h3, h3, (int3 *) &i3); \
+    h4 = fn(h4, h4, (int4 *) &i4);
+
+static bool testAPI() {
+    TEST_HN_FUNC_HN(acos);
+    TEST_HN_FUNC_HN(acosh);
+    TEST_HN_FUNC_HN(acospi);
+
+    TEST_HN_FUNC_HN(asin);
+    TEST_HN_FUNC_HN(asinh);
+    TEST_HN_FUNC_HN(asinpi);
+
+    TEST_HN_FUNC_HN(atan);
+    TEST_HN_FUNC_HN_HN(atan2);
+    TEST_HN_FUNC_HN_HN(atan2pi);
+    TEST_HN_FUNC_HN(atanh);
+    TEST_HN_FUNC_HN(atanpi);
+
+    TEST_HN_FUNC_HN(cbrt);
+    TEST_HN_FUNC_HN(ceil);
+    // TODO add copysign test once function is added
+
+    TEST_HN_FUNC_HN(cos);
+    TEST_HN_FUNC_HN(cosh);
+    TEST_HN_FUNC_HN(cospi);
+
+    TEST_HN_FUNC_HN(degrees);
+    TEST_HN_FUNC_HN(erf);
+    TEST_HN_FUNC_HN(erfc);
+    TEST_HN_FUNC_HN(exp);
+    TEST_HN_FUNC_HN(exp10);
+    TEST_HN_FUNC_HN(exp2);
+    TEST_HN_FUNC_HN(expm1);
+
+    TEST_HN_FUNC_HN(fabs);
+    TEST_HN_FUNC_HN_HN(fdim);
+    TEST_HN_FUNC_HN(floor);
+    TEST_HN_FUNC_HN_HN_HN(fma);
+
+    TEST_HN_FUNC_HN_HN(fmax);
+    TEST_HN_FUNC_HN_H(fmax);
+    TEST_HN_FUNC_HN_HN(fmin);
+    TEST_HN_FUNC_HN_H(fmin);
+    TEST_HN_FUNC_HN_HN(fmod);
+
+    TEST_HN_FUNC_HN_HN(hypot);
+    // TODO add ilogb test once function is added
+    TEST_HN_FUNC_HN_IN(ldexp);
+    TEST_HN_FUNC_HN_I(ldexp);
+    TEST_HN_FUNC_HN(lgamma);
+    TEST_HN_FUNC_HN_PIN(lgamma);
+
+    TEST_HN_FUNC_HN(log);
+    TEST_HN_FUNC_HN(log10);
+    TEST_HN_FUNC_HN(log1p);
+    TEST_HN_FUNC_HN(log2);
+    TEST_HN_FUNC_HN(logb);
+
+    TEST_HN_FUNC_HN_HN_HN(mad);
+    TEST_HN_FUNC_HN_HN(max);
+    TEST_HN_FUNC_HN_H(max);
+    TEST_HN_FUNC_HN_HN(min);
+    TEST_HN_FUNC_HN_H(min);
+    TEST_HN_FUNC_HN_HN_HN(mix);
+    TEST_HN_FUNC_HN_HN_H(mix);
+
+    h1 = nan_half();
+
+    TEST_HN_FUNC_HN(native_acos);
+    TEST_HN_FUNC_HN(native_acosh);
+    TEST_HN_FUNC_HN(native_acospi);
+
+    TEST_HN_FUNC_HN(native_asin);
+    TEST_HN_FUNC_HN(native_asinh);
+    TEST_HN_FUNC_HN(native_asinpi);
+
+    TEST_HN_FUNC_HN(native_atan);
+    TEST_HN_FUNC_HN_HN(native_atan2);
+    TEST_HN_FUNC_HN_HN(native_atan2pi);
+    TEST_HN_FUNC_HN(native_atanh);
+    TEST_HN_FUNC_HN(native_atanpi);
+
+    TEST_HN_FUNC_HN(native_cbrt);
+    TEST_HN_FUNC_HN(native_cos);
+    TEST_HN_FUNC_HN(native_cosh);
+    TEST_HN_FUNC_HN(native_cospi);
+
+    TEST_HN_FUNC_HN_HN(native_divide);
+    TEST_HN_FUNC_HN(native_exp);
+    TEST_HN_FUNC_HN(native_exp10);
+    TEST_HN_FUNC_HN(native_exp2);
+    TEST_HN_FUNC_HN(native_expm1);
+
+    TEST_HN_FUNC_HN_HN(native_hypot);
+    TEST_HN_FUNC_HN(native_log);
+    TEST_HN_FUNC_HN(native_log10);
+    TEST_HN_FUNC_HN(native_log1p);
+    TEST_HN_FUNC_HN(native_log2);
+
+    TEST_HN_FUNC_HN_HN(native_powr);
+    TEST_HN_FUNC_HN(native_recip);
+    TEST_HN_FUNC_HN_IN(native_rootn);
+    TEST_HN_FUNC_HN(native_rsqrt);
+
+    TEST_HN_FUNC_HN(native_sin);
+    TEST_HN_FUNC_HN_PHN(native_sincos);
+    TEST_HN_FUNC_HN(native_sinh);
+    TEST_HN_FUNC_HN(native_sinpi);
+
+    TEST_HN_FUNC_HN(native_tan);
+    TEST_HN_FUNC_HN(native_tanh);
+    TEST_HN_FUNC_HN(native_tanpi);
+
+    // Bug: https://b.corp.google.com/issues/26099914
+    // The vector variant of nextafter causes an LLVM crash due to a known
+    // issue that has since been fixed upstream.  Enable the test after the fix
+    // is pulled into AOSP.
+    // TEST_HN_FUNC_HN_HN(nextafter);
+    TEST_HN_FUNC_HN_HN(pow);
+    TEST_HN_FUNC_HN_IN(pown);
+    TEST_HN_FUNC_HN_HN(powr);
+
+    TEST_HN_FUNC_HN(radians);
+    TEST_HN_FUNC_HN_HN(remainder);
+    TEST_HN_FUNC_HN_HN_PIN(remquo);
+    TEST_HN_FUNC_HN(rint);
+    TEST_HN_FUNC_HN_IN(rootn);
+    TEST_HN_FUNC_HN(round);
+    TEST_HN_FUNC_HN(rsqrt);
+
+    TEST_HN_FUNC_HN(sign);
+    TEST_HN_FUNC_HN(sin);
+    TEST_HN_FUNC_HN_PHN(sincos);
+    TEST_HN_FUNC_HN(sinh);
+    TEST_HN_FUNC_HN(sinpi);
+    TEST_HN_FUNC_HN(sqrt);
+
+    // Bug: https://b.corp.google.com/issues/26099914
+    // Some variants of the step functions cause LLVM crash due to a known
+    // issue that has since been fixed upstream.  Enable the test after the fix
+    // is pulled into AOSP.
+    // TEST_HN_FUNC_HN_HN(step);
+    // TEST_HN_FUNC_HN_H(step);
+    // TEST_HN_FUNC_H_HN(step);
+
+    TEST_HN_FUNC_HN(tan);
+    TEST_HN_FUNC_HN(tanh);
+    TEST_HN_FUNC_HN(tanpi);
+
+    TEST_HN_FUNC_HN(tgamma);
+    TEST_HN_FUNC_HN(trunc);
+
+    // Vector math functions
+    h3 = cross(h3, h3);
+    h4 = cross(h4, h4);
+    return true;
+}
+
+// TODO enable nextafter and ilogb tests once added to API
+/*
+static bool testNextAfter() {
+    // Number of non-NaN fp16 values:
+    //     2^11 - 2 (= 2046) different NaNs (10 mantisa bits, minus 1 for all
+    //     zero, times two for the signs.
+    //
+    //     +0 and -0 are equivalent (i.e. nextafter(-0, +inf) skips +0 and
+    //     returns the minium positive subnormal.
+    //
+    // So, number of distinct values when calling nextafter in a loop is
+    //     2^16 - 2046 - 1 = 63489
+    //
+
+    const unsigned int numDistinctExpected = 63489;
+    const unsigned int maxSteps = 65536;
+
+    half posinf, neginf;
+    (*(short *) &posinf) = 0x7c00;
+    (*(short *) &neginf) = 0xfc00;
+
+    unsigned int numDistinct;
+    half h, toward;
+
+    h = neginf;
+    toward = posinf;
+    numDistinct = 1; // h is the first distinct value
+    while (numDistinct < maxSteps && h != toward) {
+        h = nextafter(h, toward);
+        numDistinct ++;
+    }
+    // TODO we are not expected to handle subnormals.  This test needs to be
+    // revised to test only the normal values in f16.
+    if (numDistinct != numDistinctExpected) {
+        return false;
+    }
+
+    h = posinf;
+    toward = neginf;
+    numDistinct = 1; // h is the first distinct value
+    while (numDistinct < maxSteps && h != toward) {
+        h = nextafter(h, toward);
+        numDistinct ++;
+    }
+    if (numDistinct != numDistinctExpected) {
+        return false;
+    }
+    return true;
+}
+
+static bool testIlogb() {
+    bool failed = false;
+
+    // ilogb(2^n) = n.  Test at the boundary on either side of 2^n.
+    _RS_ASSERT_EQU(ilogb((half) 0.24), -3);
+    _RS_ASSERT_EQU(ilogb((half) 0.26), -2);
+    _RS_ASSERT_EQU(ilogb((half) 0.49), -2);
+    _RS_ASSERT_EQU(ilogb((half) 0.51), -1);
+    _RS_ASSERT_EQU(ilogb((half) 0.99), -1);
+    _RS_ASSERT_EQU(ilogb((half) 1.01), 0);
+    _RS_ASSERT_EQU(ilogb((half) 1.99), 0);
+    _RS_ASSERT_EQU(ilogb((half) 2.01), 1);
+    // _RS_ASSERT_EQU(ilogb((half) 0.00000005960), -24); // min subnormal = 2^-24
+
+    // Result is same irrespective of sign.
+    _RS_ASSERT_EQU(ilogb((half) -0.24), -3);
+    _RS_ASSERT_EQU(ilogb((half) -0.26), -2);
+    _RS_ASSERT_EQU(ilogb((half) -0.49), -2);
+    _RS_ASSERT_EQU(ilogb((half) -0.51), -1);
+    _RS_ASSERT_EQU(ilogb((half) -0.99), -1);
+    _RS_ASSERT_EQU(ilogb((half) -1.01), 0);
+    _RS_ASSERT_EQU(ilogb((half) -1.99), 0);
+    _RS_ASSERT_EQU(ilogb((half) -2.01), 1);
+    // _RS_ASSERT_EQU(ilogb((half) -0.00000005960), -24);
+
+    return !failed;
+}
+*/
+
+void testFp16Math() {
+    bool success = true;
+
+    success &= testAPI();
+    // TODO enable nextafter and ilogb tests once added to API
+    /*
+    success &= testNextAfter();
+    success &= testIlogb();
+    */
+
+    if (success) {
+        rsDebug("PASSED", 0);
+    } else {
+        rsDebug("FAILED", 0);
+    }
+
+    if (success) {
+        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
+    } else {
+        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
+    }
+}
diff --git a/scriptc/rs_convert.rsh b/scriptc/rs_convert.rsh
index f6380ba..7f92dfe 100644
--- a/scriptc/rs_convert.rsh
+++ b/scriptc/rs_convert.rsh
@@ -1246,6 +1246,306 @@
     convert_ulong4(uint4 v);
 #endif
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern float2 __attribute__((const, overloadable))
+    convert_float2(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern float3 __attribute__((const, overloadable))
+    convert_float3(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern float4 __attribute__((const, overloadable))
+    convert_float4(half4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern double2 __attribute__((const, overloadable))
+    convert_double2(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern double3 __attribute__((const, overloadable))
+    convert_double3(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern double4 __attribute__((const, overloadable))
+    convert_double4(half4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern char2 __attribute__((const, overloadable))
+    convert_char2(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern char3 __attribute__((const, overloadable))
+    convert_char3(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern char4 __attribute__((const, overloadable))
+    convert_char4(half4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern uchar2 __attribute__((const, overloadable))
+    convert_uchar2(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern uchar3 __attribute__((const, overloadable))
+    convert_uchar3(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern uchar4 __attribute__((const, overloadable))
+    convert_uchar4(half4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern short2 __attribute__((const, overloadable))
+    convert_short2(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern short3 __attribute__((const, overloadable))
+    convert_short3(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern short4 __attribute__((const, overloadable))
+    convert_short4(half4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern ushort2 __attribute__((const, overloadable))
+    convert_ushort2(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern ushort3 __attribute__((const, overloadable))
+    convert_ushort3(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern ushort4 __attribute__((const, overloadable))
+    convert_ushort4(half4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern int2 __attribute__((const, overloadable))
+    convert_int2(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern int3 __attribute__((const, overloadable))
+    convert_int3(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern int4 __attribute__((const, overloadable))
+    convert_int4(half4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern uint2 __attribute__((const, overloadable))
+    convert_uint2(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern uint3 __attribute__((const, overloadable))
+    convert_uint3(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern uint4 __attribute__((const, overloadable))
+    convert_uint4(half4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern long2 __attribute__((const, overloadable))
+    convert_long2(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern long3 __attribute__((const, overloadable))
+    convert_long3(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern long4 __attribute__((const, overloadable))
+    convert_long4(half4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern ulong2 __attribute__((const, overloadable))
+    convert_ulong2(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern ulong3 __attribute__((const, overloadable))
+    convert_ulong3(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern ulong4 __attribute__((const, overloadable))
+    convert_ulong4(half4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    convert_half2(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    convert_half3(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    convert_half4(float4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    convert_half2(double2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    convert_half3(double3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    convert_half4(double4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    convert_half2(char2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    convert_half3(char3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    convert_half4(char4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    convert_half2(uchar2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    convert_half3(uchar3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    convert_half4(uchar4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    convert_half2(short2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    convert_half3(short3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    convert_half4(short4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    convert_half2(ushort2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    convert_half3(ushort3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    convert_half4(ushort4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    convert_half2(int2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    convert_half3(int3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    convert_half4(int4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    convert_half2(uint2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    convert_half3(uint3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    convert_half4(uint4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    convert_half2(long2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    convert_half3(long3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    convert_half4(long4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    convert_half2(ulong2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    convert_half3(ulong3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    convert_half4(ulong4 v);
+#endif
+
 /*
  * rsPackColorTo8888: Create a uchar4 RGBA from floats
  *
diff --git a/scriptc/rs_math.rsh b/scriptc/rs_math.rsh
index 653672c..1a51316 100644
--- a/scriptc/rs_math.rsh
+++ b/scriptc/rs_math.rsh
@@ -215,6 +215,26 @@
 extern float4 __attribute__((const, overloadable))
     acos(float4 v);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    acos(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    acos(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    acos(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    acos(half4 v);
+#endif
+
 /*
  * acosh: Inverse hyperbolic cosine
  *
@@ -234,6 +254,26 @@
 extern float4 __attribute__((const, overloadable))
     acosh(float4 v);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    acosh(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    acosh(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    acosh(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    acosh(half4 v);
+#endif
+
 /*
  * acospi: Inverse cosine divided by pi
  *
@@ -255,6 +295,26 @@
 extern float4 __attribute__((const, overloadable))
     acospi(float4 v);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    acospi(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    acospi(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    acospi(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    acospi(half4 v);
+#endif
+
 /*
  * asin: Inverse sine
  *
@@ -274,6 +334,26 @@
 extern float4 __attribute__((const, overloadable))
     asin(float4 v);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    asin(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    asin(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    asin(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    asin(half4 v);
+#endif
+
 /*
  * asinh: Inverse hyperbolic sine
  *
@@ -293,6 +373,26 @@
 extern float4 __attribute__((const, overloadable))
     asinh(float4 v);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    asinh(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    asinh(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    asinh(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    asinh(half4 v);
+#endif
+
 /*
  * asinpi: Inverse sine divided by pi
  *
@@ -314,6 +414,26 @@
 extern float4 __attribute__((const, overloadable))
     asinpi(float4 v);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    asinpi(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    asinpi(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    asinpi(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    asinpi(half4 v);
+#endif
+
 /*
  * atan: Inverse tangent
  *
@@ -333,6 +453,26 @@
 extern float4 __attribute__((const, overloadable))
     atan(float4 v);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    atan(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    atan(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    atan(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    atan(half4 v);
+#endif
+
 /*
  * atan2: Inverse tangent of a ratio
  *
@@ -356,6 +496,26 @@
 extern float4 __attribute__((const, overloadable))
     atan2(float4 numerator, float4 denominator);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    atan2(half numerator, half denominator);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    atan2(half2 numerator, half2 denominator);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    atan2(half3 numerator, half3 denominator);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    atan2(half4 numerator, half4 denominator);
+#endif
+
 /*
  * atan2pi: Inverse tangent of a ratio, divided by pi
  *
@@ -381,6 +541,26 @@
 extern float4 __attribute__((const, overloadable))
     atan2pi(float4 numerator, float4 denominator);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    atan2pi(half numerator, half denominator);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    atan2pi(half2 numerator, half2 denominator);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    atan2pi(half3 numerator, half3 denominator);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    atan2pi(half4 numerator, half4 denominator);
+#endif
+
 /*
  * atanh: Inverse hyperbolic tangent
  *
@@ -400,6 +580,26 @@
 extern float4 __attribute__((const, overloadable))
     atanh(float4 v);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    atanh(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    atanh(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    atanh(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    atanh(half4 v);
+#endif
+
 /*
  * atanpi: Inverse tangent divided by pi
  *
@@ -421,6 +621,26 @@
 extern float4 __attribute__((const, overloadable))
     atanpi(float4 v);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    atanpi(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    atanpi(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    atanpi(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    atanpi(half4 v);
+#endif
+
 /*
  * cbrt: Cube root
  *
@@ -440,6 +660,26 @@
 extern float4 __attribute__((const, overloadable))
     cbrt(float4 v);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    cbrt(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    cbrt(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    cbrt(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    cbrt(half4 v);
+#endif
+
 /*
  * ceil: Smallest integer not less than a value
  *
@@ -461,6 +701,26 @@
 extern float4 __attribute__((const, overloadable))
     ceil(float4 v);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    ceil(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    ceil(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    ceil(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    ceil(half4 v);
+#endif
+
 /*
  * clamp: Restrain a value to a range
  *
@@ -778,6 +1038,41 @@
     clamp(ulong4 value, ulong min_value, ulong max_value);
 #endif
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    clamp(half value, half min_value, half max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    clamp(half2 value, half2 min_value, half2 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    clamp(half3 value, half3 min_value, half3 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    clamp(half4 value, half4 min_value, half4 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    clamp(half2 value, half min_value, half max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    clamp(half3 value, half min_value, half max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    clamp(half4 value, half min_value, half max_value);
+#endif
+
 /*
  * clz: Number of leading 0 bits
  *
@@ -897,6 +1192,26 @@
 extern float4 __attribute__((const, overloadable))
     cos(float4 v);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    cos(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    cos(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    cos(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    cos(half4 v);
+#endif
+
 /*
  * cosh: Hypebolic cosine
  *
@@ -916,6 +1231,26 @@
 extern float4 __attribute__((const, overloadable))
     cosh(float4 v);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    cosh(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    cosh(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    cosh(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    cosh(half4 v);
+#endif
+
 /*
  * cospi: Cosine of a number multiplied by pi
  *
@@ -937,6 +1272,26 @@
 extern float4 __attribute__((const, overloadable))
     cospi(float4 v);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    cospi(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    cospi(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    cospi(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    cospi(half4 v);
+#endif
+
 /*
  * degrees: Converts radians into degrees
  *
@@ -954,6 +1309,26 @@
 extern float4 __attribute__((const, overloadable))
     degrees(float4 v);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    degrees(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    degrees(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    degrees(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    degrees(half4 v);
+#endif
+
 /*
  * erf: Mathematical error function
  *
@@ -971,6 +1346,26 @@
 extern float4 __attribute__((const, overloadable))
     erf(float4 v);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    erf(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    erf(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    erf(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    erf(half4 v);
+#endif
+
 /*
  * erfc: Mathematical complementary error function
  *
@@ -988,6 +1383,26 @@
 extern float4 __attribute__((const, overloadable))
     erfc(float4 v);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    erfc(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    erfc(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    erfc(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    erfc(half4 v);
+#endif
+
 /*
  * exp: e raised to a number
  *
@@ -1007,6 +1422,26 @@
 extern float4 __attribute__((const, overloadable))
     exp(float4 v);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    exp(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    exp(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    exp(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    exp(half4 v);
+#endif
+
 /*
  * exp10: 10 raised to a number
  *
@@ -1026,6 +1461,26 @@
 extern float4 __attribute__((const, overloadable))
     exp10(float4 v);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    exp10(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    exp10(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    exp10(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    exp10(half4 v);
+#endif
+
 /*
  * exp2: 2 raised to a number
  *
@@ -1045,6 +1500,26 @@
 extern float4 __attribute__((const, overloadable))
     exp2(float4 v);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    exp2(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    exp2(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    exp2(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    exp2(half4 v);
+#endif
+
 /*
  * expm1: e raised to a number minus one
  *
@@ -1064,6 +1539,26 @@
 extern float4 __attribute__((const, overloadable))
     expm1(float4 v);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    expm1(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    expm1(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    expm1(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    expm1(half4 v);
+#endif
+
 /*
  * fabs: Absolute value of a float
  *
@@ -1083,6 +1578,26 @@
 extern float4 __attribute__((const, overloadable))
     fabs(float4 v);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    fabs(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    fabs(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    fabs(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    fabs(half4 v);
+#endif
+
 /*
  * fdim: Positive difference between two values
  *
@@ -1102,6 +1617,26 @@
 extern float4 __attribute__((const, overloadable))
     fdim(float4 a, float4 b);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    fdim(half a, half b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    fdim(half2 a, half2 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    fdim(half3 a, half3 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    fdim(half4 a, half4 b);
+#endif
+
 /*
  * floor: Smallest integer not greater than a value
  *
@@ -1123,6 +1658,26 @@
 extern float4 __attribute__((const, overloadable))
     floor(float4 v);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    floor(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    floor(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    floor(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    floor(half4 v);
+#endif
+
 /*
  * fma: Multiply and add
  *
@@ -1144,6 +1699,26 @@
 extern float4 __attribute__((const, overloadable))
     fma(float4 multiplicand1, float4 multiplicand2, float4 offset);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    fma(half multiplicand1, half multiplicand2, half offset);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    fma(half2 multiplicand1, half2 multiplicand2, half2 offset);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    fma(half3 multiplicand1, half3 multiplicand2, half3 offset);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    fma(half4 multiplicand1, half4 multiplicand2, half4 offset);
+#endif
+
 /*
  * fmax: Maximum of two floats
  *
@@ -1163,6 +1738,26 @@
 extern float4 __attribute__((const, overloadable))
     fmax(float4 a, float4 b);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    fmax(half a, half b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    fmax(half2 a, half2 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    fmax(half3 a, half3 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    fmax(half4 a, half4 b);
+#endif
+
 extern float2 __attribute__((const, overloadable))
     fmax(float2 a, float b);
 
@@ -1172,6 +1767,21 @@
 extern float4 __attribute__((const, overloadable))
     fmax(float4 a, float b);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    fmax(half2 a, half b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    fmax(half3 a, half b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    fmax(half4 a, half b);
+#endif
+
 /*
  * fmin: Minimum of two floats
  *
@@ -1191,6 +1801,26 @@
 extern float4 __attribute__((const, overloadable))
     fmin(float4 a, float4 b);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    fmin(half a, half b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    fmin(half2 a, half2 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    fmin(half3 a, half3 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    fmin(half4 a, half4 b);
+#endif
+
 extern float2 __attribute__((const, overloadable))
     fmin(float2 a, float b);
 
@@ -1200,6 +1830,21 @@
 extern float4 __attribute__((const, overloadable))
     fmin(float4 a, float b);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    fmin(half2 a, half b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    fmin(half3 a, half b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    fmin(half4 a, half b);
+#endif
+
 /*
  * fmod: Modulo
  *
@@ -1221,6 +1866,26 @@
 extern float4 __attribute__((const, overloadable))
     fmod(float4 numerator, float4 denominator);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    fmod(half numerator, half denominator);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    fmod(half2 numerator, half2 denominator);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    fmod(half3 numerator, half3 denominator);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    fmod(half4 numerator, half4 denominator);
+#endif
+
 /*
  * fract: Positive fractional part
  *
@@ -1400,6 +2065,26 @@
 extern float4 __attribute__((const, overloadable))
     hypot(float4 a, float4 b);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    hypot(half a, half b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    hypot(half2 a, half2 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    hypot(half3 a, half3 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    hypot(half4 a, half4 b);
+#endif
+
 /*
  * ilogb: Base two exponent
  *
@@ -1448,6 +2133,26 @@
 extern float4 __attribute__((const, overloadable))
     ldexp(float4 mantissa, int4 exponent);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    ldexp(half mantissa, int exponent);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    ldexp(half2 mantissa, int2 exponent);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    ldexp(half3 mantissa, int3 exponent);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    ldexp(half4 mantissa, int4 exponent);
+#endif
+
 extern float2 __attribute__((const, overloadable))
     ldexp(float2 mantissa, int exponent);
 
@@ -1457,6 +2162,21 @@
 extern float4 __attribute__((const, overloadable))
     ldexp(float4 mantissa, int exponent);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    ldexp(half2 mantissa, int exponent);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    ldexp(half3 mantissa, int exponent);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    ldexp(half4 mantissa, int exponent);
+#endif
+
 /*
  * lgamma: Natural logarithm of the gamma function
  *
@@ -1480,6 +2200,26 @@
 extern float4 __attribute__((const, overloadable))
     lgamma(float4 v);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    lgamma(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    lgamma(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    lgamma(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    lgamma(half4 v);
+#endif
+
 extern float __attribute__((overloadable))
     lgamma(float v, int* sign_of_gamma);
 
@@ -1492,6 +2232,26 @@
 extern float4 __attribute__((overloadable))
     lgamma(float4 v, int4* sign_of_gamma);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((overloadable))
+    lgamma(half v, int* sign_of_gamma);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((overloadable))
+    lgamma(half2 v, int2* sign_of_gamma);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((overloadable))
+    lgamma(half3 v, int3* sign_of_gamma);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((overloadable))
+    lgamma(half4 v, int4* sign_of_gamma);
+#endif
+
 /*
  * log: Natural logarithm
  *
@@ -1511,6 +2271,26 @@
 extern float4 __attribute__((const, overloadable))
     log(float4 v);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    log(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    log(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    log(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    log(half4 v);
+#endif
+
 /*
  * log10: Base 10 logarithm
  *
@@ -1530,6 +2310,26 @@
 extern float4 __attribute__((const, overloadable))
     log10(float4 v);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    log10(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    log10(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    log10(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    log10(half4 v);
+#endif
+
 /*
  * log1p: Natural logarithm of a value plus 1
  *
@@ -1549,6 +2349,26 @@
 extern float4 __attribute__((const, overloadable))
     log1p(float4 v);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    log1p(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    log1p(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    log1p(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    log1p(half4 v);
+#endif
+
 /*
  * log2: Base 2 logarithm
  *
@@ -1568,6 +2388,26 @@
 extern float4 __attribute__((const, overloadable))
     log2(float4 v);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    log2(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    log2(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    log2(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    log2(half4 v);
+#endif
+
 /*
  * logb: Base two exponent
  *
@@ -1592,6 +2432,26 @@
 extern float4 __attribute__((const, overloadable))
     logb(float4 v);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    logb(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    logb(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    logb(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    logb(half4 v);
+#endif
+
 /*
  * mad: Multiply and add
  *
@@ -1613,6 +2473,26 @@
 extern float4 __attribute__((const, overloadable))
     mad(float4 multiplicand1, float4 multiplicand2, float4 offset);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    mad(half multiplicand1, half multiplicand2, half offset);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    mad(half2 multiplicand1, half2 multiplicand2, half2 offset);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    mad(half3 multiplicand1, half3 multiplicand2, half3 offset);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    mad(half4 multiplicand1, half4 multiplicand2, half4 offset);
+#endif
+
 /*
  * max: Maximum
  *
@@ -1630,6 +2510,26 @@
 extern float4 __attribute__((const, overloadable))
     max(float4 a, float4 b);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    max(half a, half b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    max(half2 a, half2 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    max(half3 a, half3 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    max(half4 a, half4 b);
+#endif
+
 extern float2 __attribute__((const, overloadable))
     max(float2 a, float b);
 
@@ -1639,6 +2539,21 @@
 extern float4 __attribute__((const, overloadable))
     max(float4 a, float b);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    max(half2 a, half b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    max(half3 a, half b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    max(half4 a, half b);
+#endif
+
 #if !defined(RS_VERSION) || (RS_VERSION <= 20)
 static inline char __attribute__((const, overloadable))
     max(char a, char b) {
@@ -2056,6 +2971,26 @@
 extern float4 __attribute__((const, overloadable))
     min(float4 a, float4 b);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    min(half a, half b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    min(half2 a, half2 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    min(half3 a, half3 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    min(half4 a, half4 b);
+#endif
+
 extern float2 __attribute__((const, overloadable))
     min(float2 a, float b);
 
@@ -2065,6 +3000,21 @@
 extern float4 __attribute__((const, overloadable))
     min(float4 a, float b);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    min(half2 a, half b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    min(half3 a, half b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    min(half4 a, half b);
+#endif
+
 #if !defined(RS_VERSION) || (RS_VERSION <= 20)
 static inline char __attribute__((const, overloadable))
     min(char a, char b) {
@@ -2485,6 +3435,26 @@
 extern float4 __attribute__((const, overloadable))
     mix(float4 start, float4 stop, float4 fraction);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    mix(half start, half stop, half fraction);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    mix(half2 start, half2 stop, half2 fraction);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    mix(half3 start, half3 stop, half3 fraction);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    mix(half4 start, half4 stop, half4 fraction);
+#endif
+
 extern float2 __attribute__((const, overloadable))
     mix(float2 start, float2 stop, float fraction);
 
@@ -2494,6 +3464,21 @@
 extern float4 __attribute__((const, overloadable))
     mix(float4 start, float4 stop, float fraction);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    mix(half2 start, half2 stop, half fraction);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    mix(half3 start, half3 stop, half fraction);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    mix(half4 start, half4 stop, half fraction);
+#endif
+
 /*
  * modf: Integral and fractional components
  *
@@ -2532,6 +3517,16 @@
     nan(uint v);
 
 /*
+ * nan_half: Not a Number
+ *
+ *  Returns a half-precision floating point NaN value (Not a Number).
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    nan_half(void);
+#endif
+
+/*
  * native_acos: Approximate inverse cosine
  *
  * Returns the approximate inverse cosine, in radians.
@@ -2560,6 +3555,26 @@
     native_acos(float4 v);
 #endif
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    native_acos(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    native_acos(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    native_acos(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    native_acos(half4 v);
+#endif
+
 /*
  * native_acosh: Approximate inverse hyperbolic cosine
  *
@@ -2587,6 +3602,26 @@
     native_acosh(float4 v);
 #endif
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    native_acosh(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    native_acosh(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    native_acosh(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    native_acosh(half4 v);
+#endif
+
 /*
  * native_acospi: Approximate inverse cosine divided by pi
  *
@@ -2618,6 +3653,26 @@
     native_acospi(float4 v);
 #endif
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    native_acospi(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    native_acospi(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    native_acospi(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    native_acospi(half4 v);
+#endif
+
 /*
  * native_asin: Approximate inverse sine
  *
@@ -2647,6 +3702,26 @@
     native_asin(float4 v);
 #endif
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    native_asin(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    native_asin(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    native_asin(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    native_asin(half4 v);
+#endif
+
 /*
  * native_asinh: Approximate inverse hyperbolic sine
  *
@@ -2674,6 +3749,26 @@
     native_asinh(float4 v);
 #endif
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    native_asinh(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    native_asinh(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    native_asinh(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    native_asinh(half4 v);
+#endif
+
 /*
  * native_asinpi: Approximate inverse sine divided by pi
  *
@@ -2705,6 +3800,26 @@
     native_asinpi(float4 v);
 #endif
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    native_asinpi(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    native_asinpi(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    native_asinpi(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    native_asinpi(half4 v);
+#endif
+
 /*
  * native_atan: Approximate inverse tangent
  *
@@ -2732,6 +3847,26 @@
     native_atan(float4 v);
 #endif
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    native_atan(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    native_atan(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    native_atan(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    native_atan(half4 v);
+#endif
+
 /*
  * native_atan2: Approximate inverse tangent of a ratio
  *
@@ -2763,6 +3898,26 @@
     native_atan2(float4 numerator, float4 denominator);
 #endif
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    native_atan2(half numerator, half denominator);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    native_atan2(half2 numerator, half2 denominator);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    native_atan2(half3 numerator, half3 denominator);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    native_atan2(half4 numerator, half4 denominator);
+#endif
+
 /*
  * native_atan2pi: Approximate inverse tangent of a ratio, divided by pi
  *
@@ -2797,6 +3952,26 @@
     native_atan2pi(float4 numerator, float4 denominator);
 #endif
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    native_atan2pi(half numerator, half denominator);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    native_atan2pi(half2 numerator, half2 denominator);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    native_atan2pi(half3 numerator, half3 denominator);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    native_atan2pi(half4 numerator, half4 denominator);
+#endif
+
 /*
  * native_atanh: Approximate inverse hyperbolic tangent
  *
@@ -2824,6 +3999,26 @@
     native_atanh(float4 v);
 #endif
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    native_atanh(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    native_atanh(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    native_atanh(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    native_atanh(half4 v);
+#endif
+
 /*
  * native_atanpi: Approximate inverse tangent divided by pi
  *
@@ -2853,6 +4048,26 @@
     native_atanpi(float4 v);
 #endif
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    native_atanpi(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    native_atanpi(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    native_atanpi(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    native_atanpi(half4 v);
+#endif
+
 /*
  * native_cbrt: Approximate cube root
  *
@@ -2880,6 +4095,26 @@
     native_cbrt(float4 v);
 #endif
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    native_cbrt(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    native_cbrt(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    native_cbrt(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    native_cbrt(half4 v);
+#endif
+
 /*
  * native_cos: Approximate cosine
  *
@@ -2907,6 +4142,26 @@
     native_cos(float4 v);
 #endif
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    native_cos(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    native_cos(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    native_cos(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    native_cos(half4 v);
+#endif
+
 /*
  * native_cosh: Approximate hypebolic cosine
  *
@@ -2934,6 +4189,26 @@
     native_cosh(float4 v);
 #endif
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    native_cosh(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    native_cosh(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    native_cosh(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    native_cosh(half4 v);
+#endif
+
 /*
  * native_cospi: Approximate cosine of a number multiplied by pi
  *
@@ -2963,6 +4238,26 @@
     native_cospi(float4 v);
 #endif
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    native_cospi(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    native_cospi(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    native_cospi(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    native_cospi(half4 v);
+#endif
+
 /*
  * native_divide: Approximate division
  *
@@ -2988,6 +4283,26 @@
     native_divide(float4 left_vector, float4 right_vector);
 #endif
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    native_divide(half left_vector, half right_vector);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    native_divide(half2 left_vector, half2 right_vector);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    native_divide(half3 left_vector, half3 right_vector);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    native_divide(half4 left_vector, half4 right_vector);
+#endif
+
 /*
  * native_exp: Approximate e raised to a number
  *
@@ -3018,6 +4333,26 @@
     native_exp(float4 v);
 #endif
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    native_exp(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    native_exp(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    native_exp(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    native_exp(half4 v);
+#endif
+
 /*
  * native_exp10: Approximate 10 raised to a number
  *
@@ -3048,6 +4383,26 @@
     native_exp10(float4 v);
 #endif
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    native_exp10(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    native_exp10(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    native_exp10(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    native_exp10(half4 v);
+#endif
+
 /*
  * native_exp2: Approximate 2 raised to a number
  *
@@ -3078,6 +4433,26 @@
     native_exp2(float4 v);
 #endif
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    native_exp2(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    native_exp2(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    native_exp2(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    native_exp2(half4 v);
+#endif
+
 /*
  * native_expm1: Approximate e raised to a number minus one
  *
@@ -3105,6 +4480,26 @@
     native_expm1(float4 v);
 #endif
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    native_expm1(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    native_expm1(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    native_expm1(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    native_expm1(half4 v);
+#endif
+
 /*
  * native_hypot: Approximate hypotenuse
  *
@@ -3132,6 +4527,26 @@
     native_hypot(float4 a, float4 b);
 #endif
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    native_hypot(half a, half b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    native_hypot(half2 a, half2 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    native_hypot(half3 a, half3 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    native_hypot(half4 a, half4 b);
+#endif
+
 /*
  * native_log: Approximate natural logarithm
  *
@@ -3161,6 +4576,26 @@
     native_log(float4 v);
 #endif
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    native_log(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    native_log(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    native_log(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    native_log(half4 v);
+#endif
+
 /*
  * native_log10: Approximate base 10 logarithm
  *
@@ -3190,6 +4625,26 @@
     native_log10(float4 v);
 #endif
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    native_log10(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    native_log10(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    native_log10(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    native_log10(half4 v);
+#endif
+
 /*
  * native_log1p: Approximate natural logarithm of a value plus 1
  *
@@ -3217,6 +4672,26 @@
     native_log1p(float4 v);
 #endif
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    native_log1p(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    native_log1p(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    native_log1p(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    native_log1p(half4 v);
+#endif
+
 /*
  * native_log2: Approximate base 2 logarithm
  *
@@ -3246,6 +4721,26 @@
     native_log2(float4 v);
 #endif
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    native_log2(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    native_log2(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    native_log2(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    native_log2(half4 v);
+#endif
+
 /*
  * native_powr: Approximate positive base raised to an exponent
  *
@@ -3277,6 +4772,26 @@
     native_powr(float4 base, float4 exponent);
 #endif
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    native_powr(half base, half exponent);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    native_powr(half2 base, half2 exponent);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    native_powr(half3 base, half3 exponent);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    native_powr(half4 base, half4 exponent);
+#endif
+
 /*
  * native_recip: Approximate reciprocal
  *
@@ -3304,6 +4819,26 @@
     native_recip(float4 v);
 #endif
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    native_recip(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    native_recip(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    native_recip(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    native_recip(half4 v);
+#endif
+
 /*
  * native_rootn: Approximate nth root
  *
@@ -3331,6 +4866,26 @@
     native_rootn(float4 v, int4 n);
 #endif
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    native_rootn(half v, int n);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    native_rootn(half2 v, int2 n);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    native_rootn(half3 v, int3 n);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    native_rootn(half4 v, int4 n);
+#endif
+
 /*
  * native_rsqrt: Approximate reciprocal of a square root
  *
@@ -3358,6 +4913,26 @@
     native_rsqrt(float4 v);
 #endif
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    native_rsqrt(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    native_rsqrt(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    native_rsqrt(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    native_rsqrt(half4 v);
+#endif
+
 /*
  * native_sin: Approximate sine
  *
@@ -3385,6 +4960,26 @@
     native_sin(float4 v);
 #endif
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    native_sin(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    native_sin(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    native_sin(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    native_sin(half4 v);
+#endif
+
 /*
  * native_sincos: Approximate sine and cosine
  *
@@ -3418,6 +5013,26 @@
     native_sincos(float4 v, float4* cos);
 #endif
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((overloadable))
+    native_sincos(half v, half* cos);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((overloadable))
+    native_sincos(half2 v, half2* cos);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((overloadable))
+    native_sincos(half3 v, half3* cos);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((overloadable))
+    native_sincos(half4 v, half4* cos);
+#endif
+
 /*
  * native_sinh: Approximate hyperbolic sine
  *
@@ -3445,6 +5060,26 @@
     native_sinh(float4 v);
 #endif
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    native_sinh(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    native_sinh(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    native_sinh(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    native_sinh(half4 v);
+#endif
+
 /*
  * native_sinpi: Approximate sine of a number multiplied by pi
  *
@@ -3474,6 +5109,26 @@
     native_sinpi(float4 v);
 #endif
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    native_sinpi(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    native_sinpi(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    native_sinpi(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    native_sinpi(half4 v);
+#endif
+
 /*
  * native_sqrt: Approximate square root
  *
@@ -3501,6 +5156,26 @@
     native_sqrt(float4 v);
 #endif
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    native_sqrt(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    native_sqrt(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    native_sqrt(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    native_sqrt(half4 v);
+#endif
+
 /*
  * native_tan: Approximate tangent
  *
@@ -3526,6 +5201,26 @@
     native_tan(float4 v);
 #endif
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    native_tan(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    native_tan(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    native_tan(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    native_tan(half4 v);
+#endif
+
 /*
  * native_tanh: Approximate hyperbolic tangent
  *
@@ -3553,6 +5248,26 @@
     native_tanh(float4 v);
 #endif
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    native_tanh(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    native_tanh(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    native_tanh(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    native_tanh(half4 v);
+#endif
+
 /*
  * native_tanpi: Approximate tangent of a number multiplied by pi
  *
@@ -3582,6 +5297,26 @@
     native_tanpi(float4 v);
 #endif
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    native_tanpi(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    native_tanpi(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    native_tanpi(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    native_tanpi(half4 v);
+#endif
+
 /*
  * nextafter: Next floating point number
  *
@@ -3622,6 +5357,26 @@
 extern float4 __attribute__((const, overloadable))
     pow(float4 base, float4 exponent);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    pow(half base, half exponent);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    pow(half2 base, half2 exponent);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    pow(half3 base, half3 exponent);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    pow(half4 base, half4 exponent);
+#endif
+
 /*
  * pown: Base raised to an integer exponent
  *
@@ -3642,6 +5397,26 @@
 extern float4 __attribute__((const, overloadable))
     pown(float4 base, int4 exponent);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    pown(half base, int exponent);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    pown(half2 base, int2 exponent);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    pown(half3 base, int3 exponent);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    pown(half4 base, int4 exponent);
+#endif
+
 /*
  * powr: Positive base raised to an exponent
  *
@@ -3664,6 +5439,26 @@
 extern float4 __attribute__((const, overloadable))
     powr(float4 base, float4 exponent);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    powr(half base, half exponent);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    powr(half2 base, half2 exponent);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    powr(half3 base, half3 exponent);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    powr(half4 base, half4 exponent);
+#endif
+
 /*
  * radians: Converts degrees into radians
  *
@@ -3681,6 +5476,26 @@
 extern float4 __attribute__((const, overloadable))
     radians(float4 v);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    radians(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    radians(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    radians(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    radians(half4 v);
+#endif
+
 /*
  * remainder: Remainder of a division
  *
@@ -3703,6 +5518,26 @@
 extern float4 __attribute__((const, overloadable))
     remainder(float4 numerator, float4 denominator);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    remainder(half numerator, half denominator);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    remainder(half2 numerator, half2 denominator);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    remainder(half3 numerator, half3 denominator);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    remainder(half4 numerator, half4 denominator);
+#endif
+
 /*
  * remquo: Remainder and quotient of a division
  *
@@ -3737,6 +5572,26 @@
 extern float4 __attribute__((overloadable))
     remquo(float4 numerator, float4 denominator, int4* quotient);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((overloadable))
+    remquo(half numerator, half denominator, int* quotient);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((overloadable))
+    remquo(half2 numerator, half2 denominator, int2* quotient);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((overloadable))
+    remquo(half3 numerator, half3 denominator, int3* quotient);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((overloadable))
+    remquo(half4 numerator, half4 denominator, int4* quotient);
+#endif
+
 /*
  * rint: Round to even
  *
@@ -3760,6 +5615,26 @@
 extern float4 __attribute__((const, overloadable))
     rint(float4 v);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    rint(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    rint(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    rint(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    rint(half4 v);
+#endif
+
 /*
  * rootn: Nth root
  *
@@ -3779,6 +5654,26 @@
 extern float4 __attribute__((const, overloadable))
     rootn(float4 v, int4 n);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    rootn(half v, int n);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    rootn(half2 v, int2 n);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    rootn(half3 v, int3 n);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    rootn(half4 v, int4 n);
+#endif
+
 /*
  * round: Round away from zero
  *
@@ -3802,6 +5697,26 @@
 extern float4 __attribute__((const, overloadable))
     round(float4 v);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    round(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    round(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    round(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    round(half4 v);
+#endif
+
 /*
  * rsqrt: Reciprocal of a square root
  *
@@ -3821,6 +5736,26 @@
 extern float4 __attribute__((const, overloadable))
     rsqrt(float4 v);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    rsqrt(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    rsqrt(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    rsqrt(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    rsqrt(half4 v);
+#endif
+
 /*
  * sign: Sign of a value
  *
@@ -3842,6 +5777,26 @@
 extern float4 __attribute__((const, overloadable))
     sign(float4 v);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    sign(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    sign(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    sign(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    sign(half4 v);
+#endif
+
 /*
  * sin: Sine
  *
@@ -3861,6 +5816,26 @@
 extern float4 __attribute__((const, overloadable))
     sin(float4 v);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    sin(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    sin(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    sin(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    sin(half4 v);
+#endif
+
 /*
  * sincos: Sine and cosine
  *
@@ -3886,6 +5861,26 @@
 extern float4 __attribute__((overloadable))
     sincos(float4 v, float4* cos);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((overloadable))
+    sincos(half v, half* cos);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((overloadable))
+    sincos(half2 v, half2* cos);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((overloadable))
+    sincos(half3 v, half3* cos);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((overloadable))
+    sincos(half4 v, half4* cos);
+#endif
+
 /*
  * sinh: Hyperbolic sine
  *
@@ -3905,6 +5900,26 @@
 extern float4 __attribute__((const, overloadable))
     sinh(float4 v);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    sinh(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    sinh(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    sinh(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    sinh(half4 v);
+#endif
+
 /*
  * sinpi: Sine of a number multiplied by pi
  *
@@ -3926,6 +5941,26 @@
 extern float4 __attribute__((const, overloadable))
     sinpi(float4 v);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    sinpi(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    sinpi(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    sinpi(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    sinpi(half4 v);
+#endif
+
 /*
  * sqrt: Square root
  *
@@ -3945,6 +5980,26 @@
 extern float4 __attribute__((const, overloadable))
     sqrt(float4 v);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    sqrt(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    sqrt(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    sqrt(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    sqrt(half4 v);
+#endif
+
 /*
  * step: 0 if less than a value, 0 otherwise
  *
@@ -3966,6 +6021,26 @@
 extern float4 __attribute__((const, overloadable))
     step(float4 edge, float4 v);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    step(half edge, half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    step(half2 edge, half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    step(half3 edge, half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    step(half4 edge, half4 v);
+#endif
+
 extern float2 __attribute__((const, overloadable))
     step(float2 edge, float v);
 
@@ -3975,6 +6050,21 @@
 extern float4 __attribute__((const, overloadable))
     step(float4 edge, float v);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    step(half2 edge, half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    step(half3 edge, half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    step(half4 edge, half v);
+#endif
+
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
 extern float2 __attribute__((const, overloadable))
     step(float edge, float2 v);
@@ -3990,6 +6080,21 @@
     step(float edge, float4 v);
 #endif
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    step(half edge, half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    step(half edge, half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    step(half edge, half4 v);
+#endif
+
 /*
  * tan: Tangent
  *
@@ -4009,6 +6114,26 @@
 extern float4 __attribute__((const, overloadable))
     tan(float4 v);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    tan(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    tan(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    tan(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    tan(half4 v);
+#endif
+
 /*
  * tanh: Hyperbolic tangent
  *
@@ -4028,6 +6153,26 @@
 extern float4 __attribute__((const, overloadable))
     tanh(float4 v);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    tanh(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    tanh(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    tanh(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    tanh(half4 v);
+#endif
+
 /*
  * tanpi: Tangent of a number multiplied by pi
  *
@@ -4049,6 +6194,26 @@
 extern float4 __attribute__((const, overloadable))
     tanpi(float4 v);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    tanpi(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    tanpi(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    tanpi(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    tanpi(half4 v);
+#endif
+
 /*
  * tgamma: Gamma function
  *
@@ -4068,6 +6233,26 @@
 extern float4 __attribute__((const, overloadable))
     tgamma(float4 v);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    tgamma(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    tgamma(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    tgamma(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    tgamma(half4 v);
+#endif
+
 /*
  * trunc: Truncates a floating point
  *
@@ -4089,6 +6274,26 @@
 extern float4 __attribute__((const, overloadable))
     trunc(float4 v);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    trunc(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half2 __attribute__((const, overloadable))
+    trunc(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    trunc(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    trunc(half4 v);
+#endif
+
 /*
  * rsClamp: Restrain a value to a range
  *
diff --git a/scriptc/rs_vector_math.rsh b/scriptc/rs_vector_math.rsh
index a2757e9..77dde4f 100644
--- a/scriptc/rs_vector_math.rsh
+++ b/scriptc/rs_vector_math.rsh
@@ -49,6 +49,16 @@
 extern float4 __attribute__((const, overloadable))
     cross(float4 left_vector, float4 right_vector);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half3 __attribute__((const, overloadable))
+    cross(half3 left_vector, half3 right_vector);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half4 __attribute__((const, overloadable))
+    cross(half4 left_vector, half4 right_vector);
+#endif
+
 /*
  * distance: Distance between two points
  *
@@ -68,6 +78,26 @@
 extern float __attribute__((const, overloadable))
     distance(float4 left_vector, float4 right_vector);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    distance(half left_vector, half right_vector);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    distance(half2 left_vector, half2 right_vector);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    distance(half3 left_vector, half3 right_vector);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    distance(half4 left_vector, half4 right_vector);
+#endif
+
 /*
  * dot: Dot product of two vectors
  *
@@ -85,6 +115,26 @@
 extern float __attribute__((const, overloadable))
     dot(float4 left_vector, float4 right_vector);
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    dot(half left_vector, half right_vector);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    dot(half2 left_vector, half2 right_vector);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    dot(half3 left_vector, half3 right_vector);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 4294967295) && (RS_VERSION <= 4294967295))
+extern half __attribute__((const, overloadable))
+    dot(half4 left_vector, half4 right_vector);
+#endif
+
 /*
  * fast_distance: Approximate distance between two points
  *