[Libclc-dev] [PATCH 6/6] Implement fast_normalize builtin

Matt Arsenault arsenm2 at gmail.com
Thu Mar 19 09:43:05 PDT 2015


> On Mar 19, 2015, at 8:35 AM, Tom Stellard <thomas.stellard at amd.com> wrote:
> 
> _CLC_OVERLOAD _CLC_DEF double fast_normalize(double p) {
> +  return normalize(p);
> +}
> +
> +_CLC_OVERLOAD _CLC_DEF double2 fast_normalize(double2 p) {
> +  double l2 = dot(p, p);
> +  return l2 == 0.0F ? p : p * half_rsqrt(l2);
> +}
> +
> +_CLC_OVERLOAD _CLC_DEF double3 fast_normalize(double3 p) {
> +  double l2 = dot(p, p);
> +  return l2 == 0.0F ? p : p * half_rsqrt(l2);
> +}
> +
> +_CLC_OVERLOAD _CLC_DEF double4 fast_normalize(double4 p) {
> +  double l2 = dot(p, p);
> +  return l2 == 0.0F ? p : p * half_rsqrt(l2);
> +}
> +

The double versions shouldn’t have the f suffix on the constants
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/libclc-dev/attachments/20150319/c99db4ef/attachment.html>


More information about the Libclc-dev mailing list