am 5bd017b1: am 873366e2: am 0cdbac5c: Merge "Update Linux RenderScript prebuilts for LLVM rebase to r233350."

* commit '5bd017b161605a86a50eb9e48171d615da904e3e':
  Update Linux RenderScript prebuilts for LLVM rebase to r233350.
diff --git a/renderscript/clang-include/altivec.h b/renderscript/clang-include/altivec.h
index b8a8869..252bf36 100644
--- a/renderscript/clang-include/altivec.h
+++ b/renderscript/clang-include/altivec.h
@@ -1387,6 +1387,21 @@
     __builtin_altivec_vcmpequw((vector int)__a, (vector int)__b);
 }
 
+#ifdef __POWER8_VECTOR__
+static vector bool long long __ATTRS_o_ai
+vec_cmpeq(vector signed long long __a, vector signed long long __b) 
+{
+  return (vector bool long long) __builtin_altivec_vcmpequd(__a, __b);
+}
+
+static vector bool long long __ATTRS_o_ai
+vec_cmpeq(vector unsigned long long __a, vector unsigned long long __b) 
+{
+  return (vector bool long long) 
+    __builtin_altivec_vcmpequd((vector long long)__a, (vector long long) __b);
+}
+#endif
+
 static vector bool int __ATTRS_o_ai
 vec_cmpeq(vector float __a, vector float __b)
 {
@@ -1447,6 +1462,20 @@
   return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b);
 }
 
+#ifdef __POWER8_VECTOR__
+static vector bool long long __ATTRS_o_ai
+vec_cmpgt(vector signed long long __a, vector signed long long __b)
+{
+  return (vector bool long long)__builtin_altivec_vcmpgtsd(__a, __b);
+}
+
+static vector bool long long __ATTRS_o_ai
+vec_cmpgt(vector unsigned long long __a, vector unsigned long long __b)
+{
+  return (vector bool long long)__builtin_altivec_vcmpgtud(__a, __b);
+}
+#endif
+
 static vector bool int __ATTRS_o_ai
 vec_cmpgt(vector float __a, vector float __b)
 {
@@ -2679,6 +2708,20 @@
   return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b);
 }
 
+#ifdef __POWER8_VECTOR__
+static vector signed long long __ATTRS_o_ai
+vec_max(vector signed long long __a, vector signed long long __b) 
+{
+  return __builtin_altivec_vmaxsd(__a, __b);
+}
+
+static vector unsigned long long __ATTRS_o_ai
+vec_max(vector unsigned long long __a, vector unsigned long long __b)
+{
+  return __builtin_altivec_vmaxud(__a, __b);
+}
+#endif
+
 static vector float __ATTRS_o_ai
 vec_max(vector float __a, vector float __b)
 {
@@ -3327,6 +3370,20 @@
   return __builtin_altivec_vminuw(__a, (vector unsigned int)__b);
 }
 
+#ifdef __POWER8_VECTOR__
+static vector signed long long __ATTRS_o_ai
+vec_min(vector signed long long __a, vector signed long long __b)
+{
+  return __builtin_altivec_vminsd(__a, __b);
+}
+
+static vector unsigned long long __ATTRS_o_ai
+vec_min(vector unsigned long long __a, vector unsigned long long __b)
+{
+  return __builtin_altivec_vminud(__a, __b);
+}
+#endif
+
 static vector float __ATTRS_o_ai
 vec_min(vector float __a, vector float __b)
 {
@@ -3762,6 +3819,28 @@
 #endif
 }
 
+#ifdef __POWER8_VECTOR__
+static vector signed long long __ATTRS_o_ai
+vec_mule(vector signed int __a, vector signed int __b)
+{
+#ifdef __LITTLE_ENDIAN__
+  return __builtin_altivec_vmulosw(__a, __b);
+#else
+  return __builtin_altivec_vmulesw(__a, __b);
+#endif
+}
+
+static vector unsigned long long __ATTRS_o_ai
+vec_mule(vector unsigned int __a, vector unsigned int __b)
+{
+#ifdef __LITTLE_ENDIAN__
+  return __builtin_altivec_vmulouw(__a, __b);
+#else
+  return __builtin_altivec_vmuleuw(__a, __b);
+#endif
+}
+#endif
+
 /* vec_vmulesb */
 
 static vector short __attribute__((__always_inline__))
@@ -3852,6 +3931,28 @@
 #endif
 }
 
+#ifdef __POWER8_VECTOR__
+static vector signed long long __ATTRS_o_ai
+vec_mulo(vector signed int __a, vector signed int __b) 
+{
+#ifdef __LITTLE_ENDIAN__
+  return __builtin_altivec_vmulesw(__a, __b);
+#else
+  return __builtin_altivec_vmulosw(__a, __b);
+#endif
+}
+
+static vector unsigned long long __ATTRS_o_ai
+vec_mulo(vector unsigned int __a, vector unsigned int __b) 
+{
+#ifdef __LITTLE_ENDIAN__
+  return __builtin_altivec_vmuleuw(__a, __b);
+#else
+  return __builtin_altivec_vmulouw(__a, __b);
+#endif
+}
+#endif
+
 /* vec_vmulosb */
 
 static vector short __attribute__((__always_inline__))
@@ -5095,6 +5196,20 @@
   return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b);
 }
 
+#ifdef __POWER8_VECTOR__
+static vector signed long long __ATTRS_o_ai
+vec_rl(vector signed long long __a, vector unsigned long long __b)
+{
+  return __builtin_altivec_vrld(__a, __b);
+}
+
+static vector unsigned long long __ATTRS_o_ai
+vec_rl(vector unsigned long long __a, vector unsigned long long __b)
+{
+  return __builtin_altivec_vrld(__a, __b);
+}
+#endif
+
 /* vec_vrlb */
 
 static vector signed char __ATTRS_o_ai
@@ -5465,6 +5580,20 @@
   return __a << __b;
 }
 
+#ifdef __POWER8_VECTOR__
+static vector signed long long __ATTRS_o_ai
+vec_sl(vector signed long long __a, vector unsigned long long __b)
+{
+  return __a << (vector long long)__b;
+}
+
+static vector unsigned long long __ATTRS_o_ai
+vec_sl(vector unsigned long long __a, vector unsigned long long __b)
+{
+  return __a << __b;
+}
+#endif
+
 /* vec_vslb */
 
 #define __builtin_altivec_vslb vec_vslb
@@ -6566,6 +6695,20 @@
   return __a >> __b;
 }
 
+#ifdef __POWER8_VECTOR__
+static vector signed long long __ATTRS_o_ai
+vec_sr(vector signed long long __a, vector unsigned long long __b)
+{
+  return __a >> (vector long long)__b;
+}
+
+static vector unsigned long long __ATTRS_o_ai
+vec_sr(vector unsigned long long __a, vector unsigned long long __b)
+{
+  return __a >> __b;
+}
+#endif
+
 /* vec_vsrb */
 
 #define __builtin_altivec_vsrb vec_vsrb
@@ -6652,6 +6795,20 @@
   return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
 }
 
+#ifdef __POWER8_VECTOR__
+static vector signed long long __ATTRS_o_ai
+vec_sra(vector signed long long __a, vector unsigned long long __b)
+{
+  return __a >> __b;
+}
+
+static vector unsigned long long __ATTRS_o_ai
+vec_sra(vector unsigned long long __a, vector unsigned long long __b)
+{
+  return (vector unsigned long long) ( (vector signed long long) __a >> __b);
+}
+#endif
+
 /* vec_vsrab */
 
 static vector signed char __ATTRS_o_ai
@@ -10887,6 +11044,55 @@
   return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, (vector int)__b);
 }
 
+#ifdef __POWER8_VECTOR__
+static int __ATTRS_o_ai
+vec_all_eq(vector signed long long __a, vector signed long long __b)
+{
+  return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, __b);
+}
+
+static int __ATTRS_o_ai
+vec_all_eq(vector long long __a, vector bool long long __b)
+{
+  return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, (vector long long)__b);
+}
+
+static int __ATTRS_o_ai
+vec_all_eq(vector unsigned long long __a, vector unsigned long long __b)
+{
+  return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a, 
+                                      (vector long long)__b);
+}
+
+static int __ATTRS_o_ai
+vec_all_eq(vector unsigned long long __a, vector bool long long __b)
+{
+  return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a, 
+                                      (vector long long)__b);
+}
+
+static int __ATTRS_o_ai
+vec_all_eq(vector bool long long __a, vector long long __b)
+{
+  return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a, 
+                                      (vector long long)__b);
+}
+
+static int __ATTRS_o_ai
+vec_all_eq(vector bool long long __a, vector unsigned long long __b)
+{
+  return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a, 
+                                      (vector long long)__b);
+}
+
+static int __ATTRS_o_ai
+vec_all_eq(vector bool long long __a, vector bool long long __b)
+{
+  return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a, 
+                                      (vector long long)__b);
+}
+#endif
+
 static int __ATTRS_o_ai
 vec_all_eq(vector float __a, vector float __b)
 {
@@ -11033,6 +11239,56 @@
                                       (vector unsigned int)__a);
 }
 
+#ifdef __POWER8_VECTOR__
+static int __ATTRS_o_ai
+vec_all_ge(vector signed long long __a, vector signed long long __b)
+{
+  return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __b, __a);
+}
+static int __ATTRS_o_ai
+vec_all_ge(vector signed long long __a, vector bool long long __b)
+{
+  return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, (vector signed long long)__b,
+                                      __a);
+}
+
+static int __ATTRS_o_ai
+vec_all_ge(vector unsigned long long __a, vector unsigned long long __b)
+{
+  return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b, __a);
+}
+
+static int __ATTRS_o_ai
+vec_all_ge(vector unsigned long long __a, vector bool long long __b)
+{
+  return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
+                                      __a);
+}
+
+static int __ATTRS_o_ai
+vec_all_ge(vector bool long long __a, vector signed long long __b)
+{
+  return __builtin_altivec_vcmpgtud_p(__CR6_EQ,
+                                      (vector unsigned long long)__b,
+                                      (vector unsigned long long)__a);
+}
+
+static int __ATTRS_o_ai
+vec_all_ge(vector bool long long __a, vector unsigned long long __b)
+{
+  return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b,
+                                      (vector unsigned long long)__a);
+}
+
+static int __ATTRS_o_ai
+vec_all_ge(vector bool long long __a, vector bool long long __b)
+{
+  return __builtin_altivec_vcmpgtud_p(__CR6_EQ,
+                                      (vector unsigned long long)__b,
+                                      (vector unsigned long long)__a);
+}
+#endif
+
 static int __ATTRS_o_ai
 vec_all_ge(vector float __a, vector float __b)
 {
@@ -11179,6 +11435,56 @@
                                       (vector unsigned int)__b);
 }
 
+#ifdef __POWER8_VECTOR__
+static int __ATTRS_o_ai
+vec_all_gt(vector signed long long __a, vector signed long long __b)
+{
+  return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a, __b);
+}
+static int __ATTRS_o_ai
+vec_all_gt(vector signed long long __a, vector bool long long __b)
+{
+  return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a,
+                                      (vector signed long long)__b);
+}
+
+static int __ATTRS_o_ai
+vec_all_gt(vector unsigned long long __a, vector unsigned long long __b)
+{
+  return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a, __b);
+}
+
+static int __ATTRS_o_ai
+vec_all_gt(vector unsigned long long __a, vector bool long long __b)
+{
+  return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a, 
+                                      (vector unsigned long long)__b);
+}
+
+static int __ATTRS_o_ai
+vec_all_gt(vector bool long long __a, vector signed long long __b)
+{
+  return __builtin_altivec_vcmpgtud_p(__CR6_LT,
+                                      (vector unsigned long long)__a,
+                                      (vector unsigned long long)__b);
+}
+
+static int __ATTRS_o_ai
+vec_all_gt(vector bool long long __a, vector unsigned long long __b)
+{
+  return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
+                                      __b);
+}
+
+static int __ATTRS_o_ai
+vec_all_gt(vector bool long long __a, vector bool long long __b)
+{
+  return __builtin_altivec_vcmpgtud_p(__CR6_LT,
+                                      (vector unsigned long long)__a,
+                                      (vector unsigned long long)__b);
+}
+#endif
+
 static int __ATTRS_o_ai
 vec_all_gt(vector float __a, vector float __b)
 {
@@ -11333,6 +11639,57 @@
                                       (vector unsigned int)__b);
 }
 
+#ifdef __POWER8_VECTOR__
+static int __ATTRS_o_ai
+vec_all_le(vector signed long long __a, vector signed long long __b)
+{
+  return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a, __b);
+}
+
+static int __ATTRS_o_ai
+vec_all_le(vector unsigned long long __a, vector unsigned long long __b)
+{
+  return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a, __b);
+}
+
+static int __ATTRS_o_ai
+vec_all_le(vector signed long long __a, vector bool long long __b)
+{
+  return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a,
+                                      (vector signed long long)__b);
+}
+
+static int __ATTRS_o_ai
+vec_all_le(vector unsigned long long __a, vector bool long long __b)
+{
+  return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a, 
+                                      (vector unsigned long long)__b);
+}
+
+static int __ATTRS_o_ai
+vec_all_le(vector bool long long __a, vector signed long long __b)
+{
+  return __builtin_altivec_vcmpgtud_p(__CR6_EQ,
+                                      (vector unsigned long long)__a,
+                                      (vector unsigned long long)__b);
+}
+
+static int __ATTRS_o_ai
+vec_all_le(vector bool long long __a, vector unsigned long long __b)
+{
+  return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
+                                      __b);
+}
+
+static int __ATTRS_o_ai
+vec_all_le(vector bool long long __a, vector bool long long __b)
+{
+  return __builtin_altivec_vcmpgtud_p(__CR6_EQ,
+                                      (vector unsigned long long)__a,
+                                      (vector unsigned long long)__b);
+}
+#endif
+
 static int __ATTRS_o_ai
 vec_all_le(vector float __a, vector float __b)
 {
@@ -11479,6 +11836,57 @@
                                       (vector unsigned int)__a);
 }
 
+#ifdef __POWER8_VECTOR__
+static int __ATTRS_o_ai
+vec_all_lt(vector signed long long __a, vector signed long long __b)
+{
+  return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __b, __a);
+}
+
+static int __ATTRS_o_ai
+vec_all_lt(vector unsigned long long __a, vector unsigned long long __b)
+{
+  return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b, __a);
+}
+
+static int __ATTRS_o_ai
+vec_all_lt(vector signed long long __a, vector bool long long __b)
+{
+  return __builtin_altivec_vcmpgtsd_p(__CR6_LT, (vector signed long long)__b,
+                                      __a);
+}
+
+static int __ATTRS_o_ai
+vec_all_lt(vector unsigned long long __a, vector bool long long __b)
+{
+  return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
+                                      __a);
+}
+
+static int __ATTRS_o_ai
+vec_all_lt(vector bool long long __a, vector signed long long __b)
+{
+  return __builtin_altivec_vcmpgtud_p(__CR6_LT,
+                                      (vector unsigned long long)__b,
+                                      (vector unsigned long long)__a);
+}
+
+static int __ATTRS_o_ai
+vec_all_lt(vector bool long long __a, vector unsigned long long __b)
+{
+  return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b,
+                                      (vector unsigned long long)__a);
+}
+
+static int __ATTRS_o_ai
+vec_all_lt(vector bool long long __a, vector bool long long __b)
+{
+  return __builtin_altivec_vcmpgtud_p(__CR6_LT,
+                                      (vector unsigned long long)__b,
+                                      (vector unsigned long long)__a);
+}
+#endif
+
 static int __ATTRS_o_ai
 vec_all_lt(vector float __a, vector float __b)
 {
@@ -11633,6 +12041,56 @@
   return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, (vector int)__b);
 }
 
+#ifdef __POWER8_VECTOR__
+static int __ATTRS_o_ai
+vec_all_ne(vector signed long long __a, vector signed long long __b)
+{
+  return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a, __b);
+}
+
+static int __ATTRS_o_ai
+vec_all_ne(vector unsigned long long __a, vector unsigned long long __b)
+{
+  return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector long long)__a, 
+                                      (vector long long)__b);
+}
+
+static int __ATTRS_o_ai
+vec_all_ne(vector signed long long __a, vector bool long long __b)
+{
+  return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a,
+                                      (vector signed long long)__b);
+}
+
+static int __ATTRS_o_ai
+vec_all_ne(vector unsigned long long __a, vector bool long long __b)
+{
+  return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a, 
+                                      (vector signed long long)__b);
+}
+
+static int __ATTRS_o_ai
+vec_all_ne(vector bool long long __a, vector signed long long __b)
+{
+  return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
+                                      (vector signed long long)__b);
+}
+
+static int __ATTRS_o_ai
+vec_all_ne(vector bool long long __a, vector unsigned long long __b)
+{
+  return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a, 
+                                      (vector signed long long)__b);
+}
+
+static int __ATTRS_o_ai
+vec_all_ne(vector bool long long __a, vector bool long long __b)
+{
+  return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a, 
+                                      (vector signed long long)__b);
+}
+#endif
+
 static int __ATTRS_o_ai
 vec_all_ne(vector float __a, vector float __b)
 {
@@ -11837,6 +12295,61 @@
     __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, (vector int)__b);
 }
 
+#ifdef __POWER8_VECTOR__
+static int __ATTRS_o_ai
+vec_any_eq(vector signed long long __a, vector signed long long __b)
+{
+  return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a, __b);
+}
+
+static int __ATTRS_o_ai
+vec_any_eq(vector unsigned long long __a, vector unsigned long long __b)
+{
+  return
+    __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, (vector long long)__a, 
+                                 (vector long long)__b);
+}
+
+static int __ATTRS_o_ai
+vec_any_eq(vector signed long long __a, vector bool long long __b)
+{
+  return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a,
+                                      (vector signed long long)__b);
+}
+
+static int __ATTRS_o_ai
+vec_any_eq(vector unsigned long long __a, vector bool long long __b)
+{
+  return
+    __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, (vector signed long long)__a, 
+                                 (vector signed long long)__b);
+}
+
+static int __ATTRS_o_ai
+vec_any_eq(vector bool long long __a, vector signed long long __b)
+{
+  return
+    __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, (vector signed long long)__a, 
+                                 (vector signed long long)__b);
+}
+
+static int __ATTRS_o_ai
+vec_any_eq(vector bool long long __a, vector unsigned long long __b)
+{
+  return
+    __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, (vector signed long long)__a, 
+                                 (vector signed long long)__b);
+}
+
+static int __ATTRS_o_ai
+vec_any_eq(vector bool long long __a, vector bool long long __b)
+{
+  return
+    __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, (vector signed long long)__a, 
+                                 (vector signed long long)__b);
+}
+#endif
+
 static int __ATTRS_o_ai
 vec_any_eq(vector float __a, vector float __b)
 {
@@ -11985,6 +12498,57 @@
                                       (vector unsigned int)__a);
 }
 
+#ifdef __POWER8_VECTOR__
+static int __ATTRS_o_ai
+vec_any_ge(vector signed long long __a, vector signed long long __b)
+{
+  return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __b, __a);
+}
+
+static int __ATTRS_o_ai
+vec_any_ge(vector unsigned long long __a, vector unsigned long long __b)
+{
+  return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b, __a);
+}
+
+static int __ATTRS_o_ai
+vec_any_ge(vector signed long long __a, vector bool long long __b)
+{
+  return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV,
+                                      (vector signed long long)__b, __a);
+}
+
+static int __ATTRS_o_ai
+vec_any_ge(vector unsigned long long __a, vector bool long long __b)
+{
+  return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, 
+                                      (vector unsigned long long)__b, __a);
+}
+
+static int __ATTRS_o_ai
+vec_any_ge(vector bool long long __a, vector signed long long __b)
+{
+  return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
+                                      (vector unsigned long long)__b,
+                                      (vector unsigned long long)__a);
+}
+
+static int __ATTRS_o_ai
+vec_any_ge(vector bool long long __a, vector unsigned long long __b)
+{
+  return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b,
+                                      (vector unsigned long long)__a);
+}
+
+static int __ATTRS_o_ai
+vec_any_ge(vector bool long long __a, vector bool long long __b)
+{
+  return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
+                                      (vector unsigned long long)__b,
+                                      (vector unsigned long long)__a);
+}
+#endif
+
 static int __ATTRS_o_ai
 vec_any_ge(vector float __a, vector float __b)
 {
@@ -12135,6 +12699,58 @@
                                       (vector unsigned int)__b);
 }
 
+#ifdef __POWER8_VECTOR__
+static int __ATTRS_o_ai
+vec_any_gt(vector signed long long __a, vector signed long long __b)
+{
+  return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a, __b);
+}
+
+static int __ATTRS_o_ai
+vec_any_gt(vector unsigned long long __a, vector unsigned long long __b)
+{
+  return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a, __b);
+}
+
+static int __ATTRS_o_ai
+vec_any_gt(vector signed long long __a, vector bool long long __b)
+{
+  return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a,
+                                      (vector signed long long)__b);
+}
+
+
+static int __ATTRS_o_ai
+vec_any_gt(vector unsigned long long __a, vector bool long long __b)
+{
+  return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a, 
+                                      (vector unsigned long long)__b);
+}
+
+static int __ATTRS_o_ai
+vec_any_gt(vector bool long long __a, vector signed long long __b)
+{
+  return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
+                                      (vector unsigned long long)__a,
+                                      (vector unsigned long long)__b);
+}
+
+static int __ATTRS_o_ai
+vec_any_gt(vector bool long long __a, vector unsigned long long __b)
+{
+  return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, 
+                                      (vector unsigned long long)__a, __b);
+}
+
+static int __ATTRS_o_ai
+vec_any_gt(vector bool long long __a, vector bool long long __b)
+{
+  return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
+                                      (vector unsigned long long)__a,
+                                      (vector unsigned long long)__b);
+}
+#endif
+
 static int __ATTRS_o_ai
 vec_any_gt(vector float __a, vector float __b)
 {
@@ -12285,6 +12901,57 @@
                                       (vector unsigned int)__b);
 }
 
+#ifdef __POWER8_VECTOR__
+static int __ATTRS_o_ai
+vec_any_le(vector signed long long __a, vector signed long long __b)
+{
+  return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a, __b);
+}
+
+static int __ATTRS_o_ai
+vec_any_le(vector unsigned long long __a, vector unsigned long long __b)
+{
+  return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a, __b);
+}
+
+static int __ATTRS_o_ai
+vec_any_le(vector signed long long __a, vector bool long long __b)
+{
+  return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a,
+                                      (vector signed long long)__b);
+}
+
+static int __ATTRS_o_ai
+vec_any_le(vector unsigned long long __a, vector bool long long __b)
+{
+  return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a, 
+                                      (vector unsigned long long)__b);
+}
+
+static int __ATTRS_o_ai
+vec_any_le(vector bool long long __a, vector signed long long __b)
+{
+  return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
+                                      (vector unsigned long long)__a,
+                                      (vector unsigned long long)__b);
+}
+
+static int __ATTRS_o_ai
+vec_any_le(vector bool long long __a, vector unsigned long long __b)
+{
+  return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, 
+                                      (vector unsigned long long)__a, __b);
+}
+
+static int __ATTRS_o_ai
+vec_any_le(vector bool long long __a, vector bool long long __b)
+{
+  return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
+                                      (vector unsigned long long)__a,
+                                      (vector unsigned long long)__b);
+}
+#endif
+
 static int __ATTRS_o_ai
 vec_any_le(vector float __a, vector float __b)
 {
@@ -12435,6 +13102,57 @@
                                       (vector unsigned int)__a);
 }
 
+#ifdef __POWER8_VECTOR__
+static int __ATTRS_o_ai
+vec_any_lt(vector signed long long __a, vector signed long long __b)
+{
+  return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __b, __a);
+}
+
+static int __ATTRS_o_ai
+vec_any_lt(vector unsigned long long __a, vector unsigned long long __b)
+{
+  return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b, __a);
+}
+
+static int __ATTRS_o_ai
+vec_any_lt(vector signed long long __a, vector bool long long __b)
+{
+  return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV,
+                                      (vector signed long long)__b, __a);
+}
+
+static int __ATTRS_o_ai
+vec_any_lt(vector unsigned long long __a, vector bool long long __b)
+{
+  return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, 
+                                      (vector unsigned long long)__b, __a);
+}
+
+static int __ATTRS_o_ai
+vec_any_lt(vector bool long long __a, vector signed long long __b)
+{
+  return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
+                                      (vector unsigned long long)__b,
+                                      (vector unsigned long long)__a);
+}
+
+static int __ATTRS_o_ai
+vec_any_lt(vector bool long long __a, vector unsigned long long __b)
+{
+  return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b, 
+                                      (vector unsigned long long)__a);
+}
+
+static int __ATTRS_o_ai
+vec_any_lt(vector bool long long __a, vector bool long long __b)
+{
+  return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
+                                      (vector unsigned long long)__b,
+                                      (vector unsigned long long)__a);
+}
+#endif
+
 static int __ATTRS_o_ai
 vec_any_lt(vector float __a, vector float __b)
 {
@@ -12607,6 +13325,61 @@
     __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, (vector int)__b);
 }
 
+#ifdef __POWER8_VECTOR__
+static int __ATTRS_o_ai
+vec_any_ne(vector signed long long __a, vector signed long long __b)
+{
+  return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a, __b);
+}
+
+static int __ATTRS_o_ai
+vec_any_ne(vector unsigned long long __a, vector unsigned long long __b)
+{
+  return
+    __builtin_altivec_vcmpequd_p(__CR6_LT_REV, (vector long long)__a, 
+                                 (vector long long)__b);
+}
+
+static int __ATTRS_o_ai
+vec_any_ne(vector signed long long __a, vector bool long long __b)
+{
+  return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a,
+                                      (vector signed long long)__b);
+}
+
+static int __ATTRS_o_ai
+vec_any_ne(vector unsigned long long __a, vector bool long long __b)
+{
+  return
+    __builtin_altivec_vcmpequd_p(__CR6_LT_REV, (vector signed long long)__a, 
+                                 (vector signed long long)__b);
+}
+
+static int __ATTRS_o_ai
+vec_any_ne(vector bool long long __a, vector signed long long __b)
+{
+  return
+    __builtin_altivec_vcmpequd_p(__CR6_LT_REV, (vector signed long long)__a, 
+                                 (vector signed long long)__b);
+}
+
+static int __ATTRS_o_ai
+vec_any_ne(vector bool long long __a, vector unsigned long long __b)
+{
+  return
+    __builtin_altivec_vcmpequd_p(__CR6_LT_REV, (vector signed long long)__a, 
+                                 (vector signed long long)__b);
+}
+
+static int __ATTRS_o_ai
+vec_any_ne(vector bool long long __a, vector bool long long __b)
+{
+  return
+    __builtin_altivec_vcmpequd_p(__CR6_LT_REV, (vector signed long long)__a, 
+                                 (vector signed long long)__b);
+}
+#endif
+
 static int __ATTRS_o_ai
 vec_any_ne(vector float __a, vector float __b)
 {
@@ -12661,6 +13434,133 @@
   return __builtin_altivec_vcmpbfp_p(__CR6_EQ_REV, __a, __b);
 }
 
+/* Power 8 Crypto functions
+Note: We diverge from the current GCC implementation with regard
+to cryptography and related functions as follows:
+- Only the SHA and AES instructions and builtins are disabled by -mno-crypto
+- The remaining ones are only available on Power8 and up so
+  require -mpower8-vector
+The justification for this is that export requirements require that
+Category:Vector.Crypto is optional (i.e. compliant hardware may not provide
+support). As a result, we need to be able to turn off support for those.
+The remaining ones (currently controlled by -mcrypto for GCC) still
+need to be provided on compliant hardware even if Vector.Crypto is not
+provided.
+FIXME: the naming convention for the builtins will be adjusted due
+to the inconsistency (__builtin_crypto_ prefix on builtins that cannot be
+removed with -mno-crypto). This is under development.
+*/
+#ifdef __CRYPTO__
+static vector unsigned long long __attribute__((__always_inline__))
+__builtin_crypto_vsbox (vector unsigned long long __a)
+{
+  return __builtin_altivec_crypto_vsbox(__a);
+}
+
+static vector unsigned long long __attribute__((__always_inline__))
+__builtin_crypto_vcipher (vector unsigned long long __a,
+                          vector unsigned long long __b)
+{
+  return __builtin_altivec_crypto_vcipher(__a, __b);
+}
+
+static vector unsigned long long __attribute__((__always_inline__))
+__builtin_crypto_vcipherlast (vector unsigned long long __a,
+                              vector unsigned long long __b)
+{
+  return __builtin_altivec_crypto_vcipherlast(__a, __b);
+}
+
+static vector unsigned long long __attribute__((__always_inline__))
+__builtin_crypto_vncipher (vector unsigned long long __a,
+                           vector unsigned long long __b)
+{
+  return __builtin_altivec_crypto_vncipher(__a, __b);
+}
+
+static vector unsigned long long __attribute__((__always_inline__))
+__builtin_crypto_vncipherlast (vector unsigned long long __a,
+                               vector unsigned long long __b)
+{
+  return __builtin_altivec_crypto_vncipherlast(__a, __b);
+}
+
+
+#define __builtin_crypto_vshasigmad __builtin_altivec_crypto_vshasigmad
+#define __builtin_crypto_vshasigmaw __builtin_altivec_crypto_vshasigmaw
+#endif
+
+#ifdef __POWER8_VECTOR__
+static vector unsigned char __ATTRS_o_ai
+__builtin_crypto_vpermxor (vector unsigned char __a,
+                           vector unsigned char __b,
+                           vector unsigned char __c)
+{
+  return __builtin_altivec_crypto_vpermxor(__a, __b, __c);
+}
+
+static vector unsigned short __ATTRS_o_ai
+__builtin_crypto_vpermxor (vector unsigned short __a,
+                           vector unsigned short __b,
+                           vector unsigned short __c)
+{
+  return (vector unsigned short)
+          __builtin_altivec_crypto_vpermxor((vector unsigned char) __a,
+                                             (vector unsigned char) __b,
+                                             (vector unsigned char) __c);
+}
+
+static vector unsigned int __ATTRS_o_ai
+__builtin_crypto_vpermxor (vector unsigned int __a,
+                           vector unsigned int __b,
+                           vector unsigned int __c)
+{
+  return (vector unsigned int)
+          __builtin_altivec_crypto_vpermxor((vector unsigned char) __a,
+                                              (vector unsigned char) __b,
+                                              (vector unsigned char) __c);
+}
+
+static vector unsigned long long __ATTRS_o_ai
+__builtin_crypto_vpermxor (vector unsigned long long __a,
+                           vector unsigned long long __b,
+                           vector unsigned long long __c)
+{
+  return (vector unsigned long long)
+          __builtin_altivec_crypto_vpermxor((vector unsigned char) __a,
+                                              (vector unsigned char) __b,
+                                              (vector unsigned char) __c);
+}
+
+static vector unsigned char __ATTRS_o_ai
+__builtin_crypto_vpmsumb (vector unsigned char __a,
+                          vector unsigned char __b)
+{
+  return __builtin_altivec_crypto_vpmsumb(__a, __b);
+}
+
+static vector unsigned short __ATTRS_o_ai
+__builtin_crypto_vpmsumb (vector unsigned short __a,
+                          vector unsigned short __b)
+{
+  return __builtin_altivec_crypto_vpmsumh(__a, __b);
+}
+
+static vector unsigned int __ATTRS_o_ai
+__builtin_crypto_vpmsumb (vector unsigned int __a,
+                          vector unsigned int __b)
+{
+  return __builtin_altivec_crypto_vpmsumw(__a, __b);
+}
+
+static vector unsigned long long __ATTRS_o_ai
+__builtin_crypto_vpmsumb (vector unsigned long long __a,
+                          vector unsigned long long __b)
+{
+  return __builtin_altivec_crypto_vpmsumd(__a, __b);
+}
+#endif
+
 #undef __ATTRS_o_ai
 
 #endif /* __ALTIVEC_H */
diff --git a/renderscript/clang-include/avx2intrin.h b/renderscript/clang-include/avx2intrin.h
index 394fdfe..7485bdd 100644
--- a/renderscript/clang-include/avx2intrin.h
+++ b/renderscript/clang-include/avx2intrin.h
@@ -771,7 +771,7 @@
 static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
 _mm256_broadcastsi128_si256(__m128i __X)
 {
-  return (__m256i)__builtin_ia32_vbroadcastsi256(__X);
+  return (__m256i)__builtin_shufflevector(__X, __X, 0, 1, 0, 1);
 }
 
 #define _mm_blend_epi32(V1, V2, M) __extension__ ({ \
@@ -874,14 +874,21 @@
   __m256i __V2 = (V2); \
   (__m256i)__builtin_ia32_permti256(__V1, __V2, (M)); })
 
-#define _mm256_extracti128_si256(A, O) __extension__ ({ \
-  __m256i __A = (A); \
-  (__m128i)__builtin_ia32_extract128i256(__A, (O)); })
+#define _mm256_extracti128_si256(V, M) __extension__ ({ \
+  (__m128i)__builtin_shufflevector( \
+    (__v4di)(V), \
+    (__v4di)(_mm256_setzero_si256()), \
+    (((M) & 1) ? 2 : 0), \
+    (((M) & 1) ? 3 : 1) );})
 
-#define _mm256_inserti128_si256(V1, V2, O) __extension__ ({ \
-  __m256i __V1 = (V1); \
-  __m128i __V2 = (V2); \
-  (__m256i)__builtin_ia32_insert128i256(__V1, __V2, (O)); })
+#define _mm256_inserti128_si256(V1, V2, M) __extension__ ({ \
+  (__m256i)__builtin_shufflevector( \
+    (__v4di)(V1), \
+    (__v4di)_mm256_castsi128_si256((__m128i)(V2)), \
+    (((M) & 1) ? 0 : 4), \
+    (((M) & 1) ? 1 : 5), \
+    (((M) & 1) ? 4 : 2), \
+    (((M) & 1) ? 5 : 3) );})
 
 static __inline__ __m256i __attribute__((__always_inline__, __nodebug__))
 _mm256_maskload_epi32(int const *__X, __m256i __M)
diff --git a/renderscript/clang-include/avxintrin.h b/renderscript/clang-include/avxintrin.h
index d7c7f46..f30a5ad 100644
--- a/renderscript/clang-include/avxintrin.h
+++ b/renderscript/clang-include/avxintrin.h
@@ -429,19 +429,6 @@
   __m128 __b = (b); \
   (__m128)__builtin_ia32_cmpss((__v4sf)__a, (__v4sf)__b, (c)); })
 
-/* Vector extract */
-#define _mm256_extractf128_pd(A, O) __extension__ ({ \
-  __m256d __A = (A); \
-  (__m128d)__builtin_ia32_vextractf128_pd256((__v4df)__A, (O)); })
-
-#define _mm256_extractf128_ps(A, O) __extension__ ({ \
-  __m256 __A = (A); \
-  (__m128)__builtin_ia32_vextractf128_ps256((__v8sf)__A, (O)); })
-
-#define _mm256_extractf128_si256(A, O) __extension__ ({ \
-  __m256i __A = (A); \
-  (__m128i)__builtin_ia32_vextractf128_si256((__v8si)__A, (O)); })
-
 static __inline int __attribute__((__always_inline__, __nodebug__))
 _mm256_extract_epi32(__m256i __a, const int __imm)
 {
@@ -472,22 +459,6 @@
 }
 #endif
 
-/* Vector insert */
-#define _mm256_insertf128_pd(V1, V2, O) __extension__ ({ \
-  __m256d __V1 = (V1); \
-  __m128d __V2 = (V2); \
-  (__m256d)__builtin_ia32_vinsertf128_pd256((__v4df)__V1, (__v2df)__V2, (O)); })
-
-#define _mm256_insertf128_ps(V1, V2, O) __extension__ ({ \
-  __m256 __V1 = (V1); \
-  __m128 __V2 = (V2); \
-  (__m256)__builtin_ia32_vinsertf128_ps256((__v8sf)__V1, (__v4sf)__V2, (O)); })
-
-#define _mm256_insertf128_si256(V1, V2, O) __extension__ ({ \
-  __m256i __V1 = (V1); \
-  __m128i __V2 = (V2); \
-  (__m256i)__builtin_ia32_vinsertf128_si256((__v8si)__V1, (__v4si)__V2, (O)); })
-
 static __inline __m256i __attribute__((__always_inline__, __nodebug__))
 _mm256_insert_epi32(__m256i __a, int __b, int const __imm)
 {
@@ -1166,6 +1137,70 @@
   return __builtin_shufflevector(__a, __a, 0, 1, -1, -1);
 }
 
+/* 
+   Vector insert.
+   We use macros rather than inlines because we only want to accept
+   invocations where the immediate M is a constant expression.
+*/
+#define _mm256_insertf128_ps(V1, V2, M) __extension__ ({ \
+  (__m256)__builtin_shufflevector( \
+    (__v8sf)(V1), \
+    (__v8sf)_mm256_castps128_ps256((__m128)(V2)), \
+    (((M) & 1) ?  0 :  8), \
+    (((M) & 1) ?  1 :  9), \
+    (((M) & 1) ?  2 : 10), \
+    (((M) & 1) ?  3 : 11), \
+    (((M) & 1) ?  8 :  4), \
+    (((M) & 1) ?  9 :  5), \
+    (((M) & 1) ? 10 :  6), \
+    (((M) & 1) ? 11 :  7) );})
+
+#define _mm256_insertf128_pd(V1, V2, M) __extension__ ({ \
+  (__m256d)__builtin_shufflevector( \
+    (__v4df)(V1), \
+    (__v4df)_mm256_castpd128_pd256((__m128d)(V2)), \
+    (((M) & 1) ? 0 : 4), \
+    (((M) & 1) ? 1 : 5), \
+    (((M) & 1) ? 4 : 2), \
+    (((M) & 1) ? 5 : 3) );})
+
+#define _mm256_insertf128_si256(V1, V2, M) __extension__ ({ \
+  (__m256i)__builtin_shufflevector( \
+    (__v4di)(V1), \
+    (__v4di)_mm256_castsi128_si256((__m128i)(V2)), \
+    (((M) & 1) ? 0 : 4), \
+    (((M) & 1) ? 1 : 5), \
+    (((M) & 1) ? 4 : 2), \
+    (((M) & 1) ? 5 : 3) );})
+
+/* 
+   Vector extract.
+   We use macros rather than inlines because we only want to accept
+   invocations where the immediate M is a constant expression.
+*/
+#define _mm256_extractf128_ps(V, M) __extension__ ({ \
+  (__m128)__builtin_shufflevector( \
+    (__v8sf)(V), \
+    (__v8sf)(_mm256_setzero_ps()), \
+    (((M) & 1) ? 4 : 0), \
+    (((M) & 1) ? 5 : 1), \
+    (((M) & 1) ? 6 : 2), \
+    (((M) & 1) ? 7 : 3) );})
+
+#define _mm256_extractf128_pd(V, M) __extension__ ({ \
+  (__m128d)__builtin_shufflevector( \
+    (__v4df)(V), \
+    (__v4df)(_mm256_setzero_pd()), \
+    (((M) & 1) ? 2 : 0), \
+    (((M) & 1) ? 3 : 1) );})
+
+#define _mm256_extractf128_si256(V, M) __extension__ ({ \
+  (__m128i)__builtin_shufflevector( \
+    (__v4di)(V), \
+    (__v4di)(_mm256_setzero_si256()), \
+    (((M) & 1) ? 2 : 0), \
+    (((M) & 1) ? 3 : 1) );})
+
 /* SIMD load ops (unaligned) */
 static __inline __m256 __attribute__((__always_inline__, __nodebug__))
 _mm256_loadu2_m128(float const *__addr_hi, float const *__addr_lo)
diff --git a/renderscript/clang-include/htmintrin.h b/renderscript/clang-include/htmintrin.h
new file mode 100644
index 0000000..4598ee0
--- /dev/null
+++ b/renderscript/clang-include/htmintrin.h
@@ -0,0 +1,131 @@
+/*===---- htmintrin.h - Standard header for PowerPC HTM ---------------===*\
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+\*===----------------------------------------------------------------------===*/
+
+#ifndef __HTMINTRIN_H
+#define __HTMINTRIN_H
+
+#ifndef __HTM__
+#error "HTM instruction set not enabled"
+#endif
+
+#ifdef __powerpc__
+
+#include <stdint.h>
+
+typedef uint64_t texasr_t;
+typedef uint32_t texasru_t;
+typedef uint32_t texasrl_t;
+typedef uintptr_t tfiar_t;
+typedef uintptr_t tfhar_t;
+
+#define _HTM_STATE(CR0) ((CR0 >> 1) & 0x3)
+#define _HTM_NONTRANSACTIONAL 0x0
+#define _HTM_SUSPENDED        0x1
+#define _HTM_TRANSACTIONAL    0x2
+
+#define _TEXASR_EXTRACT_BITS(TEXASR,BITNUM,SIZE) \
+  (((TEXASR) >> (63-(BITNUM))) & ((1<<(SIZE))-1))
+#define _TEXASRU_EXTRACT_BITS(TEXASR,BITNUM,SIZE) \
+  (((TEXASR) >> (31-(BITNUM))) & ((1<<(SIZE))-1))
+
+#define _TEXASR_FAILURE_CODE(TEXASR) \
+  _TEXASR_EXTRACT_BITS(TEXASR, 7, 8)
+#define _TEXASRU_FAILURE_CODE(TEXASRU) \
+  _TEXASRU_EXTRACT_BITS(TEXASRU, 7, 8)
+
+#define _TEXASR_FAILURE_PERSISTENT(TEXASR) \
+  _TEXASR_EXTRACT_BITS(TEXASR, 7, 1)
+#define _TEXASRU_FAILURE_PERSISTENT(TEXASRU) \
+  _TEXASRU_EXTRACT_BITS(TEXASRU, 7, 1)
+
+#define _TEXASR_DISALLOWED(TEXASR) \
+  _TEXASR_EXTRACT_BITS(TEXASR, 8, 1)
+#define _TEXASRU_DISALLOWED(TEXASRU) \
+  _TEXASRU_EXTRACT_BITS(TEXASRU, 8, 1)
+
+#define _TEXASR_NESTING_OVERFLOW(TEXASR) \
+  _TEXASR_EXTRACT_BITS(TEXASR, 9, 1)
+#define _TEXASRU_NESTING_OVERFLOW(TEXASRU) \
+  _TEXASRU_EXTRACT_BITS(TEXASRU, 9, 1)
+
+#define _TEXASR_FOOTPRINT_OVERFLOW(TEXASR) \
+  _TEXASR_EXTRACT_BITS(TEXASR, 10, 1)
+#define _TEXASRU_FOOTPRINT_OVERFLOW(TEXASRU) \
+  _TEXASRU_EXTRACT_BITS(TEXASRU, 10, 1)
+
+#define _TEXASR_SELF_INDUCED_CONFLICT(TEXASR) \
+  _TEXASR_EXTRACT_BITS(TEXASR, 11, 1)
+#define _TEXASRU_SELF_INDUCED_CONFLICT(TEXASRU) \
+  _TEXASRU_EXTRACT_BITS(TEXASRU, 11, 1)
+
+#define _TEXASR_NON_TRANSACTIONAL_CONFLICT(TEXASR) \
+  _TEXASR_EXTRACT_BITS(TEXASR, 12, 1)
+#define _TEXASRU_NON_TRANSACTIONAL_CONFLICT(TEXASRU) \
+  _TEXASRU_EXTRACT_BITS(TEXASRU, 12, 1)
+
+#define _TEXASR_TRANSACTION_CONFLICT(TEXASR) \
+  _TEXASR_EXTRACT_BITS(TEXASR, 13, 1)
+#define _TEXASRU_TRANSACTION_CONFLICT(TEXASRU) \
+  _TEXASRU_EXTRACT_BITS(TEXASRU, 13, 1)
+
+#define _TEXASR_TRANSLATION_INVALIDATION_CONFLICT(TEXASR) \
+  _TEXASR_EXTRACT_BITS(TEXASR, 14, 1)
+#define _TEXASRU_TRANSLATION_INVALIDATION_CONFLICT(TEXASRU) \
+  _TEXASRU_EXTRACT_BITS(TEXASRU, 14, 1)
+
+#define _TEXASR_IMPLEMENTAION_SPECIFIC(TEXASR) \
+  _TEXASR_EXTRACT_BITS(TEXASR, 15, 1)
+#define _TEXASRU_IMPLEMENTAION_SPECIFIC(TEXASRU) \
+  _TEXASRU_EXTRACT_BITS(TEXASRU, 15, 1)
+
+#define _TEXASR_INSTRUCTION_FETCH_CONFLICT(TEXASR) \
+  _TEXASR_EXTRACT_BITS(TEXASR, 16, 1)
+#define _TEXASRU_INSTRUCTION_FETCH_CONFLICT(TEXASRU) \
+  _TEXASRU_EXTRACT_BITS(TEXASRU, 16, 1)
+
+#define _TEXASR_ABORT(TEXASR) \
+  _TEXASR_EXTRACT_BITS(TEXASR, 31, 1)
+#define _TEXASRU_ABORT(TEXASRU) \
+  _TEXASRU_EXTRACT_BITS(TEXASRU, 31, 1)
+
+
+#define _TEXASR_SUSPENDED(TEXASR) \
+  _TEXASR_EXTRACT_BITS(TEXASR, 32, 1)
+
+#define _TEXASR_PRIVILEGE(TEXASR) \
+  _TEXASR_EXTRACT_BITS(TEXASR, 35, 2)
+
+#define _TEXASR_FAILURE_SUMMARY(TEXASR) \
+  _TEXASR_EXTRACT_BITS(TEXASR, 36, 1)
+
+#define _TEXASR_TFIAR_EXACT(TEXASR) \
+  _TEXASR_EXTRACT_BITS(TEXASR, 37, 1)
+
+#define _TEXASR_ROT(TEXASR) \
+  _TEXASR_EXTRACT_BITS(TEXASR, 38, 1)
+
+#define _TEXASR_TRANSACTION_LEVEL(TEXASR) \
+  _TEXASR_EXTRACT_BITS(TEXASR, 63, 12)
+
+#endif /* __powerpc */
+
+#endif /* __HTMINTRIN_H */
diff --git a/renderscript/clang-include/htmxlintrin.h b/renderscript/clang-include/htmxlintrin.h
new file mode 100644
index 0000000..8791afe
--- /dev/null
+++ b/renderscript/clang-include/htmxlintrin.h
@@ -0,0 +1,215 @@
+/*===---- htmxlintrin.h - XL compiler HTM execution intrinsics-------------===*\
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+\*===----------------------------------------------------------------------===*/
+
+#ifndef __HTMXLINTRIN_H
+#define __HTMXLINTRIN_H
+
+#ifndef __HTM__
+#error "HTM instruction set not enabled"
+#endif
+
+#include <htmintrin.h>
+
+#ifdef __powerpc__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define _TEXASR_PTR(TM_BUF) \
+  ((texasr_t *)((TM_BUF)+0))
+#define _TEXASRU_PTR(TM_BUF) \
+  ((texasru_t *)((TM_BUF)+0))
+#define _TEXASRL_PTR(TM_BUF) \
+  ((texasrl_t *)((TM_BUF)+4))
+#define _TFIAR_PTR(TM_BUF) \
+  ((tfiar_t *)((TM_BUF)+8))
+
+typedef char TM_buff_type[16];
+
+/* This macro can be used to determine whether a transaction was successfully 
+   started from the __TM_begin() and __TM_simple_begin() intrinsic functions
+   below.  */
+#define _HTM_TBEGIN_STARTED     1
+
+extern __inline long
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+__TM_simple_begin (void)
+{
+  if (__builtin_expect (__builtin_tbegin (0), 1))
+    return _HTM_TBEGIN_STARTED;
+  return 0;
+}
+
+extern __inline long
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+__TM_begin (void* const TM_buff)
+{
+  *_TEXASRL_PTR (TM_buff) = 0;
+  if (__builtin_expect (__builtin_tbegin (0), 1))
+    return _HTM_TBEGIN_STARTED;
+#ifdef __powerpc64__
+  *_TEXASR_PTR (TM_buff) = __builtin_get_texasr ();
+#else
+  *_TEXASRU_PTR (TM_buff) = __builtin_get_texasru ();
+  *_TEXASRL_PTR (TM_buff) = __builtin_get_texasr ();
+#endif
+  *_TFIAR_PTR (TM_buff) = __builtin_get_tfiar ();
+  return 0;
+}
+
+extern __inline long
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+__TM_end (void)
+{
+  if (__builtin_expect (__builtin_tend (0), 1))
+    return 1;
+  return 0;
+}
+
+extern __inline void
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+__TM_abort (void)
+{
+  __builtin_tabort (0);
+}
+
+extern __inline void
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+__TM_named_abort (unsigned char const code)
+{
+  __builtin_tabort (code);
+}
+
+extern __inline void
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+__TM_resume (void)
+{
+  __builtin_tresume ();
+}
+
+extern __inline void
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+__TM_suspend (void)
+{
+  __builtin_tsuspend ();
+}
+
+extern __inline long
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+__TM_is_user_abort (void* const TM_buff)
+{
+  texasru_t texasru = *_TEXASRU_PTR (TM_buff);
+  return _TEXASRU_ABORT (texasru);
+}
+
+extern __inline long
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+__TM_is_named_user_abort (void* const TM_buff, unsigned char *code)
+{
+  texasru_t texasru = *_TEXASRU_PTR (TM_buff);
+
+  *code = _TEXASRU_FAILURE_CODE (texasru);
+  return _TEXASRU_ABORT (texasru);
+}
+
+extern __inline long
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+__TM_is_illegal (void* const TM_buff)
+{
+  texasru_t texasru = *_TEXASRU_PTR (TM_buff);
+  return _TEXASRU_DISALLOWED (texasru);
+}
+
+extern __inline long
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+__TM_is_footprint_exceeded (void* const TM_buff)
+{
+  texasru_t texasru = *_TEXASRU_PTR (TM_buff);
+  return _TEXASRU_FOOTPRINT_OVERFLOW (texasru);
+}
+
+extern __inline long
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+__TM_nesting_depth (void* const TM_buff)
+{
+  texasrl_t texasrl;
+
+  if (_HTM_STATE (__builtin_ttest ()) == _HTM_NONTRANSACTIONAL)
+    {
+      texasrl = *_TEXASRL_PTR (TM_buff);
+      if (!_TEXASR_FAILURE_SUMMARY (texasrl))
+        texasrl = 0;
+    }
+  else
+    texasrl = (texasrl_t) __builtin_get_texasr ();
+
+  return _TEXASR_TRANSACTION_LEVEL (texasrl);
+}
+
+extern __inline long
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+__TM_is_nested_too_deep(void* const TM_buff)
+{
+  texasru_t texasru = *_TEXASRU_PTR (TM_buff);
+  return _TEXASRU_NESTING_OVERFLOW (texasru);
+}
+
+extern __inline long
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+__TM_is_conflict(void* const TM_buff)
+{
+  texasru_t texasru = *_TEXASRU_PTR (TM_buff);
+  /* Return TEXASR bits 11 (Self-Induced Conflict) through
+     14 (Translation Invalidation Conflict).  */
+  return (_TEXASRU_EXTRACT_BITS (texasru, 14, 4)) ? 1 : 0;
+}
+
+extern __inline long
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+__TM_is_failure_persistent(void* const TM_buff)
+{
+  texasru_t texasru = *_TEXASRU_PTR (TM_buff);
+  return _TEXASRU_FAILURE_PERSISTENT (texasru);
+}
+
+extern __inline long
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+__TM_failure_address(void* const TM_buff)
+{
+  return *_TFIAR_PTR (TM_buff);
+}
+
+extern __inline long long
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+__TM_failure_code(void* const TM_buff)
+{
+  return *_TEXASR_PTR (TM_buff);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __powerpc__ */
+
+#endif /* __HTMXLINTRIN_H  */
diff --git a/renderscript/include/rs_allocation_data.rsh b/renderscript/include/rs_allocation_data.rsh
index 578e73c..928b649 100644
--- a/renderscript/include/rs_allocation_data.rsh
+++ b/renderscript/include/rs_allocation_data.rsh
@@ -14,35 +14,50 @@
  * limitations under the License.
  */
 
-// Don't edit this file!  It is auto-generated by frameworks/rs/api/gen_runtime.
+// Don't edit this file!  It is auto-generated by frameworks/rs/api/generate.sh.
 
 /*
- * rs_allocation_data.rsh: Allocation routines
+ * rs_allocation_data.rsh: Allocation Data Access Functions
  *
- * TODO Adjust documentation.
+ * The functions below can be used to get and set the cells that comprise
+ * an allocation.
  *
- * Functions that can be used to query the characteristics of an allocation,
- * to set and get elements of the allocation.
+ * - Individual cells are accessed using the rsGetElementAt* and
+ *   rsSetElementAt functions.
+ * - Multiple cells can be copied using the rsAllocationCopy* and
+ *   rsAllocationV* functions.
+ * - For getting values through a sampler, use rsSample.
+ *
+ * The rsGetElementAt and rsSetElement* functions are somewhat misnamed.
+ * They don't get or set elements, which are akin to data types; they get
+ * or set cells.  Think of them as rsGetCellAt and and rsSetCellAt.
  */
+
 #ifndef RENDERSCRIPT_RS_ALLOCATION_DATA_RSH
 #define RENDERSCRIPT_RS_ALLOCATION_DATA_RSH
 
 /*
- * rsAllocationCopy1DRange: Copy consecutive values between allocations
+ * rsAllocationCopy1DRange: Copy consecutive cells between allocations
  *
- * Copies part of an allocation into another allocation.
+ * Copies the specified number of cells from one allocation to another.
  *
  * The two allocations must be different.  Using this function to copy whithin
  * the same allocation yields undefined results.
  *
+ * The function does not validate whether the offset plus count exceeds the size
+ * of either allocation.  Be careful!
+ *
+ * This function should only be called between 1D allocations.  Calling it
+ * on other allocations is undefined.
+ *
  * Parameters:
- *   dstAlloc Allocation to copy data into.
- *   dstOff The offset of the first element to be copied in the destination allocation.
- *   dstMip Mip level in the destination allocation.
- *   count The number of elements to be copied.
- *   srcAlloc The source data allocation.
- *   srcOff The offset of the first element in data to be copied in the source allocation.
- *   srcMip Mip level in the source allocation.
+ *   dstAlloc: Allocation to copy cells into.
+ *   dstOff: Offset in the destination of the first cell to be copied into.
+ *   dstMip: Mip level in the destination allocation.  0 if mip mapping is not used.
+ *   count: Number of cells to be copied.
+ *   srcAlloc: Source allocation.
+ *   srcOff: Offset in the source of the first cell to be copied.
+ *   srcMip: Mip level in the source allocation.  0 if mip mapping is not used.
  */
 #if (defined(RS_VERSION) && (RS_VERSION >= 14))
 extern void __attribute__((overloadable))
@@ -51,26 +66,33 @@
 #endif
 
 /*
- * rsAllocationCopy2DRange: Copy a rectangular region between allocations
+ * rsAllocationCopy2DRange: Copy a rectangular region of cells between allocations
  *
- * Copy a rectangular region into the allocation from another allocation.
+ * Copies a rectangular region of cells from one allocation to another.
+ * (width * heigth) cells are copied.
  *
  * The two allocations must be different.  Using this function to copy whithin
  * the same allocation yields undefined results.
  *
+ * The function does not validate whether the the source or destination region
+ * exceeds the size of its respective allocation.  Be careful!
+ *
+ * This function should only be called between 2D allocations.  Calling it
+ * on other allocations is undefined.
+ *
  * Parameters:
- *   dstAlloc Allocation to copy data into.
- *   dstXoff X offset of the region to update in the destination allocation.
- *   dstYoff Y offset of the region to update in the destination allocation.
- *   dstMip Mip level in the destination allocation.
- *   dstFace Cubemap face of the destination allocation, ignored for allocations that aren't cubemaps.
- *   width Width of the incoming region to update.
- *   height Height of the incoming region to update.
- *   srcAlloc The source data allocation.
- *   srcXoff X offset in data of the source allocation.
- *   srcYoff Y offset in data of the source allocation.
- *   srcMip Mip level in the source allocation.
- *   srcFace Cubemap face of the source allocation, ignored for allocations that aren't cubemaps.
+ *   dstAlloc: Allocation to copy cells into.
+ *   dstXoff: X offset in the destination of the region to be set.
+ *   dstYoff: Y offset in the destination of the region to be set.
+ *   dstMip: Mip level in the destination allocation.  0 if mip mapping is not used.
+ *   dstFace: Cubemap face of the destination allocation.  Ignored for allocations that aren't cubemaps.
+ *   width: Width of the incoming region to update.
+ *   height: Height of the incoming region to update.
+ *   srcAlloc: Source allocation.
+ *   srcXoff: X offset in the source.
+ *   srcYoff: Y offset in the source.
+ *   srcMip: Mip level in the source allocation.  0 if mip mapping is not used.
+ *   srcFace: Cubemap face of the source allocation.  Ignored for allocations that aren't cubemaps.
  */
 #if (defined(RS_VERSION) && (RS_VERSION >= 14))
 extern void __attribute__((overloadable))
@@ -81,7 +103,34 @@
 #endif
 
 /*
- * Get a single element from an allocation.
+ * rsAllocationVLoadX: Get a vector from an allocation of scalars
+ *
+ * This function returns a vector composed of successive cells of the allocation.
+ * It assumes that the allocation contains scalars.
+ *
+ * The "X" in the name indicates that successive values are extracted by
+ * increasing the X index.  There are currently no functions to get successive
+ * values incrementing other dimensions.  Use multiple calls to rsGetElementAt()
+ * instead.
+ *
+ * For example, when calling rsAllocationVLoadX_int4(a, 20, 30),
+ * an int4 composed of a[20, 30], a[21, 30], a[22, 30], and a[23, 30] is returned.
+ *
+ * When retrieving from a three dimensional allocations, use the x, y, z
+ * variant.   Similarly, use the x, y variant for two dimensional
+ * allocations and x for the mono dimensional allocations.
+ *
+ * For efficiency, this function does not validate the inputs.  Trying to
+ * wrap the X index, exceeding the size of the allocation, or using indexes
+ * incompatible with the dimensionality of the allocation yields undefined results.
+ *
+ * See also rsAllocationVStoreX().
+ *
+ * Parameters:
+ *   a: Allocation to get the data from.
+ *   x: X offset in the allocation of the first cell to be copied from.
+ *   y: Y offset in the allocation of the first cell to be copied from.
+ *   z: Z offset in the allocation of the first cell to be copied from.
  */
 #if (defined(RS_VERSION) && (RS_VERSION >= 22))
 extern float2 __attribute__((overloadable))
@@ -534,7 +583,35 @@
 #endif
 
 /*
- * Set a single element of an allocation.
+ * rsAllocationVStoreX: Store a vector into an allocation of scalars
+ *
+ * This function stores the entries of a vector into successive cells of an
+ * allocation.  It assumes that the allocation contains scalars.
+ *
+ * The "X" in the name indicates that successive values are stored by
+ * increasing the X index.  There are currently no functions to store successive
+ * values incrementing other dimensions.  Use multiple calls to rsSetElementAt()
+ * instead.
+ *
+ * For example, when calling rsAllocationVStoreX_int3(a, v, 20, 30),
+ * v.x is stored at a[20, 30], v.y at a[21, 30], and v.z at a[22, 30].
+ *
+ * When storing into a three dimensional allocations, use the x, y, z
+ * variant.   Similarly, use the x, y variant for two dimensional
+ * allocations and x for the mono dimensional allocations.
+ *
+ * For efficiency, this function does not validate the inputs.  Trying to
+ * wrap the X index, exceeding the size of the allocation, or using indexes
+ * incompatible with the dimensionality of the allocation yiels undefined results.
+ *
+ * See also rsAllocationVLoadX().
+ *
+ * Parameters:
+ *   a: Allocation to store the data into.
+ *   val: Value to be stored.
+ *   x: X offset in the allocation of the first cell to be copied into.
+ *   y: Y offset in the allocation of the first cell to be copied into.
+ *   z: Z offset in the allocation of the first cell to be copied into.
  */
 #if (defined(RS_VERSION) && (RS_VERSION >= 22))
 extern void __attribute__((overloadable))
@@ -987,9 +1064,18 @@
 #endif
 
 /*
- * rsGetElementAt: Get an element
+ * rsGetElementAt: Return a cell from an allocation
  *
- * Extract a single element from an allocation.
+ * This function extracts a single cell from an allocation.
+ *
+ * When retrieving from a three dimensional allocations, use the x, y, z
+ * variant.   Similarly, use the x, y variant for two dimensional
+ * allocations and x for the mono dimensional allocations.
+ *
+ * This function has two styles.  One returns the address of the value using a
+ * void*, the other returns the actual value, e.g. rsGetElementAt() vs.
+ * rsGetElementAt_int4().  For primitive types, always use the latter as it is
+ * more efficient.
  */
 extern const void* __attribute__((overloadable))
     rsGetElementAt(rs_allocation a, uint32_t x);
@@ -2441,9 +2527,15 @@
 #endif
 
 /*
- * Extract a single element from an allocation.
+ * rsGetElementAtYuv_uchar_U: Get the U component of an allocation of YUVs
  *
- * Coordinates are in the dimensions of the Y plane
+ * Extracts the U component of a single YUV value from a 2D allocation of YUVs.
+ *
+ * Inside an allocation, Y, U, and V components may be stored if different planes
+ * and at different resolutions.  The x, y coordinates provided here are in the
+ * dimensions of the Y plane.
+ *
+ * See rsGetElementAtYuv_uchar_Y().
  */
 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
 extern uchar __attribute__((overloadable))
@@ -2451,9 +2543,15 @@
 #endif
 
 /*
- * Extract a single element from an allocation.
+ * rsGetElementAtYuv_uchar_V: Get the V component of an allocation of YUVs
  *
- * Coordinates are in the dimensions of the Y plane
+ * Extracts the V component of a single YUV value from a 2D allocation of YUVs.
+ *
+ * Inside an allocation, Y, U, and V components may be stored if different planes
+ * and at different resolutions.  The x, y coordinates provided here are in the
+ * dimensions of the Y plane.
+ *
+ * See rsGetElementAtYuv_uchar_Y().
  */
 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
 extern uchar __attribute__((overloadable))
@@ -2461,7 +2559,15 @@
 #endif
 
 /*
- * Extract a single element from an allocation.
+ * rsGetElementAtYuv_uchar_Y: Get the Y component of an allocation of YUVs
+ *
+ * Extracts the Y component of a single YUV value from a 2D allocation of YUVs.
+ *
+ * Inside an allocation, Y, U, and V components may be stored if different planes
+ * and at different resolutions.  The x, y coordinates provided here are in the
+ * dimensions of the Y plane.
+ *
+ * See rsGetElementAtYuv_uchar_U() and rsGetElementAtYuv_uchar_V().
  */
 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
 extern uchar __attribute__((overloadable))
@@ -2469,16 +2575,20 @@
 #endif
 
 /*
- * Fetch allocation in a way described by the sampler
+ * rsSample: Sample a value from a texture allocation
  *
- * If your allocation is 1D, use the variant with float for location.
- * For 2D, use the float2 variant.
+ * Fetches a value from a texture allocation in a way described by the sampler.
+ *
+ * If your allocation is 1D, use the variant with float for location.  For 2D,
+ * use the float2 variant.
+ *
+ * See android.renderscript.Sampler for more details.
  *
  * Parameters:
- *   a allocation to sample from
- *   s sampler state
- *   location location to sample from
- *   lod mip level to sample from, for fractional values mip levels will be interpolated if RS_SAMPLER_LINEAR_MIP_LINEAR is used
+ *   a: Allocation to sample from.
+ *   s: Sampler state.
+ *   location: Location to sample from.
+ *   lod: Mip level to sample from, for fractional values mip levels will be interpolated if RS_SAMPLER_LINEAR_MIP_LINEAR is used.
  */
 #if (defined(RS_VERSION) && (RS_VERSION >= 16))
 extern float4 __attribute__((overloadable))
@@ -2501,9 +2611,20 @@
 #endif
 
 /*
- * rsSetElementAt: Set an element
+ * rsSetElementAt: Set a cell of an allocation
  *
- * Set single element of an allocation.
+ * This function stores a value into a single cell of an allocation.
+ *
+ * When storing into a three dimensional allocations, use the x, y, z
+ * variant.   Similarly, use the x, y variant for two dimensional
+ * allocations and x for the mono dimensional allocations.
+ *
+ * This function has two styles.  One passes the value to be stored using
+ * a void*, the other has the actual value as an argument, e.g. rsSetElementAt()
+ * vs. rsSetElementAt_int4().  For primitive types, always use the latter as it is
+ * more efficient.
+ *
+ * See also rsGetElementAt().
  */
 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
 extern void __attribute__((overloadable))
diff --git a/renderscript/include/rs_atomic.rsh b/renderscript/include/rs_atomic.rsh
index 29c294a..cc2b8d5 100644
--- a/renderscript/include/rs_atomic.rsh
+++ b/renderscript/include/rs_atomic.rsh
@@ -14,16 +14,16 @@
  * limitations under the License.
  */
 
-// Don't edit this file!  It is auto-generated by frameworks/rs/api/gen_runtime.
+// Don't edit this file!  It is auto-generated by frameworks/rs/api/generate.sh.
 
 /*
- * rs_atomic.rsh: Atomic routines
+ * rs_atomic.rsh: Atomic Update Functions
  *
  * To update values shared between multiple threads, use the functions below.
  * They ensure that the values are atomically updated, i.e. that the memory
- * reads, the updates, and the memory writes are all done in the right order.
+ * reads, the updates, and the memory writes are done in the right order.
  *
- * These functions are slower than just doing the non-atomic variants, so use
+ * These functions are slower than their non-atomic equivalents, so use
  * them only when synchronization is needed.
  *
  * Note that in RenderScript, your code is likely to be running in separate
@@ -32,6 +32,7 @@
  * threads.  Updating globals should be done with atomic functions.  If possible,
  * modify your algorithm to avoid them altogether.
  */
+
 #ifndef RENDERSCRIPT_RS_ATOMIC_RSH
 #define RENDERSCRIPT_RS_ATOMIC_RSH
 
@@ -41,10 +42,10 @@
  * Atomicly adds a value to the value at addr, i.e. *addr += value.
  *
  * Parameters:
- *   addr Address of the value to modify
- *   value Amount to add
+ *   addr: Address of the value to modify.
+ *   value: Amount to add.
  *
- * Returns: Old value
+ * Returns: Value of *addr prior to the operation.
  */
 #if (defined(RS_VERSION) && (RS_VERSION >= 14))
 extern int32_t __attribute__((overloadable))
@@ -60,13 +61,13 @@
  * rsAtomicAnd: Thread-safe bitwise and
  *
  * Atomicly performs a bitwise and of two values, storing the result back at addr,
- * i.e. *addr &= value
+ * i.e. *addr &= value.
  *
  * Parameters:
- *   addr Address of the value to modify
- *   value Value to and with
+ *   addr: Address of the value to modify.
+ *   value: Value to and with.
  *
- * Returns: Old value
+ * Returns: Value of *addr prior to the operation.
  */
 #if (defined(RS_VERSION) && (RS_VERSION >= 14))
 extern int32_t __attribute__((overloadable))
@@ -82,17 +83,17 @@
  * rsAtomicCas: Thread-safe compare and set
  *
  * If the value at addr matches compareValue then the newValue is written at addr,
- * i.e. if (*addr == compareValue) { *addr = newValue; }
+ * i.e. if (*addr == compareValue) { *addr = newValue; }.
  *
  * You can check that the value was written by checking that the value returned
- * by rsAtomicCas is compareValue.
+ * by rsAtomicCas() is compareValue.
  *
  * Parameters:
- *   addr The address to compare and replace if the compare passes.
- *   compareValue The value to test *addr against.
- *   newValue The value to write if the test passes.
+ *   addr: The address of the value to compare and replace if the test passes.
+ *   compareValue: The value to test *addr against.
+ *   newValue: The value to write if the test passes.
  *
- * Returns: Old value
+ * Returns: Value of *addr prior to the operation.
  */
 #if (defined(RS_VERSION) && (RS_VERSION >= 14))
 extern int32_t __attribute__((overloadable))
@@ -107,12 +108,12 @@
 /*
  * rsAtomicDec: Thread-safe decrement
  *
- * Atomicly subtracts one from the value at addr.  Equal to rsAtomicSub(addr, 1)
+ * Atomicly subtracts one from the value at addr.  This is equivalent to rsAtomicSub(addr, 1).
  *
  * Parameters:
- *   addr Address of the value to decrement
+ *   addr: Address of the value to decrement.
  *
- * Returns: Old value
+ * Returns: Value of *addr prior to the operation.
  */
 #if (defined(RS_VERSION) && (RS_VERSION >= 14))
 extern int32_t __attribute__((overloadable))
@@ -127,12 +128,12 @@
 /*
  * rsAtomicInc: Thread-safe increment
  *
- * Atomicly adds one to the value at addr.  Equal to rsAtomicAdd(addr, 1)
+ * Atomicly adds one to the value at addr.  This is equivalent to rsAtomicAdd(addr, 1).
  *
  * Parameters:
- *   addr Address of the value to increment
+ *   addr: Address of the value to increment.
  *
- * Returns: Old value
+ * Returns: Value of *addr prior to the operation.
  */
 #if (defined(RS_VERSION) && (RS_VERSION >= 14))
 extern int32_t __attribute__((overloadable))
@@ -147,14 +148,14 @@
 /*
  * rsAtomicMax: Thread-safe maximum
  *
- * Atomicly sets the value at addr to the maximum of addr and value, i.e.
- * *addr = max(*addr, value)
+ * Atomicly sets the value at addr to the maximum of *addr and value, i.e.
+ * *addr = max(*addr, value).
  *
  * Parameters:
- *   addr Address of the value to modify
- *   value Comparison value
+ *   addr: Address of the value to modify.
+ *   value: Comparison value.
  *
- * Returns: Old value
+ * Returns: Value of *addr prior to the operation.
  */
 #if (defined(RS_VERSION) && (RS_VERSION >= 14))
 extern uint32_t __attribute__((overloadable))
@@ -169,14 +170,14 @@
 /*
  * rsAtomicMin: Thread-safe minimum
  *
- * Atomicly sets the value at addr to the minimum of addr and value, i.e.
- * *addr = min(*addr, value)
+ * Atomicly sets the value at addr to the minimum of *addr and value, i.e.
+ * *addr = min(*addr, value).
  *
  * Parameters:
- *   addr Address of the value to modify
- *   value Comparison value
+ *   addr: Address of the value to modify.
+ *   value: Comparison value.
  *
- * Returns: Old value
+ * Returns: Value of *addr prior to the operation.
  */
 #if (defined(RS_VERSION) && (RS_VERSION >= 14))
 extern uint32_t __attribute__((overloadable))
@@ -192,13 +193,13 @@
  * rsAtomicOr: Thread-safe bitwise or
  *
  * Atomicly perform a bitwise or two values, storing the result at addr,
- * i.e. *addr |= value
+ * i.e. *addr |= value.
  *
  * Parameters:
- *   addr Address of the value to modify
- *   value Value to or with
+ *   addr: Address of the value to modify.
+ *   value: Value to or with.
  *
- * Returns: Old value
+ * Returns: Value of *addr prior to the operation.
  */
 #if (defined(RS_VERSION) && (RS_VERSION >= 14))
 extern int32_t __attribute__((overloadable))
@@ -213,13 +214,13 @@
 /*
  * rsAtomicSub: Thread-safe subtraction
  *
- * Atomicly subtracts a value from the value at addr, i.e. *addr -= value
+ * Atomicly subtracts a value from the value at addr, i.e. *addr -= value.
  *
  * Parameters:
- *   addr Address of the value to modify
- *   value Amount to subtract
+ *   addr: Address of the value to modify.
+ *   value: Amount to subtract.
  *
- * Returns: Old value
+ * Returns: Value of *addr prior to the operation.
  */
 #if (defined(RS_VERSION) && (RS_VERSION >= 14))
 extern int32_t __attribute__((overloadable))
@@ -235,13 +236,13 @@
  * rsAtomicXor: Thread-safe bitwise exclusive or
  *
  * Atomicly performs a bitwise xor of two values, storing the result at addr,
- * i.e. *addr ^= value
+ * i.e. *addr ^= value.
  *
  * Parameters:
- *   addr Address of the value to modify
- *   value Value to xor with
+ *   addr: Address of the value to modify.
+ *   value: Value to xor with.
  *
- * Returns: Old value
+ * Returns: Value of *addr prior to the operation.
  */
 #if (defined(RS_VERSION) && (RS_VERSION >= 14))
 extern int32_t __attribute__((overloadable))
diff --git a/renderscript/include/rs_convert.rsh b/renderscript/include/rs_convert.rsh
index 4a94be2..7abd557 100644
--- a/renderscript/include/rs_convert.rsh
+++ b/renderscript/include/rs_convert.rsh
@@ -14,24 +14,30 @@
  * limitations under the License.
  */
 
-// Don't edit this file!  It is auto-generated by frameworks/rs/api/gen_runtime.
+// Don't edit this file!  It is auto-generated by frameworks/rs/api/generate.sh.
 
 /*
- * rs_convert.rsh: Conversion functions
+ * rs_convert.rsh: Conversion Functions
  *
- * TODO Add desc.
+ * The functions below convert from a numerical vector type to another,
+ * of from one color representation to another.
  */
+
 #ifndef RENDERSCRIPT_RS_CONVERT_RSH
 #define RENDERSCRIPT_RS_CONVERT_RSH
 
 /*
- * convert: Converts numerical vectors
+ * convert: Convert numerical vectors
  *
- * Component wise conversion from a numerical type to another.
+ * Converts a vector from one numerical type to another.  The conversion are
+ * done entry per entry.
  *
- * Conversions of floating point values to integer will truncate.
+ * E.g calling a = convert_short3(b) is equivalent to doing
+ * a.x = (short)b.x; a.y = (short)b.y; a.z = (short)b.z;.
  *
- * Conversions of numbers too large to fit the destination type yield undefined results.
+ * Converting floating point values to integer types truncates.
+ *
+ * Converting numbers too large to fit the destination type yields undefined results.
  * For example, converting a float that contains 1.0e18 to a short is undefined.
  * Use clamp() to avoid this.
  */
@@ -1242,10 +1248,22 @@
 #endif
 
 /*
- * Pack floating point (0-1) RGB values into a uchar4.
+ * rsPackColorTo8888: Create a uchar4 RGBA from floats
  *
- * For the float3 variant and the variant that only specifies r, g, b,
- * the alpha component is set to 255 (1.0).
+ * Packs three or four floating point RGBA values into a uchar4.  The RGBA values should
+ * be between 0.0 and 1.0 inclusive.  Values outside of this range are clamped to
+ * this range.  However numbers greater than INT_MAX or less than INT_MIN can result
+ * in undefined behavior.
+ *
+ * If the alpha component is not specified, it is assumed to be 1.0, i.e. the
+ * result will have an alpha set to 255.
+ *
+ * Parameters:
+ *   r: Red component.
+ *   g: Green component.
+ *   b: Blue component.
+ *   a: Alpha component.
+ *   color: Vector of 3 or 4 floats containing the R, G, B, and A values.
  */
 extern uchar4 __attribute__((const, overloadable))
     rsPackColorTo8888(float r, float g, float b);
@@ -1260,13 +1278,25 @@
     rsPackColorTo8888(float4 color);
 
 /*
- * Unpack a uchar4 color to float4.  The resulting float range will be (0-1).
+ * rsUnpackColor8888: Create a float4 RGBA from uchar4
+ *
+ * Unpacks a uchar4 color to float4.  The resulting floats will be between 0.0 and
+ * 1.0 inclusive.
  */
 extern float4 __attribute__((const))
     rsUnpackColor8888(uchar4 c);
 
 /*
- * Convert from YUV to RGBA.
+ * rsYuvToRGBA: Convert a YUV value to RGBA
+ *
+ * Converts a color from a YUV representation to RGBA.
+ *
+ * We currently don't provide a function to do the reverse conversion.
+ *
+ * Parameters:
+ *   y: Luminance component
+ *   u: U chrominance component
+ *   v: V chrominance component
  */
 extern float4 __attribute__((const, overloadable))
     rsYuvToRGBA_float4(uchar y, uchar u, uchar v);
diff --git a/renderscript/include/rs_core.rsh b/renderscript/include/rs_core.rsh
index ff65d22..be9f7fa 100644
--- a/renderscript/include/rs_core.rsh
+++ b/renderscript/include/rs_core.rsh
@@ -14,10 +14,10 @@
  * limitations under the License.
  */
 
-// Don't edit this file!  It is auto-generated by frameworks/rs/api/gen_runtime.
+// Don't edit this file!  It is auto-generated by frameworks/rs/api/generate.sh.
 
 /*
- * rs_core.rsh: TODO
+ * rs_core.rsh: Overview
  *
  * RenderScript is a high-performance runtime that provides
  * compute operations at the native level. RenderScript code is compiled on devices
@@ -33,6 +33,7 @@
  * Android framework APIs interact, see the RenderScript developer guide
  * and the RenderScript samples.
  */
+
 #ifndef RENDERSCRIPT_RS_CORE_RSH
 #define RENDERSCRIPT_RS_CORE_RSH
 
diff --git a/renderscript/include/rs_debug.rsh b/renderscript/include/rs_debug.rsh
index b6a6fb2..f75a4cf 100644
--- a/renderscript/include/rs_debug.rsh
+++ b/renderscript/include/rs_debug.rsh
@@ -14,15 +14,15 @@
  * limitations under the License.
  */
 
-// Don't edit this file!  It is auto-generated by frameworks/rs/api/gen_runtime.
+// Don't edit this file!  It is auto-generated by frameworks/rs/api/generate.sh.
 
 /*
- * rs_debug.rsh: Utility debugging routines
+ * rs_debug.rsh: Debugging Functions
  *
- * Routines intended to be used during application developement.  These should
- * not be used in shipping applications.  All print a string and value pair to
- * the standard log.
+ * The functions below are intended to be used during application developement.
+ * They should not be used in shipping applications.
  */
+
 #ifndef RENDERSCRIPT_RS_DEBUG_RSH
 #define RENDERSCRIPT_RS_DEBUG_RSH
 
@@ -30,7 +30,12 @@
 #define RS_DEBUG_MARKER rsDebug(__FILE__, __LINE__)
 
 /*
- * Debug function.  Prints a string and value to the log.
+ * rsDebug: Log a message and values
+ *
+ * This function prints a message to the standard log, followed by the provided values.
+ *
+ * This function is intended for debugging only and should not be used in shipping
+ * applications.
  */
 extern void __attribute__((overloadable))
     rsDebug(const char* message, double a);
@@ -107,6 +112,21 @@
     rsDebug(const char* message, ulong4 a);
 #endif
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern void __attribute__((overloadable))
+    rsDebug(const char* message, double2 a);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern void __attribute__((overloadable))
+    rsDebug(const char* message, double3 a);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern void __attribute__((overloadable))
+    rsDebug(const char* message, double4 a);
+#endif
+
 extern void __attribute__((overloadable))
     rsDebug(const char* message, float a);
 
diff --git a/renderscript/include/rs_for_each.rsh b/renderscript/include/rs_for_each.rsh
index 0a1e3a1..f08a4e3 100644
--- a/renderscript/include/rs_for_each.rsh
+++ b/renderscript/include/rs_for_each.rsh
@@ -14,73 +14,108 @@
  * limitations under the License.
  */
 
-// Don't edit this file!  It is auto-generated by frameworks/rs/api/gen_runtime.
+// Don't edit this file!  It is auto-generated by frameworks/rs/api/generate.sh.
 
 /*
- * rs_for_each.rsh: TODO Add documentation
+ * rs_for_each.rsh: Kernel Invocation Functions and Types
  *
- * TODO Add documentation
+ * The rsForEach() function can be used to invoke the root kernel of a script.
+ *
+ * The other functions are used to get the characteristics of the invocation of
+ * an executing kernel, like dimensions and current indexes.  These functions take
+ * a rs_kernel_context as argument.
  */
+
 #ifndef RENDERSCRIPT_RS_FOR_EACH_RSH
 #define RENDERSCRIPT_RS_FOR_EACH_RSH
 
 /*
- * rs_for_each_strategy_t: Launch order hint for rsForEach calls
+ * rs_for_each_strategy_t: Suggested cell processing order
  *
- * Launch order hint for rsForEach calls.  This provides a hint to the system to
- * determine in which order the root function of the target is called with each
- * cell of the allocation.
+ * This type is used to suggest how the invoked kernel should iterate over the cells of the
+ * allocations.  This is a hint only.  Implementations may not follow the suggestion.
  *
- * This is a hint and implementations may not obey the order.
+ * This specification can help the caching behavior of the running kernel, e.g. the cache
+ * locality when the processing is distributed over multiple cores.
  */
 typedef enum rs_for_each_strategy {
-    RS_FOR_EACH_STRATEGY_SERIAL = 0,
-    RS_FOR_EACH_STRATEGY_DONT_CARE = 1,
-    RS_FOR_EACH_STRATEGY_DST_LINEAR = 2,
-    RS_FOR_EACH_STRATEGY_TILE_SMALL = 3,
-    RS_FOR_EACH_STRATEGY_TILE_MEDIUM = 4,
-    RS_FOR_EACH_STRATEGY_TILE_LARGE = 5
+    RS_FOR_EACH_STRATEGY_SERIAL = 0, // Prefer contiguous memory regions.
+    RS_FOR_EACH_STRATEGY_DONT_CARE = 1, // No prefrences.
+    RS_FOR_EACH_STRATEGY_DST_LINEAR = 2, // Prefer DST.
+    RS_FOR_EACH_STRATEGY_TILE_SMALL = 3, // Prefer processing small rectangular regions.
+    RS_FOR_EACH_STRATEGY_TILE_MEDIUM = 4, // Prefer processing medium rectangular regions.
+    RS_FOR_EACH_STRATEGY_TILE_LARGE = 5 // Prefer processing large rectangular regions.
 } rs_for_each_strategy_t;
 
 /*
- * rs_kernel_context: Opaque handle to RenderScript kernel invocation context
+ * rs_kernel_context: Handle to a kernel invocation context
  *
- * TODO
+ * The kernel context contains common characteristics of the allocations being iterated
+ * over, like dimensions, and rarely used indexes, like the Array0 index or the current
+ * level of detail.
+ *
+ * A kernel may be executed in parallel over multiple threads.  Each thread will have its
+ * own context.
+ *
+ * You can access the context by adding a rs_kernel_context argument to your
+ * kernel function.  See rsGetDimX() and rsGetArray0() for examples.
  */
 #if (defined(RS_VERSION) && (RS_VERSION >= 23))
 typedef const struct rs_kernel_context_t * rs_kernel_context;
 #endif
 
 /*
- * rs_script_call_t: Provides extra information to a rsForEach call
+ * rs_script_call_t: Cell iteration information
  *
- * Structure to provide extra information to a rsForEach call.  Primarly used to
- * restrict the call to a subset of cells in the allocation.
+ * This structure is used to provide iteration information to a rsForEach call.
+ * It is currently used to restrict processing to a subset of cells.  In future
+ * versions, it will also be used to provide hint on how to best iterate over
+ * the cells.
+ *
+ * The Start fields are inclusive and the End fields are exclusive.  E.g. to iterate
+ * over cells 4, 5, 6, and 7 in the X dimension, set xStart to 4 and xEnd to 8.
  */
 typedef struct rs_script_call {
-    rs_for_each_strategy_t strategy;
-    uint32_t xStart;
-    uint32_t xEnd;
-    uint32_t yStart;
-    uint32_t yEnd;
-    uint32_t zStart;
-    uint32_t zEnd;
-    uint32_t arrayStart;
-    uint32_t arrayEnd;
+    rs_for_each_strategy_t strategy; // Currently ignored.  In the future, will be suggested cell iteration strategy.
+    uint32_t xStart; // Starting index in the X dimension.
+    uint32_t xEnd; // Ending index (exclusive) in the X dimension.
+    uint32_t yStart; // Starting index in the Y dimension.
+    uint32_t yEnd; // Ending index (exclusive) in the Y dimension.
+    uint32_t zStart; // Starting index in the Z dimension.
+    uint32_t zEnd; // Ending index (exclusive) in the Z dimension.
+    uint32_t arrayStart; // Starting index in the Array0 dimension.
+    uint32_t arrayEnd; // Ending index (exclusive) in the Array0 dimension.
 } rs_script_call_t;
 
 /*
- * Make a script to script call to launch work. One of the input or output is
- * required to be a valid object. The input and output must be of the same
- * dimensions.
+ * rsForEach: Invoke the root kernel of a script
+ *
+ * Invoke the kernel named "root" of the specified script.  Like other kernels, this root()
+ * function will be invoked repeatedly over the cells of the specificed allocation, filling
+ * the output allocation with the results.
+ *
+ * When rsForEach is called, the root script is launched immediately.  rsForEach returns
+ * only when the script has completed and the output allocation is ready to use.
+ *
+ * The rs_script argument is typically initialized using a global variable set from Java.
+ *
+ * The kernel can be invoked with just an input allocation or just an output allocation.
+ * This can be done by defining an rs_allocation variable and not initializing it.  E.g.
+ * rs_script gCustomScript;
+ * void specializedProcessing(rs_allocation in) {
+ *   rs_allocation ignoredOut;
+ *   rsForEach(gCustomScript, in, ignoredOut);
+ * }
+ *
+ * If both input and output allocations are specified, they must have the same dimensions.
  *
  * Parameters:
- *   script The target script to call
- *   input The allocation to source data from
- *   output the allocation to write date into
- *   usrData The user defined params to pass to the root script.  May be NULL.
- *   sc Extra control infomation used to select a sub-region of the allocation to be processed or suggest a walking strategy.  May be NULL.
- *   usrDataLen The size of the userData structure.  This will be used to perform a shallow copy of the data if necessary.
+ *   script: Script to call.
+ *   input: Allocation to source data from.
+ *   output: Allocation to write date into.
+ *   usrData: User defined data to pass to the script.  May be NULL.
+ *   sc: Extra control information used to select a sub-region of the allocation to be processed or suggest a walking strategy.  May be NULL.
+ *   usrDataLen: The size of the userData structure.  This will be used to perform a shallow copy of the data if necessary.
  */
 #if !defined(RS_VERSION) || (RS_VERSION <= 13)
 extern void __attribute__((overloadable))
@@ -275,6 +310,8 @@
  * function.  E.g.
  * int4 RS_KERNEL myKernel(int4 value, rs_kernel_context context) {
  *   uint32_t size = rsGetDimX(context); //...
+ *
+ * To get the dimension of specific allocation, use rsAllocationGetDimX().
  */
 #if (defined(RS_VERSION) && (RS_VERSION >= 23))
 extern uint32_t __attribute__((overloadable))
@@ -288,6 +325,8 @@
  * See rsGetDimX() for an explanation of the context.
  *
  * Returns 0 if the Y dimension is not present.
+ *
+ * To get the dimension of specific allocation, use rsAllocationGetDimY().
  */
 #if (defined(RS_VERSION) && (RS_VERSION >= 23))
 extern uint32_t __attribute__((overloadable))
@@ -301,6 +340,8 @@
  * See rsGetDimX() for an explanation of the context.
  *
  * Returns 0 if the Z dimension is not present.
+ *
+ * To get the dimension of specific allocation, use rsAllocationGetDimZ().
  */
 #if (defined(RS_VERSION) && (RS_VERSION >= 23))
 extern uint32_t __attribute__((overloadable))
@@ -322,7 +363,7 @@
 #endif
 
 /*
- * rsGetLod: Index in the Levels of Detail dimension for the specified context.
+ * rsGetLod: Index in the Levels of Detail dimension for the specified context
  *
  * Returns the index in the Levels of Detail dimension of the cell being
  * processed, as specified by the supplied context.  See rsGetArray0() for
diff --git a/renderscript/include/rs_graphics.rsh b/renderscript/include/rs_graphics.rsh
index 6742290..c133aad 100644
--- a/renderscript/include/rs_graphics.rsh
+++ b/renderscript/include/rs_graphics.rsh
@@ -14,15 +14,14 @@
  * limitations under the License.
  */
 
-// Don't edit this file!  It is auto-generated by frameworks/rs/api/gen_runtime.
+// Don't edit this file!  It is auto-generated by frameworks/rs/api/generate.sh.
 
 /*
- * rs_graphics.rsh: RenderScript graphics API
+ * rs_graphics.rsh: Graphics Functions and Types
  *
- * NOTE: RenderScript Graphics has been deprecated.  Do not use.
- *
- * A set of graphics functions used by RenderScript.
+ * The graphics subsystem of RenderScript has been deprecated.
  */
+
 #ifndef RENDERSCRIPT_RS_GRAPHICS_RSH
 #define RENDERSCRIPT_RS_GRAPHICS_RSH
 
@@ -37,20 +36,22 @@
 /*
  * rs_blend_src_func: Blend source function
  *
+ * DEPRECATED.  Do not use.
+ *
  */
 #ifndef __LP64__
 #if (defined(RS_VERSION) && (RS_VERSION >= 16))
 typedef enum {
-    RS_BLEND_SRC_ZERO                   = 0,
-    RS_BLEND_SRC_ONE                    = 1,
-    RS_BLEND_SRC_DST_COLOR              = 2,
-    RS_BLEND_SRC_ONE_MINUS_DST_COLOR    = 3,
-    RS_BLEND_SRC_SRC_ALPHA              = 4,
-    RS_BLEND_SRC_ONE_MINUS_SRC_ALPHA    = 5,
-    RS_BLEND_SRC_DST_ALPHA              = 6,
-    RS_BLEND_SRC_ONE_MINUS_DST_ALPHA    = 7,
-    RS_BLEND_SRC_SRC_ALPHA_SATURATE     = 8,
-    RS_BLEND_SRC_INVALID                = 100
+    RS_BLEND_SRC_ZERO = 0,
+    RS_BLEND_SRC_ONE = 1,
+    RS_BLEND_SRC_DST_COLOR = 2,
+    RS_BLEND_SRC_ONE_MINUS_DST_COLOR = 3,
+    RS_BLEND_SRC_SRC_ALPHA = 4,
+    RS_BLEND_SRC_ONE_MINUS_SRC_ALPHA = 5,
+    RS_BLEND_SRC_DST_ALPHA = 6,
+    RS_BLEND_SRC_ONE_MINUS_DST_ALPHA = 7,
+    RS_BLEND_SRC_SRC_ALPHA_SATURATE = 8,
+    RS_BLEND_SRC_INVALID = 100
 } rs_blend_src_func;
 #endif
 #endif
@@ -58,19 +59,21 @@
 /*
  * rs_blend_dst_func: Blend destination function
  *
+ * DEPRECATED.  Do not use.
+ *
  */
 #ifndef __LP64__
 #if (defined(RS_VERSION) && (RS_VERSION >= 16))
 typedef enum {
-    RS_BLEND_DST_ZERO                   = 0,
-    RS_BLEND_DST_ONE                    = 1,
-    RS_BLEND_DST_SRC_COLOR              = 2,
-    RS_BLEND_DST_ONE_MINUS_SRC_COLOR    = 3,
-    RS_BLEND_DST_SRC_ALPHA              = 4,
-    RS_BLEND_DST_ONE_MINUS_SRC_ALPHA    = 5,
-    RS_BLEND_DST_DST_ALPHA              = 6,
-    RS_BLEND_DST_ONE_MINUS_DST_ALPHA    = 7,
-    RS_BLEND_DST_INVALID                = 100
+    RS_BLEND_DST_ZERO = 0,
+    RS_BLEND_DST_ONE = 1,
+    RS_BLEND_DST_SRC_COLOR = 2,
+    RS_BLEND_DST_ONE_MINUS_SRC_COLOR = 3,
+    RS_BLEND_DST_SRC_ALPHA = 4,
+    RS_BLEND_DST_ONE_MINUS_SRC_ALPHA = 5,
+    RS_BLEND_DST_DST_ALPHA = 6,
+    RS_BLEND_DST_ONE_MINUS_DST_ALPHA = 7,
+    RS_BLEND_DST_INVALID = 100
 } rs_blend_dst_func;
 #endif
 #endif
@@ -78,14 +81,16 @@
 /*
  * rs_cull_mode: Culling mode
  *
+ * DEPRECATED.  Do not use.
+ *
  */
 #ifndef __LP64__
 #if (defined(RS_VERSION) && (RS_VERSION >= 16))
 typedef enum {
-    RS_CULL_BACK     = 0,
-    RS_CULL_FRONT    = 1,
-    RS_CULL_NONE     = 2,
-    RS_CULL_INVALID  = 100
+    RS_CULL_BACK = 0,
+    RS_CULL_FRONT = 1,
+    RS_CULL_NONE = 2,
+    RS_CULL_INVALID = 100
 } rs_cull_mode;
 #endif
 #endif
@@ -93,20 +98,22 @@
 /*
  * rs_depth_func: Depth function
  *
+ * DEPRECATED.  Do not use.
+ *
  * Specifies conditional drawing depending on the comparison of the incoming
  * depth to that found in the depth buffer.
  */
 #ifndef __LP64__
 #if (defined(RS_VERSION) && (RS_VERSION >= 16))
 typedef enum {
-    RS_DEPTH_FUNC_ALWAYS        = 0, // Always drawn
-    RS_DEPTH_FUNC_LESS          = 1, // Drawn if the incoming depth value is less than that in the depth buffer
-    RS_DEPTH_FUNC_LEQUAL        = 2, // Drawn if the incoming depth value is less or equal to that in the depth buffer
-    RS_DEPTH_FUNC_GREATER       = 3, // Drawn if the incoming depth value is greater than that in the depth buffer
-    RS_DEPTH_FUNC_GEQUAL        = 4, // Drawn if the incoming depth value is greater or equal to that in the depth buffer
-    RS_DEPTH_FUNC_EQUAL         = 5, // Drawn if the incoming depth value is equal to that in the depth buffer
-    RS_DEPTH_FUNC_NOTEQUAL      = 6, // Drawn if the incoming depth value is not equal to that in the depth buffer
-    RS_DEPTH_FUNC_INVALID       = 100 // Invalid depth function
+    RS_DEPTH_FUNC_ALWAYS = 0, // Always drawn
+    RS_DEPTH_FUNC_LESS = 1, // Drawn if the incoming depth value is less than that in the depth buffer
+    RS_DEPTH_FUNC_LEQUAL = 2, // Drawn if the incoming depth value is less or equal to that in the depth buffer
+    RS_DEPTH_FUNC_GREATER = 3, // Drawn if the incoming depth value is greater than that in the depth buffer
+    RS_DEPTH_FUNC_GEQUAL = 4, // Drawn if the incoming depth value is greater or equal to that in the depth buffer
+    RS_DEPTH_FUNC_EQUAL = 5, // Drawn if the incoming depth value is equal to that in the depth buffer
+    RS_DEPTH_FUNC_NOTEQUAL = 6, // Drawn if the incoming depth value is not equal to that in the depth buffer
+    RS_DEPTH_FUNC_INVALID = 100 // Invalid depth function
 } rs_depth_func;
 #endif
 #endif
@@ -114,6 +121,8 @@
 /*
  * rs_primitive: How to intepret mesh vertex data
  *
+ * DEPRECATED.  Do not use.
+ *
  * Describes the way mesh vertex data is interpreted when rendering
  */
 #ifndef __LP64__
@@ -133,6 +142,8 @@
 /*
  * rs_font: Handle to a Font
  *
+ * DEPRECATED.  Do not use.
+ *
  * Opaque handle to a RenderScript font object.
  * See: android.renderscript.Font
  */
@@ -143,6 +154,8 @@
 /*
  * rs_mesh: Handle to a Mesh
  *
+ * DEPRECATED.  Do not use.
+ *
  * Opaque handle to a RenderScript mesh object.
  * See: android.renderscript.Mesh
  */
@@ -153,6 +166,8 @@
 /*
  * rs_program_fragment: Handle to a ProgramFragment
  *
+ * DEPRECATED.  Do not use.
+ *
  * Opaque handle to a RenderScript ProgramFragment object.
  * See: android.renderscript.ProgramFragment
  */
@@ -163,6 +178,8 @@
 /*
  * rs_program_vertex: Handle to a ProgramVertex
  *
+ * DEPRECATED.  Do not use.
+ *
  * Opaque handle to a RenderScript ProgramVertex object.
  * See: android.renderscript.ProgramVertex
  */
@@ -173,6 +190,8 @@
 /*
  * rs_program_raster: Handle to a ProgramRaster
  *
+ * DEPRECATED.  Do not use.
+ *
  * Opaque handle to a RenderScript ProgramRaster object.
  * See: android.renderscript.ProgramRaster
  */
@@ -183,6 +202,8 @@
 /*
  * rs_program_store: Handle to a ProgramStore
  *
+ * DEPRECATED.  Do not use.
+ *
  * Opaque handle to a RenderScript ProgramStore object.
  * See: android.renderscript.ProgramStore
  */
@@ -191,8 +212,14 @@
 #endif
 
 /*
- * rsClearObject: For internal use.
+ * rsClearObject: Release an object
  *
+ * Tells the run time that this handle will no longer be used to access the
+ * the related object.  If this was the last handle to that object, resource
+ * recovery may happen.
+ *
+ * After calling this function, *dst will be set to an empty handle.  See
+ * rsIsObject().
  */
 #ifndef __LP64__
 extern void __attribute__((overloadable))
@@ -225,8 +252,16 @@
 #endif
 
 /*
- * rsIsObject: For internal use.
+ * rsIsObject: Check for an empty handle
  *
+ * Returns true if the handle contains a non-null reference.
+ *
+ * This function does not validate that the internal pointer used in the handle
+ * points to an actual valid object; it only checks for null.
+ *
+ * This function can be used to check the element returned by
+ * rsElementGetSubElement() or see if rsClearObject() has been called on a
+ * handle.
  */
 #ifndef __LP64__
 extern bool __attribute__((overloadable))
@@ -293,6 +328,10 @@
 #endif
 
 /*
+ * rsgAllocationSyncAll: Sync the contents of an allocation
+ *
+ * DEPRECATED.  Do not use.
+ *
  * Sync the contents of an allocation.
  *
  * If the source is specified, sync from memory space specified by source.
@@ -313,6 +352,10 @@
 #endif
 
 /*
+ * rsgBindColorTarget: Set the color target
+ *
+ * DEPRECATED.  Do not use.
+ *
  * Set the color target used for all subsequent rendering calls
  */
 #ifndef __LP64__
@@ -323,14 +366,18 @@
 #endif
 
 /*
+ * rsgBindConstant: Bind a constant allocation
+ *
+ * DEPRECATED.  Do not use.
+ *
  * Bind a new Allocation object to a ProgramFragment or ProgramVertex.
  * The Allocation must be a valid constant input for the Program.
  *
  * Parameters:
- *   ps program fragment object
- *   slot index of the constant buffer on the program
- *   c constants to bind
- *   pv program vertex object
+ *   ps: program fragment object
+ *   slot: index of the constant buffer on the program
+ *   c: constants to bind
+ *   pv: program vertex object
  */
 #ifndef __LP64__
 extern void __attribute__((overloadable))
@@ -343,6 +390,10 @@
 #endif
 
 /*
+ * rsgBindDepthTarget: Set the depth target
+ *
+ * DEPRECATED.  Do not use.
+ *
  * Set the depth target used for all subsequent rendering calls
  */
 #ifndef __LP64__
@@ -353,10 +404,14 @@
 #endif
 
 /*
+ * rsgBindFont: Bind a font object
+ *
+ * DEPRECATED.  Do not use.
+ *
  * Binds the font object to be used for all subsequent font rendering calls
  *
  * Parameters:
- *   font object to bind
+ *   font: object to bind
  */
 #ifndef __LP64__
 extern void __attribute__((overloadable))
@@ -364,6 +419,10 @@
 #endif
 
 /*
+ * rsgBindProgramFragment: Bind a ProgramFragment
+ *
+ * DEPRECATED.  Do not use.
+ *
  * Bind a new ProgramFragment to the rendering context.
  */
 #ifndef __LP64__
@@ -372,6 +431,10 @@
 #endif
 
 /*
+ * rsgBindProgramRaster: Bind a ProgramRaster
+ *
+ * DEPRECATED.  Do not use.
+ *
  * Bind a new ProgramRaster to the rendering context.
  */
 #ifndef __LP64__
@@ -380,6 +443,10 @@
 #endif
 
 /*
+ * rsgBindProgramStore: Bind a ProgramStore
+ *
+ * DEPRECATED.  Do not use.
+ *
  * Bind a new ProgramStore to the rendering context.
  */
 #ifndef __LP64__
@@ -388,6 +455,10 @@
 #endif
 
 /*
+ * rsgBindProgramVertex: Bind a ProgramVertex
+ *
+ * DEPRECATED.  Do not use.
+ *
  * Bind a new ProgramVertex to the rendering context.
  */
 #ifndef __LP64__
@@ -396,6 +467,10 @@
 #endif
 
 /*
+ * rsgBindSampler: Bind a sampler
+ *
+ * DEPRECATED.  Do not use.
+ *
  * Bind a new Sampler object to a ProgramFragment.  The sampler will
  * operate on the texture bound at the matching slot.
  */
@@ -405,6 +480,10 @@
 #endif
 
 /*
+ * rsgBindTexture: Bind a texture allocation
+ *
+ * DEPRECATED.  Do not use.
+ *
  * Bind a new Allocation object to a ProgramFragment.  The
  * Allocation must be a valid texture for the Program.  The sampling
  * of the texture will be controled by the Sampler bound at the
@@ -416,6 +495,10 @@
 #endif
 
 /*
+ * rsgClearAllRenderTargets: Clear all color and depth targets
+ *
+ * DEPRECATED.  Do not use.
+ *
  * Clear all color and depth targets and resume rendering into
  * the framebuffer
  */
@@ -427,6 +510,10 @@
 #endif
 
 /*
+ * rsgClearColor: Clear the specified color from the surface
+ *
+ * DEPRECATED.  Do not use.
+ *
  * Clears the rendering surface to the specified color.
  */
 #ifndef __LP64__
@@ -435,6 +522,10 @@
 #endif
 
 /*
+ * rsgClearColorTarget: Clear the color target
+ *
+ * DEPRECATED.  Do not use.
+ *
  * Clear the previously set color target
  */
 #ifndef __LP64__
@@ -445,6 +536,10 @@
 #endif
 
 /*
+ * rsgClearDepth: Clear the depth surface
+ *
+ * DEPRECATED.  Do not use.
+ *
  * Clears the depth suface to the specified value.
  */
 #ifndef __LP64__
@@ -453,6 +548,10 @@
 #endif
 
 /*
+ * rsgClearDepthTarget: Clear the depth target
+ *
+ * DEPRECATED.  Do not use.
+ *
  * Clear the previously set depth target
  */
 #ifndef __LP64__
@@ -463,6 +562,10 @@
 #endif
 
 /*
+ * rsgDrawMesh: Draw a mesh
+ *
+ * DEPRECATED.  Do not use.
+ *
  * Draw a mesh using the current context state.
  *
  * If primitiveIndex is specified, draw part of a mesh using the current context state.
@@ -472,10 +575,10 @@
  * Otherwise the whole mesh is rendered.
  *
  * Parameters:
- *   ism mesh object to render
- *   primitiveIndex for meshes that contain multiple primitive groups this parameter specifies the index of the group to draw.
- *   start starting index in the range
- *   len number of indices to draw
+ *   ism: mesh object to render
+ *   primitiveIndex: for meshes that contain multiple primitive groups this parameter specifies the index of the group to draw.
+ *   start: starting index in the range
+ *   len: number of indices to draw
  */
 #ifndef __LP64__
 extern void __attribute__((overloadable))
@@ -493,6 +596,10 @@
 #endif
 
 /*
+ * rsgDrawQuad: Draw a quad
+ *
+ * DEPRECATED.  Do not use.
+ *
  * Low performance utility function for drawing a simple quad.  Not intended for
  * drawing large quantities of geometry.
  */
@@ -503,6 +610,10 @@
 #endif
 
 /*
+ * rsgDrawQuadTexCoords: Draw a textured quad
+ *
+ * DEPRECATED.  Do not use.
+ *
  * Low performance utility function for drawing a textured quad.  Not intended
  * for drawing large quantities of geometry.
  */
@@ -514,6 +625,10 @@
 #endif
 
 /*
+ * rsgDrawRect: Draw a rectangle
+ *
+ * DEPRECATED.  Do not use.
+ *
  * Low performance utility function for drawing a simple rectangle.  Not
  * intended for drawing large quantities of geometry.
  */
@@ -523,6 +638,10 @@
 #endif
 
 /*
+ * rsgDrawSpriteScreenspace: Draw rectangles in screenspace
+ *
+ * DEPRECATED.  Do not use.
+ *
  * Low performance function for drawing rectangles in screenspace.  This
  * function uses the default passthough ProgramVertex.  Any bound ProgramVertex
  * is ignored.  This function has considerable overhead and should not be used
@@ -534,6 +653,10 @@
 #endif
 
 /*
+ * rsgDrawText: Draw a text string
+ *
+ * DEPRECATED.  Do not use.
+ *
  * Draws text given a string and location
  */
 #ifndef __LP64__
@@ -547,6 +670,10 @@
 #endif
 
 /*
+ * rsgFinish: End rendering commands
+ *
+ * DEPRECATED.  Do not use.
+ *
  * Force RenderScript to finish all rendering commands
  */
 #ifndef __LP64__
@@ -557,13 +684,17 @@
 #endif
 
 /*
+ * rsgFontColor: Set the font color
+ *
+ * DEPRECATED.  Do not use.
+ *
  * Sets the font color for all subsequent rendering calls
  *
  * Parameters:
- *   r red component
- *   g green component
- *   b blue component
- *   a alpha component
+ *   r: red component
+ *   g: green component
+ *   b: blue component
+ *   a: alpha component
  */
 #ifndef __LP64__
 extern void __attribute__((overloadable))
@@ -571,6 +702,10 @@
 #endif
 
 /*
+ * rsgGetHeight: Get the surface height
+ *
+ * DEPRECATED.  Do not use.
+ *
  * Get the height of the current rendering surface.
  */
 #ifndef __LP64__
@@ -579,6 +714,10 @@
 #endif
 
 /*
+ * rsgGetWidth: Get the surface width
+ *
+ * DEPRECATED.  Do not use.
+ *
  * Get the width of the current rendering surface.
  */
 #ifndef __LP64__
@@ -587,6 +726,10 @@
 #endif
 
 /*
+ * rsgMeasureText: Get the bounding box for a text string
+ *
+ * DEPRECATED.  Do not use.
+ *
  * Returns the bounding box of the text relative to (0, 0)
  * Any of left, right, top, bottom could be NULL
  */
@@ -601,6 +744,10 @@
 #endif
 
 /*
+ * rsgMeshComputeBoundingBox: Compute a bounding box
+ *
+ * DEPRECATED.  Do not use.
+ *
  * Computes an axis aligned bounding box of a mesh object
  */
 #ifndef __LP64__
@@ -624,12 +771,16 @@
 #endif
 
 /*
+ * rsgMeshGetIndexAllocation: Return an allocation containing index data
+ *
+ * DEPRECATED.  Do not use.
+ *
  * Returns an allocation containing index data or a null
  * allocation if only the primitive is specified
  *
  * Parameters:
- *   m mesh to get data from
- *   index index of the index allocation
+ *   m: mesh to get data from
+ *   index: index of the index allocation
  *
  * Returns: allocation containing index data
  */
@@ -641,12 +792,16 @@
 #endif
 
 /*
+ * rsgMeshGetPrimitive: Return the primitive
+ *
+ * DEPRECATED.  Do not use.
+ *
  * Returns the primitive describing how a part of the mesh is
  * rendered
  *
  * Parameters:
- *   m mesh to get data from
- *   index index of the primitive
+ *   m: mesh to get data from
+ *   index: index of the primitive
  *
  * Returns: primitive describing how the mesh is rendered
  */
@@ -658,11 +813,15 @@
 #endif
 
 /*
+ * rsgMeshGetPrimitiveCount: Return the number of index sets
+ *
+ * DEPRECATED.  Do not use.
+ *
  * Meshes could have multiple index sets, this function returns
  * the number.
  *
  * Parameters:
- *   m mesh to get data from
+ *   m: mesh to get data from
  *
  * Returns: number of primitive groups in the mesh. This would include simple primitives as well as allocations containing index data
  */
@@ -674,12 +833,16 @@
 #endif
 
 /*
+ * rsgMeshGetVertexAllocation: Return a vertex allocation
+ *
+ * DEPRECATED.  Do not use.
+ *
  * Returns an allocation that is part of the mesh and contains
  * vertex data, e.g. positions, normals, texcoords
  *
  * Parameters:
- *   m mesh to get data from
- *   index index of the vertex allocation
+ *   m: mesh to get data from
+ *   index: index of the vertex allocation
  *
  * Returns: allocation containing vertex data
  */
@@ -691,11 +854,15 @@
 #endif
 
 /*
+ * rsgMeshGetVertexAllocationCount: Return the number of vertex allocations
+ *
+ * DEPRECATED.  Do not use.
+ *
  * Returns the number of allocations in the mesh that contain
  * vertex data
  *
  * Parameters:
- *   m mesh to get data from
+ *   m: mesh to get data from
  *
  * Returns: number of allocations in the mesh that contain vertex data
  */
@@ -707,6 +874,10 @@
 #endif
 
 /*
+ * rsgProgramFragmentConstantColor: Set the constant color for a fixed function emulation program
+ *
+ * DEPRECATED.  Do not use.
+ *
  * Set the constant color for a fixed function emulation program.
  */
 #ifndef __LP64__
@@ -715,12 +886,16 @@
 #endif
 
 /*
+ * rsgProgramVertexGetProjectionMatrix: Get the projection matrix for a fixed function vertex program
+ *
+ * DEPRECATED.  Do not use.
+ *
  * Get the projection matrix for a currently bound fixed function
  * vertex program. Calling this function with a custom vertex shader
  * would result in an error.
  *
  * Parameters:
- *   proj matrix to store the current projection matrix into
+ *   proj: matrix to store the current projection matrix into
  */
 #ifndef __LP64__
 extern void __attribute__((overloadable))
@@ -728,12 +903,16 @@
 #endif
 
 /*
+ * rsgProgramVertexLoadModelMatrix: Load the model matrix for a bound fixed function vertex program
+ *
+ * DEPRECATED.  Do not use.
+ *
  * Load the model matrix for a currently bound fixed function
  * vertex program. Calling this function with a custom vertex shader
  * would result in an error.
  *
  * Parameters:
- *   model model matrix
+ *   model: model matrix
  */
 #ifndef __LP64__
 extern void __attribute__((overloadable))
@@ -741,12 +920,16 @@
 #endif
 
 /*
+ * rsgProgramVertexLoadProjectionMatrix: Load the projection matrix for a bound fixed function vertex program
+ *
+ * DEPRECATED.  Do not use.
+ *
  * Load the projection matrix for a currently bound fixed function
  * vertex program. Calling this function with a custom vertex shader
  * would result in an error.
  *
  * Parameters:
- *   proj projection matrix
+ *   proj: projection matrix
  */
 #ifndef __LP64__
 extern void __attribute__((overloadable))
@@ -754,12 +937,16 @@
 #endif
 
 /*
+ * rsgProgramVertexLoadTextureMatrix: Load the texture matrix for a bound fixed function vertex program
+ *
+ * DEPRECATED.  Do not use.
+ *
  * Load the texture matrix for a currently bound fixed function
  * vertex program. Calling this function with a custom vertex shader
  * would result in an error.
  *
  * Parameters:
- *   tex texture matrix
+ *   tex: texture matrix
  */
 #ifndef __LP64__
 extern void __attribute__((overloadable))
@@ -767,10 +954,14 @@
 #endif
 
 /*
+ * rsgProgramRasterGetCullMode: Get program raster cull mode
+ *
+ * DEPRECATED.  Do not use.
+ *
  * Get program raster cull mode
  *
  * Parameters:
- *   pr program raster to query
+ *   pr: program raster to query
  */
 #ifndef __LP64__
 #if (defined(RS_VERSION) && (RS_VERSION >= 16))
@@ -780,10 +971,14 @@
 #endif
 
 /*
+ * rsgProgramRasterIsPointSpriteEnabled: Get program raster point sprite state
+ *
+ * DEPRECATED.  Do not use.
+ *
  * Get program raster point sprite state
  *
  * Parameters:
- *   pr program raster to query
+ *   pr: program raster to query
  */
 #ifndef __LP64__
 #if (defined(RS_VERSION) && (RS_VERSION >= 16))
@@ -793,10 +988,14 @@
 #endif
 
 /*
+ * rsgProgramStoreGetBlendDstFunc: Get program store blend destination function
+ *
+ * DEPRECATED.  Do not use.
+ *
  * Get program store blend destination function
  *
  * Parameters:
- *   ps program store to query
+ *   ps: program store to query
  */
 #ifndef __LP64__
 #if (defined(RS_VERSION) && (RS_VERSION >= 16))
@@ -806,10 +1005,14 @@
 #endif
 
 /*
+ * rsgProgramStoreGetBlendSrcFunc: Get program store blend source function
+ *
+ * DEPRECATED.  Do not use.
+ *
  * Get program store blend source function
  *
  * Parameters:
- *   ps program store to query
+ *   ps: program store to query
  */
 #ifndef __LP64__
 #if (defined(RS_VERSION) && (RS_VERSION >= 16))
@@ -819,10 +1022,14 @@
 #endif
 
 /*
+ * rsgProgramStoreGetDepthFunc: Get program store depth function
+ *
+ * DEPRECATED.  Do not use.
+ *
  * Get program store depth function
  *
  * Parameters:
- *   ps program store to query
+ *   ps: program store to query
  */
 #ifndef __LP64__
 #if (defined(RS_VERSION) && (RS_VERSION >= 16))
@@ -832,10 +1039,14 @@
 #endif
 
 /*
+ * rsgProgramStoreIsColorMaskAlphaEnabled: Get program store alpha component color mask
+ *
+ * DEPRECATED.  Do not use.
+ *
  * Get program store alpha component color mask
  *
  * Parameters:
- *   ps program store to query
+ *   ps: program store to query
  */
 #ifndef __LP64__
 #if (defined(RS_VERSION) && (RS_VERSION >= 16))
@@ -845,10 +1056,14 @@
 #endif
 
 /*
+ * rsgProgramStoreIsColorMaskBlueEnabled: Get program store blur component color mask
+ *
+ * DEPRECATED.  Do not use.
+ *
  * Get program store blur component color mask
  *
  * Parameters:
- *   ps program store to query
+ *   ps: program store to query
  */
 #ifndef __LP64__
 #if (defined(RS_VERSION) && (RS_VERSION >= 16))
@@ -858,10 +1073,14 @@
 #endif
 
 /*
+ * rsgProgramStoreIsColorMaskGreenEnabled: Get program store green component color mask
+ *
+ * DEPRECATED.  Do not use.
+ *
  * Get program store green component color mask
  *
  * Parameters:
- *   ps program store to query
+ *   ps: program store to query
  */
 #ifndef __LP64__
 #if (defined(RS_VERSION) && (RS_VERSION >= 16))
@@ -871,10 +1090,14 @@
 #endif
 
 /*
+ * rsgProgramStoreIsColorMaskRedEnabled: Get program store red component color mask
+ *
+ * DEPRECATED.  Do not use.
+ *
  * Get program store red component color mask
  *
  * Parameters:
- *   ps program store to query
+ *   ps: program store to query
  */
 #ifndef __LP64__
 #if (defined(RS_VERSION) && (RS_VERSION >= 16))
@@ -884,10 +1107,14 @@
 #endif
 
 /*
+ * rsgProgramStoreIsDepthMaskEnabled: Get program store depth mask
+ *
+ * DEPRECATED.  Do not use.
+ *
  * Get program store depth mask
  *
  * Parameters:
- *   ps program store to query
+ *   ps: program store to query
  */
 #ifndef __LP64__
 #if (defined(RS_VERSION) && (RS_VERSION >= 16))
@@ -897,10 +1124,14 @@
 #endif
 
 /*
+ * rsgProgramStoreIsDitherEnabled: Get program store dither state
+ *
+ * DEPRECATED.  Do not use.
+ *
  * Get program store dither state
  *
  * Parameters:
- *   ps program store to query
+ *   ps: program store to query
  */
 #ifndef __LP64__
 #if (defined(RS_VERSION) && (RS_VERSION >= 16))
diff --git a/renderscript/include/rs_io.rsh b/renderscript/include/rs_io.rsh
index d523f29..d14af11 100644
--- a/renderscript/include/rs_io.rsh
+++ b/renderscript/include/rs_io.rsh
@@ -14,13 +14,16 @@
  * limitations under the License.
  */
 
-// Don't edit this file!  It is auto-generated by frameworks/rs/api/gen_runtime.
+// Don't edit this file!  It is auto-generated by frameworks/rs/api/generate.sh.
 
 /*
- * rs_io.rsh: Input/output functions
+ * rs_io.rsh: Input/Output Functions
  *
- * TODO Add documentation
+ * These functions are used to:
+ * - Send information to the Java client, and
+ * - Send the processed allocation or receive the next allocation to process.
  */
+
 #ifndef RENDERSCRIPT_RS_IO_RSH
 #define RENDERSCRIPT_RS_IO_RSH
 
@@ -30,7 +33,7 @@
  * Receive a new set of contents from the queue.
  *
  * Parameters:
- *   a allocation to work on
+ *   a: Allocation to work on.
  */
 #if (defined(RS_VERSION) && (RS_VERSION >= 16))
 extern void __attribute__((overloadable))
@@ -43,7 +46,7 @@
  * Send the contents of the Allocation to the queue.
  *
  * Parameters:
- *   a allocation to work on
+ *   a: Allocation to work on.
  */
 #if (defined(RS_VERSION) && (RS_VERSION >= 16))
 extern void __attribute__((overloadable))
@@ -51,9 +54,19 @@
 #endif
 
 /*
- * Send a message back to the client.  Will not block and returns true
- * if the message was sendable and false if the fifo was full.
- * A message ID is required.  Data payload is optional.
+ * rsSendToClient: Send a message to the client, non-blocking
+ *
+ * Sends a message back to the client.  This call does not block.
+ * It returns true if the message was sent and false if the
+ * message queue is full.
+ *
+ * A message ID is required.  The data payload is optional.
+ *
+ * See RenderScript.RSMessageHandler.
+ *
+ * Parameters:
+ *   data: Application specific data.
+ *   len: Length of the data, in bytes.
  */
 extern bool __attribute__((overloadable))
     rsSendToClient(int cmdID);
@@ -62,8 +75,20 @@
     rsSendToClient(int cmdID, const void* data, uint len);
 
 /*
- * Send a message back to the client, blocking until the message is queued.
- * A message ID is required.  Data payload is optional.
+ * rsSendToClientBlocking: Send a message to the client, blocking
+ *
+ * Sends a message back to the client.  This function will block
+ * until there is room on the message queue for this message.
+ * This function may return before the message was delivered and
+ * processed by the client.
+ *
+ * A message ID is required.  The data payload is optional.
+ *
+ * See RenderScript.RSMessageHandler.
+ *
+ * Parameters:
+ *   data: Application specific data.
+ *   len: Length of the data, in bytes.
  */
 extern void __attribute__((overloadable))
     rsSendToClientBlocking(int cmdID);
diff --git a/renderscript/include/rs_math.rsh b/renderscript/include/rs_math.rsh
index b812f07..0f094f6 100644
--- a/renderscript/include/rs_math.rsh
+++ b/renderscript/include/rs_math.rsh
@@ -14,12 +14,12 @@
  * limitations under the License.
  */
 
-// Don't edit this file!  It is auto-generated by frameworks/rs/api/gen_runtime.
+// Don't edit this file!  It is auto-generated by frameworks/rs/api/generate.sh.
 
 /*
- * rs_math.rsh: Mathematical functions
+ * rs_math.rsh: Mathematical Constants and Functions
  *
- * Most mathematical functions can be applied to scalars and vectors.
+ * The mathematical functions below can be applied to scalars and vectors.
  * When applied to vectors, a vector of the function applied to each entry
  * of the input is returned.
  *
@@ -33,19 +33,20 @@
  * a = sin(b);
  *
  *
- * A few functions like distance() and length() interpret instead the input
- * as a single vector in n-dimensional space.
+ * See "Vector math functions" for functions like distance() and length()
+ * that interpret instead the input as a single vector in n-dimensional space.
  *
  * The precision of the mathematical operations is affected by the pragmas
  * rs_fp_relaxed and rs_fp_full.
  *
  * Different precision/speed tradeoffs can be achieved by using three variants
  * of common math functions.  Functions with a name starting with
- * native_ may have custom hardware implementations with weaker precision,
- * half_ may perform internal computations using 16 bit floats, and
- * fast_ are n-dimensional space computations that may use 16 bit floats.
+ * - native_ may have custom hardware implementations with weaker precision,
+ * - half_ may perform internal computations using 16 bit floats, and
+ * - fast_ are n-dimensional space computations that may use 16 bit floats.
  *
  */
+
 #ifndef RENDERSCRIPT_RS_MATH_RSH
 #define RENDERSCRIPT_RS_MATH_RSH
 
@@ -64,8 +65,11 @@
 #define M_2_PI 0.636619772367581343075535053490057448f
 
 /*
- * M_2_PIl: Deprecated.  Use M_2_PI instead.
+ * M_2_PIl: 2 / pi, as a 32 bit float
  *
+ * DEPRECATED.  Do not use.
+ *
+ * 2 divided by pi, as a 32 bit float.
  */
 #define M_2_PIl 0.636619772367581343075535053490057448f
 
@@ -334,8 +338,8 @@
  * See also native_atan2().
  *
  * Parameters:
- *   numerator The numerator
- *   denominator The denominator.  Can be 0.
+ *   numerator: The numerator
+ *   denominator: The denominator.  Can be 0.
  */
 extern float __attribute__((const, overloadable))
     atan2(float numerator, float denominator);
@@ -359,8 +363,8 @@
  * See also native_atan2pi().
  *
  * Parameters:
- *   numerator The numerator
- *   denominator The denominator.  Can be 0.
+ *   numerator: The numerator
+ *   denominator: The denominator.  Can be 0.
  */
 extern float __attribute__((const, overloadable))
     atan2pi(float numerator, float denominator);
@@ -466,9 +470,9 @@
  * If min_value is greater than max_value, the results are undefined.
  *
  * Parameters:
- *   value Value to be clamped.
- *   min_value Lower bound, a scalar or matching vector.
- *   max_value High bound, must match the type of low.
+ *   value: Value to be clamped.
+ *   min_value: Lower bound, a scalar or matching vector.
+ *   max_value: High bound, must match the type of low.
  */
 extern float __attribute__((const, overloadable))
     clamp(float value, float min_value, float max_value);
@@ -1224,8 +1228,8 @@
  * fract(-1.3f, &val) returns 0.7f and sets val to -2.f.
  *
  * Parameters:
- *   v Input value.
- *   floor If floor is not null, *floor will be set to the floor of v.
+ *   v: Input value.
+ *   floor: If floor is not null, *floor will be set to the floor of v.
  */
 extern float __attribute__((overloadable))
     fract(float v, float* floor);
@@ -1273,8 +1277,8 @@
  * See ldexp() for the reverse operation.  See also logb() and ilogb().
  *
  * Parameters:
- *   v Input value.
- *   exponent If exponent is not null, *exponent will be set to the exponent of v.
+ *   v: Input value.
+ *   exponent: If exponent is not null, *exponent will be set to the exponent of v.
  */
 extern float __attribute__((overloadable))
     frexp(float v, int* exponent);
@@ -1428,8 +1432,8 @@
  * See frexp() for the reverse operation.
  *
  * Parameters:
- *   mantissa The mantissa
- *   exponent The exponent, a single component or matching vector.
+ *   mantissa: The mantissa
+ *   exponent: The exponent, a single component or matching vector.
  */
 extern float __attribute__((const, overloadable))
     ldexp(float mantissa, int exponent);
@@ -1461,7 +1465,7 @@
  * See also tgamma().
  *
  * Parameters:
- *   sign_of_gamma If sign_of_gamma is not null, *sign_of_gamma will be set to -1.f if the gamma of v is negative, otherwise to 1.f.
+ *   sign_of_gamma: If sign_of_gamma is not null, *sign_of_gamma will be set to -1.f if the gamma of v is negative, otherwise to 1.f.
  */
 extern float __attribute__((const, overloadable))
     lgamma(float v);
@@ -2480,8 +2484,8 @@
  * Both components will have the same sign as x.  For example, for an input of -3.72f, iret will be set to -3.f and .72f will be returned.
  *
  * Parameters:
- *   v Source value
- *   integral_part *integral_part will be set to the integral portion of the number.
+ *   v: Source value
+ *   integral_part: *integral_part will be set to the integral portion of the number.
  *
  * Returns: The floating point portion of the value.
  */
@@ -2503,7 +2507,7 @@
  * Returns a NaN value (Not a Number).
  *
  * Parameters:
- *   v Not used.
+ *   v: Not used.
  */
 extern float __attribute__((const, overloadable))
     nan(uint v);
@@ -2721,8 +2725,8 @@
  * See also atan2().
  *
  * Parameters:
- *   numerator The numerator
- *   denominator The denominator.  Can be 0.
+ *   numerator: The numerator
+ *   denominator: The denominator.  Can be 0.
  */
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
 extern float __attribute__((const, overloadable))
@@ -2754,8 +2758,8 @@
  * See also atan2pi().
  *
  * Parameters:
- *   numerator The numerator
- *   denominator The denominator.  Can be 0.
+ *   numerator: The numerator
+ *   denominator: The denominator.  Can be 0.
  */
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
 extern float __attribute__((const, overloadable))
@@ -3231,8 +3235,8 @@
  * See also powr().
  *
  * Parameters:
- *   base Must be between 0.f and 256.f.  The function is not accurate for values very close to zero.
- *   exponent Must be between -15.f and 15.f.
+ *   base: Must be between 0.f and 256.f.  The function is not accurate for values very close to zero.
+ *   exponent: Must be between -15.f and 15.f.
  */
 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
 extern float __attribute__((const, overloadable))
@@ -3370,8 +3374,8 @@
  * See also sincos().
  *
  * Parameters:
- *   v The incoming value in radians.
- *   cos *cos will be set to the cosine value.
+ *   v: The incoming value in radians.
+ *   cos: *cos will be set to the cosine value.
  *
  * Returns: sine
  */
@@ -3689,9 +3693,9 @@
  * Example: remquo(-23.5f, 8.f, &quot) sets the lowest three bits of quot to 3 and the sign negative.  It returns 0.5f.
  *
  * Parameters:
- *   numerator The numerator.
- *   denominator The denominator.
- *   quotient *quotient will be set to the integer quotient.
+ *   numerator: The numerator.
+ *   denominator: The denominator.
+ *   quotient: *quotient will be set to the integer quotient.
  *
  * Returns: The remainder, precise only for the low three bits.
  */
@@ -3835,8 +3839,8 @@
  * See also native_sincos().
  *
  * Parameters:
- *   v The incoming value in radians
- *   cos *cos will be set to the cosine value.
+ *   v: The incoming value in radians
+ *   cos: *cos will be set to the cosine value.
  *
  * Returns: sine of v
  */
@@ -4056,14 +4060,14 @@
 /*
  * rsClamp: Restrain a value to a range
  *
+ * DEPRECATED.  Do not use.
+ *
  * Clamp a value between low and high.
  *
- * Deprecated.  Use clamp() instead.
- *
  * Parameters:
- *   amount The value to clamp
- *   low Lower bound
- *   high Upper bound
+ *   amount: The value to clamp
+ *   low: Lower bound
+ *   high: Upper bound
  */
 extern char __attribute__((const, always_inline, overloadable))
     rsClamp(char amount, char low, char high);
@@ -4084,12 +4088,18 @@
     rsClamp(uint amount, uint low, uint high);
 
 /*
+ * rsFrac: Returns the fractional part of a float
+ *
+ * DEPRECATED.  Do not use.
+ *
  * Returns the fractional part of a float
  */
 extern float __attribute__((const, overloadable))
     rsFrac(float v);
 
 /*
+ * rsRand: Pseudo-random number
+ *
  * Return a random value between 0 (or min_value) and max_malue.
  */
 extern int __attribute__((overloadable))
diff --git a/renderscript/include/rs_matrix.rsh b/renderscript/include/rs_matrix.rsh
index 32496db..bb7c6e8 100644
--- a/renderscript/include/rs_matrix.rsh
+++ b/renderscript/include/rs_matrix.rsh
@@ -14,10 +14,10 @@
  * limitations under the License.
  */
 
-// Don't edit this file!  It is auto-generated by frameworks/rs/api/gen_runtime.
+// Don't edit this file!  It is auto-generated by frameworks/rs/api/generate.sh.
 
 /*
- * rs_matrix.rsh: Matrix functions
+ * rs_matrix.rsh: Matrix Functions
  *
  * These functions let you manipulate square matrices of rank 2x2, 3x3, and 4x4.
  * They are particularly useful for graphical transformations and are
@@ -44,22 +44,25 @@
  * on a matrix that already does a scaling, the resulting matrix when applied
  * to a vector will first do the translation then the scaling.
  */
+
 #ifndef RENDERSCRIPT_RS_MATRIX_RSH
 #define RENDERSCRIPT_RS_MATRIX_RSH
 
 #include "rs_vector_math.rsh"
 
 /*
+ * rsExtractFrustumPlanes: Compute frustum planes
+ *
  * Computes 6 frustum planes from the view projection matrix
  *
  * Parameters:
- *   viewProj matrix to extract planes from
- *   left left plane
- *   right right plane
- *   top top plane
- *   bottom bottom plane
- *   near near plane
- *   far far plane
+ *   viewProj: matrix to extract planes from
+ *   left: left plane
+ *   right: right plane
+ *   top: top plane
+ *   bottom: bottom plane
+ *   near: near plane
+ *   far: far plane
  */
 static inline void __attribute__((always_inline, overloadable))
     rsExtractFrustumPlanes(const rs_matrix4x4* viewProj, float4* left, float4* right, float4* top,
@@ -110,16 +113,18 @@
 }
 
 /*
- * Checks if a sphere is withing the 6 frustum planes
+ * rsIsSphereInFrustum: Checks if a sphere is within the frustum planes
+ *
+ * Returns true if the sphere is within the 6 frustum planes.
  *
  * Parameters:
- *   sphere float4 representing the sphere
- *   left left plane
- *   right right plane
- *   top top plane
- *   bottom bottom plane
- *   near near plane
- *   far far plane
+ *   sphere: float4 representing the sphere
+ *   left: left plane
+ *   right: right plane
+ *   top: top plane
+ *   bottom: bottom plane
+ *   near: near plane
+ *   far: far plane
  */
 static inline bool __attribute__((always_inline, overloadable))
     rsIsSphereInFrustum(float4* sphere, float4* left, float4* right, float4* top, float4* bottom,
@@ -159,9 +164,9 @@
  * Warning: The order of the column and row parameters may be unexpected.
  *
  * Parameters:
- *   m The matrix to extract the element from.
- *   col The zero-based column of the element to be extracted.
- *   row The zero-based row of the element to extracted.
+ *   m: The matrix to extract the element from.
+ *   col: The zero-based column of the element to be extracted.
+ *   row: The zero-based row of the element to extracted.
  */
 extern float __attribute__((overloadable))
     rsMatrixGet(const rs_matrix4x4* m, uint32_t col, uint32_t row);
@@ -178,7 +183,7 @@
  * Returns true if the matrix was successfully inverted.
  *
  * Parameters:
- *   m The matrix to invert.
+ *   m: The matrix to invert.
  */
 extern bool __attribute__((overloadable))
     rsMatrixInverse(rs_matrix4x4* m);
@@ -190,7 +195,7 @@
  * Returns true if the matrix was successfully inverted.
  *
  * Parameters:
- *   m The matrix to modify.
+ *   m: The matrix to modify.
  */
 extern bool __attribute__((overloadable))
     rsMatrixInverseTranspose(rs_matrix4x4* m);
@@ -215,9 +220,9 @@
  *
  *
  * Parameters:
- *   destination The matrix to set.
- *   array The array of values to set the matrix to. These arrays should be 4, 9, or 16 floats long, depending on the matrix size.
- *   source The source matrix.
+ *   destination: The matrix to set.
+ *   array: The array of values to set the matrix to. These arrays should be 4, 9, or 16 floats long, depending on the matrix size.
+ *   source: The source matrix.
  */
 extern void __attribute__((overloadable))
     rsMatrixLoad(rs_matrix4x4* destination, const float* array);
@@ -254,7 +259,7 @@
  * created matrix using rsMatrixMultiply().
  *
  * Parameters:
- *   m The matrix to set.
+ *   m: The matrix to set.
  */
 extern void __attribute__((overloadable))
     rsMatrixLoadFrustum(rs_matrix4x4* m, float left, float right, float bottom, float top,
@@ -266,7 +271,7 @@
  * Set the elements of a matrix to the identity matrix.
  *
  * Parameters:
- *   m The matrix to set.
+ *   m: The matrix to set.
  */
 extern void __attribute__((overloadable))
     rsMatrixLoadIdentity(rs_matrix4x4* m);
@@ -293,9 +298,9 @@
  * rsMatrixLoadMultiply (&m2l, &m2r, &m2l) works as expected.
  *
  * Parameters:
- *   m The matrix to set.
- *   lhs The left matrix of the product.
- *   rhs The right matrix of the product.
+ *   m: The matrix to set.
+ *   lhs: The left matrix of the product.
+ *   rhs: The right matrix of the product.
  */
 extern void __attribute__((overloadable))
     rsMatrixLoadMultiply(rs_matrix4x4* m, const rs_matrix4x4* lhs, const rs_matrix4x4* rhs);
@@ -320,7 +325,7 @@
  * See https://en.wikipedia.org/wiki/Orthographic_projection .
  *
  * Parameters:
- *   m The matrix to set.
+ *   m: The matrix to set.
  */
 extern void __attribute__((overloadable))
     rsMatrixLoadOrtho(rs_matrix4x4* m, float left, float right, float bottom, float top, float near,
@@ -335,11 +340,11 @@
  * created matrix using rsMatrixMultiply().
  *
  * Parameters:
- *   m The matrix to set.
- *   fovy Field of view, in degrees along the Y axis.
- *   aspect Ratio of x / y.
- *   near The near clipping plane.
- *   far The far clipping plane.
+ *   m: The matrix to set.
+ *   fovy: Field of view, in degrees along the Y axis.
+ *   aspect: Ratio of x / y.
+ *   near: The near clipping plane.
+ *   far: The far clipping plane.
  */
 extern void __attribute__((overloadable))
     rsMatrixLoadPerspective(rs_matrix4x4* m, float fovy, float aspect, float near, float far);
@@ -356,11 +361,11 @@
  * See http://en.wikipedia.org/wiki/Rotation_matrix .
  *
  * Parameters:
- *   m The matrix to set.
- *   rot How much rotation to do, in degrees.
- *   x The x component of the vector that is the axis of rotation.
- *   y The y component of the vector that is the axis of rotation.
- *   z The z component of the vector that is the axis of rotation.
+ *   m: The matrix to set.
+ *   rot: How much rotation to do, in degrees.
+ *   x: The x component of the vector that is the axis of rotation.
+ *   y: The y component of the vector that is the axis of rotation.
+ *   z: The z component of the vector that is the axis of rotation.
  */
 extern void __attribute__((overloadable))
     rsMatrixLoadRotate(rs_matrix4x4* m, float rot, float x, float y, float z);
@@ -375,10 +380,10 @@
  * using rsMatrixMultiply().
  *
  * Parameters:
- *   m The matrix to set.
- *   x The multiple to scale the x components by.
- *   y The multiple to scale the y components by.
- *   z The multiple to scale the z components by.
+ *   m: The matrix to set.
+ *   x: The multiple to scale the x components by.
+ *   y: The multiple to scale the y components by.
+ *   z: The multiple to scale the z components by.
  */
 extern void __attribute__((overloadable))
     rsMatrixLoadScale(rs_matrix4x4* m, float x, float y, float z);
@@ -393,10 +398,10 @@
  * using rsMatrixMultiply().
  *
  * Parameters:
- *   m The matrix to set.
- *   x The number to add to each x component.
- *   y The number to add to each y component.
- *   z The number to add to each z component.
+ *   m: The matrix to set.
+ *   x: The number to add to each x component.
+ *   y: The number to add to each y component.
+ *   z: The number to add to each z component.
  */
 extern void __attribute__((overloadable))
     rsMatrixLoadTranslate(rs_matrix4x4* m, float x, float y, float z);
@@ -422,8 +427,8 @@
  * Starting with API 14, this function takes a const matrix as the first argument.
  *
  * Parameters:
- *   m The left matrix of the product and the matrix to be set.
- *   rhs The right matrix of the product.
+ *   m: The left matrix of the product and the matrix to be set.
+ *   rhs: The right matrix of the product.
  */
 extern void __attribute__((overloadable))
     rsMatrixMultiply(rs_matrix4x4* m, const rs_matrix4x4* rhs);
@@ -506,11 +511,11 @@
  * the vector by the created matrix using rsMatrixMultiply().
  *
  * Parameters:
- *   m The matrix to modify.
- *   rot How much rotation to do, in degrees.
- *   x The x component of the vector that is the axis of rotation.
- *   y The y component of the vector that is the axis of rotation.
- *   z The z component of the vector that is the axis of rotation.
+ *   m: The matrix to modify.
+ *   rot: How much rotation to do, in degrees.
+ *   x: The x component of the vector that is the axis of rotation.
+ *   y: The y component of the vector that is the axis of rotation.
+ *   z: The z component of the vector that is the axis of rotation.
  */
 extern void __attribute__((overloadable))
     rsMatrixRotate(rs_matrix4x4* m, float rot, float x, float y, float z);
@@ -528,10 +533,10 @@
  * the vector by the created matrix using rsMatrixMultiply().
  *
  * Parameters:
- *   m The matrix to modify.
- *   x The multiple to scale the x components by.
- *   y The multiple to scale the y components by.
- *   z The multiple to scale the z components by.
+ *   m: The matrix to modify.
+ *   x: The multiple to scale the x components by.
+ *   y: The multiple to scale the y components by.
+ *   z: The multiple to scale the z components by.
  */
 extern void __attribute__((overloadable))
     rsMatrixScale(rs_matrix4x4* m, float x, float y, float z);
@@ -544,10 +549,10 @@
  * Warning: The order of the column and row parameters may be unexpected.
  *
  * Parameters:
- *   m The matrix that will be modified.
- *   col The zero-based column of the element to be set.
- *   row The zero-based row of the element to be set.
- *   v The value to set.
+ *   m: The matrix that will be modified.
+ *   col: The zero-based column of the element to be set.
+ *   row: The zero-based row of the element to be set.
+ *   v: The value to set.
  */
 extern void __attribute__((overloadable))
     rsMatrixSet(rs_matrix4x4* m, uint32_t col, uint32_t row, float v);
@@ -571,10 +576,10 @@
  * the vector by the created matrix using rsMatrixMultiply().
  *
  * Parameters:
- *   m The matrix to modify.
- *   x The number to add to each x component.
- *   y The number to add to each y component.
- *   z The number to add to each z component.
+ *   m: The matrix to modify.
+ *   x: The number to add to each x component.
+ *   y: The number to add to each y component.
+ *   z: The number to add to each z component.
  */
 extern void __attribute__((overloadable))
     rsMatrixTranslate(rs_matrix4x4* m, float x, float y, float z);
@@ -585,7 +590,7 @@
  * Transpose the matrix m in place.
  *
  * Parameters:
- *   m The matrix to transpose.
+ *   m: The matrix to transpose.
  */
 extern void __attribute__((overloadable))
     rsMatrixTranspose(rs_matrix4x4* m);
diff --git a/renderscript/include/rs_object_info.rsh b/renderscript/include/rs_object_info.rsh
index 25ac326..6ea7ed6 100644
--- a/renderscript/include/rs_object_info.rsh
+++ b/renderscript/include/rs_object_info.rsh
@@ -14,18 +14,19 @@
  * limitations under the License.
  */
 
-// Don't edit this file!  It is auto-generated by frameworks/rs/api/gen_runtime.
+// Don't edit this file!  It is auto-generated by frameworks/rs/api/generate.sh.
 
 /*
- * rs_object_info.rsh: Element functions
+ * rs_object_info.rsh: Object Characteristics Functions
+ *
+ * The functions below can be used to query the characteristics of an allocation,
+ * element, or sampler object.  These objects are created from Java.
  *
  * The term "element" is used a bit ambiguously in RenderScript, as both
  * the type of an item of an allocation and the instantiation of that type:
- *
- * rs_element is a handle to a type specification, and
- *
- * In functions like rsGetElementAt(), "element" means the instantiation
- * of the type, i.e. an item of an allocation.
+ * - rs_element is a handle to a type specification, and
+ * - In functions like rsGetElementAt(), "element" means the instantiation
+ *     of the type, i.e. an item of an allocation.
  *
  * The functions below let you query the characteristics of the type specificiation.
  *
@@ -39,14 +40,17 @@
  * Elements can also have a kind, which is semantic information used mostly to
  * interpret pixel data.
  */
+
 #ifndef RENDERSCRIPT_RS_OBJECT_INFO_RSH
 #define RENDERSCRIPT_RS_OBJECT_INFO_RSH
 
 /*
  * rsAllocationGetDimFaces: Presence of more than one face
  *
- * If the allocation is a cubemap, this function returns 1 if there's more than one
- * face present.  In all other cases, it returns 0.
+ * If the allocation is a cubemap, this function returns 1 if there's more than
+ * one face present.  In all other cases, it returns 0.
+ *
+ * Use rsGetDimHasFaces() to get the dimension of a currently running kernel.
  *
  * Returns: Returns 1 if more than one face is present, 0 otherwise.
  */
@@ -54,9 +58,12 @@
     rsAllocationGetDimFaces(rs_allocation a);
 
 /*
- * rsAllocationGetDimLOD: Presence of levels of details
+ * rsAllocationGetDimLOD: Presence of levels of detail
  *
- * Query an allocation for the presence of more than one Level Of Details.  This is useful for mipmaps.
+ * Query an allocation for the presence of more than one Level Of Detail.
+ * This is useful for mipmaps.
+ *
+ * Use rsGetDimLod() to get the dimension of a currently running kernel.
  *
  * Returns: Returns 1 if more than one LOD is present, 0 otherwise.
  */
@@ -68,6 +75,8 @@
  *
  * Returns the size of the X dimension of the allocation.
  *
+ * Use rsGetDimX() to get the dimension of a currently running kernel.
+ *
  * Returns: The X dimension of the allocation.
  */
 extern uint32_t __attribute__((overloadable))
@@ -79,6 +88,8 @@
  * Returns the size of the Y dimension of the allocation.
  * If the allocation has less than two dimensions, returns 0.
  *
+ * Use rsGetDimY() to get the dimension of a currently running kernel.
+ *
  * Returns: The Y dimension of the allocation.
  */
 extern uint32_t __attribute__((overloadable))
@@ -90,6 +101,8 @@
  * Returns the size of the Z dimension of the allocation.
  * If the allocation has less than three dimensions, returns 0.
  *
+ * Use rsGetDimZ() to get the dimension of a currently running kernel.
+ *
  * Returns: The Z dimension of the allocation.
  */
 extern uint32_t __attribute__((overloadable))
@@ -99,7 +112,7 @@
  * Get the element object describing the allocation's layout
  *
  * Parameters:
- *   a allocation to get data from
+ *   a: allocation to get data from
  *
  * Returns: element describing allocation layout
  */
@@ -107,8 +120,14 @@
     rsAllocationGetElement(rs_allocation a);
 
 /*
- * rsClearObject: For internal use.
+ * rsClearObject: Release an object
  *
+ * Tells the run time that this handle will no longer be used to access the
+ * the related object.  If this was the last handle to that object, resource
+ * recovery may happen.
+ *
+ * After calling this function, *dst will be set to an empty handle.  See
+ * rsIsObject().
  */
 extern void __attribute__((overloadable))
     rsClearObject(rs_element* dst);
@@ -126,8 +145,16 @@
     rsClearObject(rs_script* dst);
 
 /*
- * rsIsObject: For internal use.
+ * rsIsObject: Check for an empty handle
  *
+ * Returns true if the handle contains a non-null reference.
+ *
+ * This function does not validate that the internal pointer used in the handle
+ * points to an actual valid object; it only checks for null.
+ *
+ * This function can be used to check the element returned by
+ * rsElementGetSubElement() or see if rsClearObject() has been called on a
+ * handle.
  */
 extern bool __attribute__((overloadable))
     rsIsObject(rs_element v);
@@ -194,8 +221,8 @@
  * of sub-elements, an invalid handle is returned.
  *
  * Parameters:
- *   e Element to query
- *   index Index of the sub-element to return
+ *   e: Element to query
+ *   index: Index of the sub-element to return
  *
  * Returns: Sub-element at the given index
  */
@@ -212,8 +239,8 @@
  * sub-element at the index.
  *
  * Parameters:
- *   e Element to query
- *   index Index of the sub-element
+ *   e: Element to query
+ *   index: Index of the sub-element
  *
  * Returns: Array size of the sub-element at the given index
  */
@@ -231,7 +258,7 @@
  * elements or the number of sub-elements otherwise.
  *
  * Parameters:
- *   e Element to get data from
+ *   e: Element to get data from
  *
  * Returns: Number of sub-elements in this element
  */
@@ -247,10 +274,10 @@
  * at the specified index.
  *
  * Parameters:
- *   e Element to get data from
- *   index Index of the sub-element
- *   name Array to store the name into
- *   nameLength Length of the provided name array
+ *   e: Element to get data from
+ *   index: Index of the sub-element
+ *   name: Array to store the name into
+ *   nameLength: Length of the provided name array
  *
  * Returns: Number of characters actually written, excluding the null terminator
  */
@@ -266,8 +293,8 @@
  * sub-element name at index
  *
  * Parameters:
- *   e Element to get data from
- *   index Index of the sub-element to return
+ *   e: Element to get data from
+ *   index: Index of the sub-element to return
  *
  * Returns: Length of the sub-element name including the null terminator (size of buffer needed to write the name)
  */
@@ -281,8 +308,8 @@
  * the element
  *
  * Parameters:
- *   e Element to get data from
- *   index Index of the sub-element
+ *   e: Element to get data from
+ *   index: Index of the sub-element
  *
  * Returns: Offset in bytes of sub-element in this element at given index
  */
@@ -295,7 +322,7 @@
  * Returns the element's vector size
  *
  * Parameters:
- *   e Element to get data from
+ *   e: Element to get data from
  *
  * Returns: Length of the element vector (for float2, float3, etc.)
  */
@@ -307,12 +334,11 @@
 /*
  * rsGetAllocation: Returns the Allocation for a given pointer
  *
+ * DEPRECATED.  Do not use.
+ *
  * Returns the Allocation for a given pointer.  The pointer should point within
  * a valid allocation.  The results are undefined if the pointer is not from a
  * valid allocation.
- *
- * This function is deprecated and will be removed from the SDK in a future
- * release.
  */
 extern rs_allocation __attribute__((overloadable))
     rsGetAllocation(const void* p);
@@ -321,7 +347,7 @@
  *  Get sampler anisotropy
  *
  * Parameters:
- *   s sampler to query
+ *   s: sampler to query
  *
  * Returns: anisotropy
  */
@@ -334,7 +360,7 @@
  * Get sampler magnification value
  *
  * Parameters:
- *   s sampler to query
+ *   s: sampler to query
  *
  * Returns: magnification value
  */
@@ -347,7 +373,7 @@
  * Get sampler minification value
  *
  * Parameters:
- *   s sampler to query
+ *   s: sampler to query
  *
  * Returns: minification value
  */
@@ -360,7 +386,7 @@
  * Get sampler wrap S value
  *
  * Parameters:
- *   s sampler to query
+ *   s: sampler to query
  *
  * Returns: wrap S value
  */
@@ -373,7 +399,7 @@
  * Get sampler wrap T value
  *
  * Parameters:
- *   s sampler to query
+ *   s: sampler to query
  *
  * Returns: wrap T value
  */
diff --git a/renderscript/include/rs_object_types.rsh b/renderscript/include/rs_object_types.rsh
index 982038d..0fc5e4d 100644
--- a/renderscript/include/rs_object_types.rsh
+++ b/renderscript/include/rs_object_types.rsh
@@ -14,13 +14,16 @@
  * limitations under the License.
  */
 
-// Don't edit this file!  It is auto-generated by frameworks/rs/api/gen_runtime.
+// Don't edit this file!  It is auto-generated by frameworks/rs/api/generate.sh.
 
 /*
- * rs_object_types.rsh: Standard RenderScript types
+ * rs_object_types.rsh: Object Types
  *
- * TODO desc.
+ * The types below are used to manipulate RenderScript objects like allocations,
+ * samplers, elements, and scripts.  Most of these object are created using the Java
+ * RenderScript APIs.
  */
+
 #ifndef RENDERSCRIPT_RS_OBJECT_TYPES_RSH
 #define RENDERSCRIPT_RS_OBJECT_TYPES_RSH
 
@@ -83,43 +86,6 @@
 typedef _RS_HANDLE rs_script;
 
 /*
- * rs_matrix4x4: 4x4 matrix of 32 bit floats
- *
- * Native holder for RS matrix.  Elements are stored in the array at the
- * location [row*4 + col]
- */
-typedef struct {
-    float m[16];
-} rs_matrix4x4;
-
-/*
- * rs_matrix3x3: 3x3 matrix of 32 bit floats
- *
- * Native holder for RS matrix.  Elements are stored in the array at the
- * location [row*3 + col]
- */
-typedef struct {
-    float m[9];
-} rs_matrix3x3;
-
-/*
- * rs_matrix2x2: 2x2 matrix of 32 bit floats
- *
- * Native holder for RS matrix.  Elements are stored in the array at the
- * location [row*2 + col]
- */
-typedef struct {
-    float m[4];
-} rs_matrix2x2;
-
-/*
- * rs_quaternion: Quarternion
- *
- * Quaternion type for use with the quaternion functions
- */
-typedef float4 rs_quaternion;
-
-/*
  * rs_allocation_cubemap_face: Enum for selecting cube map faces
  *
  */
@@ -142,11 +108,14 @@
  */
 #if (defined(RS_VERSION) && (RS_VERSION >= 14))
 typedef enum {
-    RS_ALLOCATION_USAGE_SCRIPT = 0x0001,
+    RS_ALLOCATION_USAGE_SCRIPT = 0x0001, // Allocation is bound to and accessed by scripts.
     RS_ALLOCATION_USAGE_GRAPHICS_TEXTURE = 0x0002, // Deprecated.
     RS_ALLOCATION_USAGE_GRAPHICS_VERTEX = 0x0004, // Deprecated.
     RS_ALLOCATION_USAGE_GRAPHICS_CONSTANTS = 0x0008, // Deprecated.
-    RS_ALLOCATION_USAGE_GRAPHICS_RENDER_TARGET = 0x0010 // Deprecated.
+    RS_ALLOCATION_USAGE_GRAPHICS_RENDER_TARGET = 0x0010, // Deprecated.
+    RS_ALLOCATION_USAGE_IO_INPUT = 0x0020, // Allocation is used as a Surface consumer.
+    RS_ALLOCATION_USAGE_IO_OUTPUT = 0x0040, // Allocation is used as a Surface producer.
+    RS_ALLOCATION_USAGE_SHARED = 0x0080 // Allocation's backing store is shared with another object (usually a Bitmap).  Copying to or from the original source Bitmap will cause a synchronization rather than a full copy.
 } rs_allocation_usage_type;
 #endif
 
@@ -170,36 +139,36 @@
  */
 #if (defined(RS_VERSION) && (RS_VERSION >= 16))
 typedef enum {
-    RS_TYPE_NONE             = 0,
-    RS_TYPE_FLOAT_32         = 2,
-    RS_TYPE_FLOAT_64         = 3,
-    RS_TYPE_SIGNED_8         = 4,
-    RS_TYPE_SIGNED_16        = 5,
-    RS_TYPE_SIGNED_32        = 6,
-    RS_TYPE_SIGNED_64        = 7,
-    RS_TYPE_UNSIGNED_8       = 8,
-    RS_TYPE_UNSIGNED_16      = 9,
-    RS_TYPE_UNSIGNED_32      = 10,
-    RS_TYPE_UNSIGNED_64      = 11,
-    RS_TYPE_BOOLEAN          = 12,
-    RS_TYPE_UNSIGNED_5_6_5   = 13,
+    RS_TYPE_NONE = 0,
+    RS_TYPE_FLOAT_32 = 2,
+    RS_TYPE_FLOAT_64 = 3,
+    RS_TYPE_SIGNED_8 = 4,
+    RS_TYPE_SIGNED_16 = 5,
+    RS_TYPE_SIGNED_32 = 6,
+    RS_TYPE_SIGNED_64 = 7,
+    RS_TYPE_UNSIGNED_8 = 8,
+    RS_TYPE_UNSIGNED_16 = 9,
+    RS_TYPE_UNSIGNED_32 = 10,
+    RS_TYPE_UNSIGNED_64 = 11,
+    RS_TYPE_BOOLEAN = 12,
+    RS_TYPE_UNSIGNED_5_6_5 = 13,
     RS_TYPE_UNSIGNED_5_5_5_1 = 14,
     RS_TYPE_UNSIGNED_4_4_4_4 = 15,
-    RS_TYPE_MATRIX_4X4       = 16,
-    RS_TYPE_MATRIX_3X3       = 17,
-    RS_TYPE_MATRIX_2X2       = 18,
-    RS_TYPE_ELEMENT          = 1000,
-    RS_TYPE_TYPE             = 1001,
-    RS_TYPE_ALLOCATION       = 1002,
-    RS_TYPE_SAMPLER          = 1003,
-    RS_TYPE_SCRIPT           = 1004,
-    RS_TYPE_MESH             = 1005,
+    RS_TYPE_MATRIX_4X4 = 16,
+    RS_TYPE_MATRIX_3X3 = 17,
+    RS_TYPE_MATRIX_2X2 = 18,
+    RS_TYPE_ELEMENT = 1000,
+    RS_TYPE_TYPE = 1001,
+    RS_TYPE_ALLOCATION = 1002,
+    RS_TYPE_SAMPLER = 1003,
+    RS_TYPE_SCRIPT = 1004,
+    RS_TYPE_MESH = 1005,
     RS_TYPE_PROGRAM_FRAGMENT = 1006,
-    RS_TYPE_PROGRAM_VERTEX   = 1007,
-    RS_TYPE_PROGRAM_RASTER   = 1008,
-    RS_TYPE_PROGRAM_STORE    = 1009,
-    RS_TYPE_FONT             = 1010,
-    RS_TYPE_INVALID          = 10000
+    RS_TYPE_PROGRAM_VERTEX = 1007,
+    RS_TYPE_PROGRAM_RASTER = 1008,
+    RS_TYPE_PROGRAM_STORE = 1009,
+    RS_TYPE_FONT = 1010,
+    RS_TYPE_INVALID = 10000
 } rs_data_type;
 #endif
 
@@ -231,14 +200,14 @@
  */
 #if (defined(RS_VERSION) && (RS_VERSION >= 16))
 typedef enum {
-    RS_SAMPLER_NEAREST              = 0,
-    RS_SAMPLER_LINEAR               = 1,
-    RS_SAMPLER_LINEAR_MIP_LINEAR    = 2,
-    RS_SAMPLER_WRAP                 = 3,
-    RS_SAMPLER_CLAMP                = 4,
-    RS_SAMPLER_LINEAR_MIP_NEAREST   = 5,
-    RS_SAMPLER_MIRRORED_REPEAT      = 6,
-    RS_SAMPLER_INVALID              = 100
+    RS_SAMPLER_NEAREST = 0,
+    RS_SAMPLER_LINEAR = 1,
+    RS_SAMPLER_LINEAR_MIP_LINEAR = 2,
+    RS_SAMPLER_WRAP = 3,
+    RS_SAMPLER_CLAMP = 4,
+    RS_SAMPLER_LINEAR_MIP_NEAREST = 5,
+    RS_SAMPLER_MIRRORED_REPEAT = 6,
+    RS_SAMPLER_INVALID = 100
 } rs_sampler_value;
 #endif
 
diff --git a/renderscript/include/rs_quaternion.rsh b/renderscript/include/rs_quaternion.rsh
index c6ece96..041bdf5 100644
--- a/renderscript/include/rs_quaternion.rsh
+++ b/renderscript/include/rs_quaternion.rsh
@@ -14,21 +14,24 @@
  * limitations under the License.
  */
 
-// Don't edit this file!  It is auto-generated by frameworks/rs/api/gen_runtime.
+// Don't edit this file!  It is auto-generated by frameworks/rs/api/generate.sh.
 
 /*
- * rs_quaternion.rsh: Quaternion routines
+ * rs_quaternion.rsh: Quaternion Functions
  *
  */
+
 #ifndef RENDERSCRIPT_RS_QUATERNION_RSH
 #define RENDERSCRIPT_RS_QUATERNION_RSH
 
 /*
- * Add two quaternions
+ * rsQuaternionAdd: Add two quaternions
+ *
+ * Adds two quaternions, i.e. *q += *rhs;
  *
  * Parameters:
- *   q destination quaternion to add to
- *   rhs right hand side quaternion to add
+ *   q: Destination quaternion to add to.
+ *   rhs: Quaternion to add.
  */
 static inline void __attribute__((overloadable))
     rsQuaternionAdd(rs_quaternion* q, const rs_quaternion* rhs) {
@@ -39,10 +42,12 @@
 }
 
 /*
- * Conjugates the quaternion
+ * rsQuaternionConjugate: Conjugate a quaternion
+ *
+ * Conjugates the quaternion.
  *
  * Parameters:
- *   q quaternion to conjugate
+ *   q: Quaternion to modify.
  */
 static inline void __attribute__((overloadable))
     rsQuaternionConjugate(rs_quaternion* q) {
@@ -52,13 +57,13 @@
 }
 
 /*
- * Dot product of two quaternions
+ * rsQuaternionDot: Dot product of two quaternions
+ *
+ * Returns the dot product of two quaternions.
  *
  * Parameters:
- *   q0 first quaternion
- *   q1 second quaternion
- *
- * Returns: dot product between q0 and q1
+ *   q0: First quaternion.
+ *   q1: Second quaternion.
  */
 static inline float __attribute__((overloadable))
     rsQuaternionDot(const rs_quaternion* q0, const rs_quaternion* q1) {
@@ -66,11 +71,13 @@
 }
 
 /*
- * Computes rotation matrix from the normalized quaternion
+ * rsQuaternionGetMatrixUnit: Get a rotation matrix from a quaternion
+ *
+ * Computes a rotation matrix from the normalized quaternion.
  *
  * Parameters:
- *   m resulting matrix
- *   q normalized quaternion
+ *   m: Resulting matrix.
+ *   q: Normalized quaternion.
  */
 static inline void __attribute__((overloadable))
     rsQuaternionGetMatrixUnit(rs_matrix4x4* m, const rs_quaternion* q) {
@@ -98,14 +105,16 @@
 }
 
 /*
- * Loads a quaternion that represents a rotation about an arbitrary unit vector
+ * rsQuaternionLoadRotateUnit: Quaternion that represents a rotation about an arbitrary unit vector
+ *
+ * Loads a quaternion that represents a rotation about an arbitrary unit vector.
  *
  * Parameters:
- *   q quaternion to set
- *   rot rot angle to rotate by
- *   x component of a vector
- *   y component of a vector
- *   z component of a vector
+ *   q: Destination quaternion.
+ *   rot: Angle to rotate by, in radians.
+ *   x: X component of the vector.
+ *   y: Y component of the vector.
+ *   z: Z component of the vector.
  */
 static inline void __attribute__((overloadable))
     rsQuaternionLoadRotateUnit(rs_quaternion* q, float rot, float x, float y, float z) {
@@ -120,15 +129,17 @@
 }
 
 /*
- * Set the quaternion from components or from another quaternion.
+ * rsQuaternionSet: Create a quarternion
+ *
+ * Creates a quaternion from its four components or from another quaternion.
  *
  * Parameters:
- *   q destination quaternion
- *   w component
- *   x component
- *   y component
- *   z component
- *   rhs source quaternion
+ *   q: Destination quaternion.
+ *   w: W component.
+ *   x: X component.
+ *   y: Y component.
+ *   z: Z component.
+ *   rhs: Source quaternion.
  */
 static inline void __attribute__((overloadable))
     rsQuaternionSet(rs_quaternion* q, float w, float x, float y, float z) {
@@ -147,15 +158,17 @@
 }
 
 /*
+ * rsQuaternionLoadRotate: Create a rotation quaternion
+ *
  * Loads a quaternion that represents a rotation about an arbitrary vector
  * (doesn't have to be unit)
  *
  * Parameters:
- *   q quaternion to set
- *   rot angle to rotate by
- *   x component of a vector
- *   y component of a vector
- *   z component of a vector
+ *   q: Destination quaternion.
+ *   rot: Angle to rotate by.
+ *   x: X component of a vector.
+ *   y: Y component of a vector.
+ *   z: Z component of a vector.
  */
 static inline void __attribute__((overloadable))
     rsQuaternionLoadRotate(rs_quaternion* q, float rot, float x, float y, float z) {
@@ -170,10 +183,12 @@
 }
 
 /*
- * Normalizes the quaternion
+ * rsQuaternionNormalize: Normalize a quaternion
+ *
+ * Normalizes the quaternion.
  *
  * Parameters:
- *   q quaternion to normalize
+ *   q: Quaternion to normalize.
  */
 static inline void __attribute__((overloadable))
     rsQuaternionNormalize(rs_quaternion* q) {
@@ -188,19 +203,22 @@
 }
 
 /*
- * Multiply quaternion by a scalar or another quaternion
+ * rsQuaternionMultiply: Multiply a quaternion by a scalar or another quaternion
+ *
+ * Multiplies a quaternion by a scalar or by another quaternion, e.g
+ * *q = *q * scalar; or *q = *q * *rhs;.
  *
  * Parameters:
- *   q destination quaternion
- *   s scalar
- *   rhs right hand side quaternion to multiply by
+ *   q: Destination quaternion.
+ *   scalar: Scalar to multiply the quarternion by.
+ *   rhs: Quarternion to multiply the destination quaternion by.
  */
 static inline void __attribute__((overloadable))
-    rsQuaternionMultiply(rs_quaternion* q, float s) {
-    q->w *= s;
-    q->x *= s;
-    q->y *= s;
-    q->z *= s;
+    rsQuaternionMultiply(rs_quaternion* q, float scalar) {
+    q->w *= scalar;
+    q->x *= scalar;
+    q->y *= scalar;
+    q->z *= scalar;
 }
 
 static inline void __attribute__((overloadable))
@@ -216,13 +234,15 @@
 }
 
 /*
- * Performs spherical linear interpolation between two quaternions
+ * rsQuaternionSlerp: Spherical linear interpolation between two quaternions
+ *
+ * Performs spherical linear interpolation between two quaternions.
  *
  * Parameters:
- *   q result quaternion from interpolation
- *   q0 first param
- *   q1 second param
- *   t how much to interpolate by
+ *   q: Result quaternion from the interpolation.
+ *   q0: First input quaternion.
+ *   q1: Second input quaternion.
+ *   t: How much to interpolate by.
  */
 static inline void __attribute__((overloadable))
     rsQuaternionSlerp(rs_quaternion* q, const rs_quaternion* q0, const rs_quaternion* q1, float t) {
diff --git a/renderscript/include/rs_time.rsh b/renderscript/include/rs_time.rsh
index 3a4acf2..8ce120f 100644
--- a/renderscript/include/rs_time.rsh
+++ b/renderscript/include/rs_time.rsh
@@ -14,13 +14,16 @@
  * limitations under the License.
  */
 
-// Don't edit this file!  It is auto-generated by frameworks/rs/api/gen_runtime.
+// Don't edit this file!  It is auto-generated by frameworks/rs/api/generate.sh.
 
 /*
- * rs_time.rsh: RenderScript time routines
+ * rs_time.rsh: Time Functions and Types
  *
- * This file contains RenderScript functions relating to time and date manipulation.
+ * The functions below can be used to tell the current clock time and the
+ * current system up time.  It's not recommended to call these functions
+ * inside of a kernel.
  */
+
 #ifndef RENDERSCRIPT_RS_TIME_RSH
 #define RENDERSCRIPT_RS_TIME_RSH
 
@@ -56,6 +59,8 @@
 } rs_tm;
 
 /*
+ * rsGetDt: Elapsed time since last call
+ *
  * Returns the time in seconds since this function was last called in this
  * script.
  *
@@ -65,33 +70,43 @@
     rsGetDt(void);
 
 /*
- * Converts the time specified by p timer into broken-down time and stores it
- * in p local. This function also returns a pointer to p local. If p local
- * is NULL, this function does nothing and returns NULL.
+ * rsLocaltime: Convert to local time
+ *
+ * Converts the time specified by timer into a rs_tm structure that provides year, month, hour, etc.
+ * This value is stored at *local.
+ *
+ * This functions returns the same pointer that is passed as first argument.
+ * If the local parameter is NULL, this function does nothing and returns NULL.
  *
  * Parameters:
- *   local Broken-down time.
- *   timer Input time as calendar time.
+ *   local: Pointer to time structure where the local time will be stored.
+ *   timer: Input time as a number of seconds since January 1, 1970.
  *
- * Returns: Pointer to broken-down time (same as input p local).
+ * Returns: Pointer to the output local time, i.e. the same value as the parameter local.
  */
 extern rs_tm* __attribute__((overloadable))
     rsLocaltime(rs_tm* local, const rs_time_t* timer);
 
 /*
+ * rsTime: Seconds since January 1, 1970
+ *
  * Returns the number of seconds since the Epoch (00:00:00 UTC, January 1,
- * 1970). If p timer is non-NULL, the result is also stored in the memory
- * pointed to by this variable. If an error occurs, a value of -1 is returned.
+ * 1970).
+ *
+ * If timer is non-NULL, the result is also stored in the memory pointed to by
+ * this variable.
  *
  * Parameters:
- *   timer Location to also store the returned calendar time.
+ *   timer: Location to also store the returned calendar time.
  *
- * Returns: Seconds since the Epoch.
+ * Returns: Seconds since the Epoch, -1 if there's an error.
  */
 extern rs_time_t __attribute__((overloadable))
     rsTime(rs_time_t* timer);
 
 /*
+ * rsUptimeMillis: System uptime in milliseconds
+ *
  * Returns the current system clock (uptime) in milliseconds.
  *
  * Returns: Uptime in milliseconds.
@@ -100,8 +115,13 @@
     rsUptimeMillis(void);
 
 /*
+ * rsUptimeNanos: System uptime in nanoseconds
+ *
  * Returns the current system clock (uptime) in nanoseconds.
  *
+ * The granularity of the values return by this call may be much
+ * larger than a nanosecond.
+ *
  * Returns: Uptime in nanoseconds.
  */
 extern int64_t __attribute__((overloadable))
diff --git a/renderscript/include/rs_value_types.rsh b/renderscript/include/rs_value_types.rsh
index c19bd4e..13c0500 100644
--- a/renderscript/include/rs_value_types.rsh
+++ b/renderscript/include/rs_value_types.rsh
@@ -14,57 +14,116 @@
  * limitations under the License.
  */
 
-// Don't edit this file!  It is auto-generated by frameworks/rs/api/gen_runtime.
+// Don't edit this file!  It is auto-generated by frameworks/rs/api/generate.sh.
 
 /*
- * rs_value_types.rsh: Standard RenderScript types
+ * rs_value_types.rsh: Numerical Types
  *
- *  Integers:
- *  8 bit: char, int8_t
- *  16 bit: short, int16_t
- *  32 bit: int, in32_t
- *  64 bit: long, long long, int64_t
+ * Scalars:
  *
- *  Unsigned integers:
- *  8 bit: uchar, uint8_t
- *  16 bit: ushort, uint16_t
- *  32 bit: uint, uint32_t
- *  64 bit: ulong, uint64_t
+ * RenderScript supports the following scalar numerical types:
  *
- *  Floating point:
- *  32 bit: float
- *  64 bit: double
+ * Integers:
+ * - 8 bit: char, int8_t
+ * - 16 bit: short, int16_t
+ * - 32 bit: int, int32_t
+ * - 64 bit: long, long long, int64_t
  *
- *  Vectors of length 2, 3, and 4 are supported for all the types above.
+ * Unsigned integers:
+ * - 8 bit: uchar, uint8_t
+ * - 16 bit: ushort, uint16_t
+ * - 32 bit: uint, uint32_t
+ * - 64 bit: ulong, uint64_t
+ *
+ * Floating point:
+ * - 32 bit: float
+ * - 64 bit: double
+ *
+ * Vectors:
+ *
+ * RenderScript supports fixed size vectors of length 2, 3, and 4.
+ * Vectors are declared using the common type name followed by a 2, 3, or 4.
+ * E.g. float4, int3, double2, ulong4.
+ *
+ * To create vector literals, use the vector type followed by the values enclosed
+ * between parentheses, e.g. (float3)(1.0f, 2.0f, 3.0f).
+ *
+ * Entries of a vector can be accessed using different naming styles.
+ *
+ * Single entries can be accessed by following the variable name with a dot and:
+ * - The letters x, y, z, and w,
+ * - The letters r, g, b, and a,
+ * - The letter s or S, followed by a zero based index.
+ *
+ * For example, with int4 myVar; the following are equivalent:
+ *   myVar.x == myVar.r == myVar.s0 == myVar.S0
+ *   myVar.y == myVar.g == myVar.s1 == myVar.S1
+ *   myVar.z == myVar.b == myVar.s2 == myVar.S2
+ *   myVar.w == myVar.a == myVar.s3 == myVar.S3
+ *
+ * Multiple entries of a vector can be accessed at once by using an identifier
+ * that is the concatenation of multiple letters or indices.  The resulting vector
+ * has a size equal to the number of entries named.
+ *
+ * With the example above, the middle two entries can be accessed using
+ * myVar.yz, myVar.gb, myVar.s12, and myVar.S12.
+ *
+ * The entries don't have to be contiguous or in increasing order.
+ * Entries can even be repeated, as long as we're not trying to assign
+ * to it.  You also can't mix the naming styles.
+ *
+ * Here are examples of what can or can't be done: 
+ * float4 v4;
+ * float3 v3;
+ * float2 v2;
+ * v2 = v4.xx; // Valid
+ * v3 = v4.zxw; // Valid
+ * v3 = v4.bba; // Valid
+ * v3 = v4.s034; // Valid
+ * v3.s120 = v4.S233; // Valid
+ * v4.yz = v3.rg; // Valid
+ * v4.yzx = v3.rg; // Invalid: mismatched sizes
+ * v4.yzz = v3; // Invalid: z appears twice in an assignment
+ * v3 = v3.xas0; // Invalid: can't mix xyzw with rgba nor s0...
+ *
+ *
+ * Matrices and Quaternions:
+ *
+ * RenderScript supports fixed size square matrices of floats of size 2x2, 3x3, and 4x4.
+ * The types are named rs_matrix2x2, rs_matrix3x3, and rs_matrix4x4.  See
+ * Matrix Functions for the list of operations.
+ *
+ * Quaternions are also supported via rs_quaternion.  See Quaterion Functions. for the list of operations.
  */
+
 #ifndef RENDERSCRIPT_RS_VALUE_TYPES_RSH
 #define RENDERSCRIPT_RS_VALUE_TYPES_RSH
 
 /*
  * int8_t: 8 bit signed integer
  *
- * 8 bit integer type
+ * 8 bit signed integer type.
  */
 typedef char int8_t;
 
 /*
  * int16_t: 16 bit signed integer
  *
- * 16 bit integer type
+ * A 16 bit signed integer type.
  */
 typedef short int16_t;
 
 /*
  * int32_t: 32 bit signed integer
  *
- * 32 bit integer type
+ * A 32 bit signed integer type.
  */
 typedef int int32_t;
 
 /*
  * int64_t: 64 bit signed integer
  *
- * 64 bit integer type
+ * A 64 bit signed integer type.
  */
 #if !defined(RS_VERSION) || (RS_VERSION <= 20)
 typedef long long int64_t;
@@ -77,28 +136,28 @@
 /*
  * uint8_t: 8 bit unsigned integer
  *
- * 8 bit unsigned integer type
+ * 8 bit unsigned integer type.
  */
 typedef unsigned char uint8_t;
 
 /*
  * uint16_t: 16 bit unsigned integer
  *
- * 16 bit unsigned integer type
+ * A 16 bit unsigned integer type.
  */
 typedef unsigned short uint16_t;
 
 /*
  * uint32_t: 32 bit unsigned integer
  *
- * 32 bit unsigned integer type
+ * A 32 bit unsigned integer type.
  */
 typedef unsigned int uint32_t;
 
 /*
  * uint64_t: 64 bit unsigned integer
  *
- * 64 bit unsigned integer type
+ * A 64 bit unsigned integer type.
  */
 #if !defined(RS_VERSION) || (RS_VERSION <= 20)
 typedef unsigned long long uint64_t;
@@ -111,35 +170,35 @@
 /*
  * uchar: 8 bit unsigned integer
  *
- * 8 bit unsigned integer type
+ * 8 bit unsigned integer type.
  */
 typedef uint8_t uchar;
 
 /*
  * ushort: 16 bit unsigned integer
  *
- * 16 bit unsigned integer type
+ * A 16 bit unsigned integer type.
  */
 typedef uint16_t ushort;
 
 /*
  * uint: 32 bit unsigned integer
  *
- * 32 bit unsigned integer type
+ * A 32 bit unsigned integer type.
  */
 typedef uint32_t uint;
 
 /*
  * ulong: 64 bit unsigned integer
  *
- * Typedef for unsigned long (use for 64-bit unsigned integers)
+ * A 64 bit unsigned integer type.
  */
 typedef uint64_t ulong;
 
 /*
  * size_t: Unsigned size type
  *
- * Typedef for size_t
+ * Unsigned size type.  The number of bits depend on the compilation flags.
  */
 #ifdef __LP64__
 typedef uint64_t size_t;
@@ -152,7 +211,7 @@
 /*
  * ssize_t: Signed size type
  *
- * Typedef for ssize_t
+ * Signed size type.  The number of bits depend on the compilation flags.
  */
 #ifdef __LP64__
 typedef int64_t ssize_t;
@@ -402,4 +461,49 @@
  */
 typedef long __attribute__((ext_vector_type(4))) long4;
 
+/*
+ * rs_matrix2x2: 2x2 matrix of 32 bit floats
+ *
+ * A square 2x2 matrix of floats.  The entries are stored in the array at the
+ * location [row*2 + col].
+ *
+ * See Matrix Functions.
+ */
+typedef struct {
+    float m[4];
+} rs_matrix2x2;
+
+/*
+ * rs_matrix3x3: 3x3 matrix of 32 bit floats
+ *
+ * A square 3x3 matrix of floats.  The entries are stored in the array at the
+ * location [row*3 + col].
+ *
+ * See Matrix Functions.
+ */
+typedef struct {
+    float m[9];
+} rs_matrix3x3;
+
+/*
+ * rs_matrix4x4: 4x4 matrix of 32 bit floats
+ *
+ * A square 4x4 matrix of floats.  The entries are stored in the array at the
+ * location [row*4 + col].
+ *
+ * See Matrix Functions.
+ */
+typedef struct {
+    float m[16];
+} rs_matrix4x4;
+
+/*
+ * rs_quaternion: Quaternion
+ *
+ * A square 4x4 matrix of floats that represents a quaternion.
+ *
+ * See Quaternion Functions.
+ */
+typedef float4 rs_quaternion;
+
 #endif // RENDERSCRIPT_RS_VALUE_TYPES_RSH
diff --git a/renderscript/include/rs_vector_math.rsh b/renderscript/include/rs_vector_math.rsh
index d82cd69..8ad2cbf 100644
--- a/renderscript/include/rs_vector_math.rsh
+++ b/renderscript/include/rs_vector_math.rsh
@@ -14,13 +14,24 @@
  * limitations under the License.
  */
 
-// Don't edit this file!  It is auto-generated by frameworks/rs/api/gen_runtime.
+// Don't edit this file!  It is auto-generated by frameworks/rs/api/generate.sh.
 
 /*
- * rs_vector_math.rsh: TODO Add documentation
+ * rs_vector_math.rsh: Vector Math Functions
  *
- * TODO Add documentation
+ * These functions interpret the input arguments as representation of vectors in n-dimensional space.
+ *
+ * The precision of the mathematical operations is affected by the pragmas
+ * rs_fp_relaxed and rs_fp_full.
+ *
+ * Different precision/speed tradeoffs can be achieved by using three variants
+ * of common math functions.  Functions with a name starting with
+ * - native_ may have custom hardware implementations with weaker precision,
+ * - half_ may perform internal computations using 16 bit floats, and
+ * - fast_ are n-dimensional space computations that may use 16 bit floats.
+ *
  */
+
 #ifndef RENDERSCRIPT_RS_VECTOR_MATH_RSH
 #define RENDERSCRIPT_RS_VECTOR_MATH_RSH
 
diff --git a/renderscript/lib/arm/libRSSupport.so b/renderscript/lib/arm/libRSSupport.so
index 69399f2..afefc27 100755
--- a/renderscript/lib/arm/libRSSupport.so
+++ b/renderscript/lib/arm/libRSSupport.so
Binary files differ
diff --git a/renderscript/lib/arm/libRSSupportIO.so b/renderscript/lib/arm/libRSSupportIO.so
index f2c4496..d2f53fb 100755
--- a/renderscript/lib/arm/libRSSupportIO.so
+++ b/renderscript/lib/arm/libRSSupportIO.so
Binary files differ
diff --git a/renderscript/lib/arm/libc.so b/renderscript/lib/arm/libc.so
index 4630fed..bcbb1e7 100755
--- a/renderscript/lib/arm/libc.so
+++ b/renderscript/lib/arm/libc.so
Binary files differ
diff --git a/renderscript/lib/arm/libclcore.bc b/renderscript/lib/arm/libclcore.bc
index 0e7afaf..2136af9 100644
--- a/renderscript/lib/arm/libclcore.bc
+++ b/renderscript/lib/arm/libclcore.bc
Binary files differ
diff --git a/renderscript/lib/arm/libm.so b/renderscript/lib/arm/libm.so
index 567ee8b..2e12f88 100755
--- a/renderscript/lib/arm/libm.so
+++ b/renderscript/lib/arm/libm.so
Binary files differ
diff --git a/renderscript/lib/arm/librsjni.so b/renderscript/lib/arm/librsjni.so
index e2f03d7..f0ef9b5 100755
--- a/renderscript/lib/arm/librsjni.so
+++ b/renderscript/lib/arm/librsjni.so
Binary files differ
diff --git a/renderscript/lib/arm/librsrt_arm.bc b/renderscript/lib/arm/librsrt_arm.bc
index 0e7afaf..2136af9 100644
--- a/renderscript/lib/arm/librsrt_arm.bc
+++ b/renderscript/lib/arm/librsrt_arm.bc
Binary files differ
diff --git a/renderscript/lib/javalib.jar b/renderscript/lib/javalib.jar
index 7d7faf2..d856e94 100644
--- a/renderscript/lib/javalib.jar
+++ b/renderscript/lib/javalib.jar
Binary files differ
diff --git a/renderscript/lib/mips/libRSSupport.so b/renderscript/lib/mips/libRSSupport.so
index 4960b22..edb68d9 100755
--- a/renderscript/lib/mips/libRSSupport.so
+++ b/renderscript/lib/mips/libRSSupport.so
Binary files differ
diff --git a/renderscript/lib/mips/libRSSupportIO.so b/renderscript/lib/mips/libRSSupportIO.so
index b58abe0..292fee0 100755
--- a/renderscript/lib/mips/libRSSupportIO.so
+++ b/renderscript/lib/mips/libRSSupportIO.so
Binary files differ
diff --git a/renderscript/lib/mips/libc.so b/renderscript/lib/mips/libc.so
index c5f2700..89cfc0c 100755
--- a/renderscript/lib/mips/libc.so
+++ b/renderscript/lib/mips/libc.so
Binary files differ
diff --git a/renderscript/lib/mips/libclcore.bc b/renderscript/lib/mips/libclcore.bc
index 0e7afaf..2136af9 100644
--- a/renderscript/lib/mips/libclcore.bc
+++ b/renderscript/lib/mips/libclcore.bc
Binary files differ
diff --git a/renderscript/lib/mips/libm.so b/renderscript/lib/mips/libm.so
index 19f1fe6..29055fb 100755
--- a/renderscript/lib/mips/libm.so
+++ b/renderscript/lib/mips/libm.so
Binary files differ
diff --git a/renderscript/lib/mips/librsjni.so b/renderscript/lib/mips/librsjni.so
index e5a42b9..4d7ed75 100755
--- a/renderscript/lib/mips/librsjni.so
+++ b/renderscript/lib/mips/librsjni.so
Binary files differ
diff --git a/renderscript/lib/mips/librsrt_mips.bc b/renderscript/lib/mips/librsrt_mips.bc
index 0e7afaf..2136af9 100644
--- a/renderscript/lib/mips/librsrt_mips.bc
+++ b/renderscript/lib/mips/librsrt_mips.bc
Binary files differ
diff --git a/renderscript/lib/x86/libRSSupport.so b/renderscript/lib/x86/libRSSupport.so
index 10c77fb..60288d6 100755
--- a/renderscript/lib/x86/libRSSupport.so
+++ b/renderscript/lib/x86/libRSSupport.so
Binary files differ
diff --git a/renderscript/lib/x86/libRSSupportIO.so b/renderscript/lib/x86/libRSSupportIO.so
index 51bc4ea..afd8e79 100755
--- a/renderscript/lib/x86/libRSSupportIO.so
+++ b/renderscript/lib/x86/libRSSupportIO.so
Binary files differ
diff --git a/renderscript/lib/x86/libc.so b/renderscript/lib/x86/libc.so
index 3168297..5d785fc 100755
--- a/renderscript/lib/x86/libc.so
+++ b/renderscript/lib/x86/libc.so
Binary files differ
diff --git a/renderscript/lib/x86/libclcore.bc b/renderscript/lib/x86/libclcore.bc
index 3e2cbe6..00e424c 100644
--- a/renderscript/lib/x86/libclcore.bc
+++ b/renderscript/lib/x86/libclcore.bc
Binary files differ
diff --git a/renderscript/lib/x86/libm.so b/renderscript/lib/x86/libm.so
index b08788c..ce846a2 100755
--- a/renderscript/lib/x86/libm.so
+++ b/renderscript/lib/x86/libm.so
Binary files differ
diff --git a/renderscript/lib/x86/librsjni.so b/renderscript/lib/x86/librsjni.so
index ee64320..e6c1fd9 100755
--- a/renderscript/lib/x86/librsjni.so
+++ b/renderscript/lib/x86/librsjni.so
Binary files differ
diff --git a/renderscript/lib/x86/librsrt_x86.bc b/renderscript/lib/x86/librsrt_x86.bc
index 88e6b67..e939eb5 100644
--- a/renderscript/lib/x86/librsrt_x86.bc
+++ b/renderscript/lib/x86/librsrt_x86.bc
Binary files differ
diff --git a/tools/linux/bcc_compat b/tools/linux/bcc_compat
index c012197..a39474f 100755
--- a/tools/linux/bcc_compat
+++ b/tools/linux/bcc_compat
Binary files differ
diff --git a/tools/linux/libLLVM.so b/tools/linux/libLLVM.so
index c5957c0..875a866 100755
--- a/tools/linux/libLLVM.so
+++ b/tools/linux/libLLVM.so
Binary files differ
diff --git a/tools/linux/libbcc.so b/tools/linux/libbcc.so
index 05a9759..2c9a0e1 100755
--- a/tools/linux/libbcc.so
+++ b/tools/linux/libbcc.so
Binary files differ
diff --git a/tools/linux/libbcinfo.so b/tools/linux/libbcinfo.so
index 82c09e0..3759f0e 100755
--- a/tools/linux/libbcinfo.so
+++ b/tools/linux/libbcinfo.so
Binary files differ
diff --git a/tools/linux/libc++.so b/tools/linux/libc++.so
index 01aa81d..1df7b13 100755
--- a/tools/linux/libc++.so
+++ b/tools/linux/libc++.so
Binary files differ
diff --git a/tools/linux/libclang.so b/tools/linux/libclang.so
index 5e463b5..bf3b092 100755
--- a/tools/linux/libclang.so
+++ b/tools/linux/libclang.so
Binary files differ
diff --git a/tools/linux/llvm-rs-cc b/tools/linux/llvm-rs-cc
index 94328c8..d3f6cc4 100755
--- a/tools/linux/llvm-rs-cc
+++ b/tools/linux/llvm-rs-cc
Binary files differ