Refactor the libbcc runtime for x86 platform

This patch is merged/rebased from AOSP, where it was initially submitted to
frameworks/compile/libbcc by Jun Tian <jun.j.tian@intel.com>. All conflicts
have been resolved.

This patch refactors the libbcc runtime code to support x86 platform.
It removed the redundant x86 code and added the missing functions in
libclcore_x86.bc.
It resolved the RenderScript failures on the x86 platform.

Bug: 9961583
Change-Id: I2c8be0f710960ee5e0614721f5edfbaf028c67e1
diff --git a/driver/runtime/arch/generic.c b/driver/runtime/arch/generic.c
index da83c2a..50722b1 100644
--- a/driver/runtime/arch/generic.c
+++ b/driver/runtime/arch/generic.c
@@ -79,7 +79,22 @@
     return r;                                                                       \
 }
 
+#if !defined(ARCH_X86_HAVE_SSE2) && !defined(ARCH_X86_HAVE_SSE3)
+
 _CLAMP(float);
+
+#else
+
+extern float __attribute__((overloadable)) clamp(float amount, float low, float high);
+extern float2 __attribute__((overloadable)) clamp(float2 amount, float2 low, float2 high);
+extern float3 __attribute__((overloadable)) clamp(float3 amount, float3 low, float3 high);
+extern float4 __attribute__((overloadable)) clamp(float4 amount, float4 low, float4 high);
+extern float2 __attribute__((overloadable)) clamp(float2 amount, float low, float high);
+extern float3 __attribute__((overloadable)) clamp(float3 amount, float low, float high);
+extern float4 __attribute__((overloadable)) clamp(float4 amount, float low, float high);
+
+#endif // !defined(ARCH_X86_HAVE_SSE2) && !defined(ARCH_X86_HAVE_SSE3)
+
 _CLAMP(double);
 _CLAMP(char);
 _CLAMP(uchar);
@@ -945,4 +960,3 @@
     uchar4 c = {color.x, color.y, color.z, color.w};
     return c;
 }
-