[libclc] r190211 - Implement mad_hi built-in

Jordan Rose jordan_rose at apple.com
Fri Sep 6 15:17:43 PDT 2013


I hate to be this pedantic, but you should really parenthesize those arguments.

mad_hi(1, 2, x > y ? 0 : 1)

I'd just do it for all the macros you're adding, regardless of whether it's actually a potential problem.

Jordan


On Sep 6, 2013, at 15:09 , Aaron Watry <awatry at gmail.com> wrote:

> Author: awatry
> Date: Fri Sep  6 17:09:51 2013
> New Revision: 190211
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=190211&view=rev
> Log:
> Implement mad_hi built-in
> 
> We already have a working mul_hi, and the spec gives us the implementation as:
> Returns mul_hi(a,b)+c.
> 
> Signed-off-by: Aaron Watry <awatry at gmail.com>
> Reviewed-by: Tom Stellard <thomas.stellard at amd.com>
> 
> Added:
>    libclc/trunk/generic/include/clc/integer/mad_hi.h
> Modified:
>    libclc/trunk/generic/include/clc/clc.h
> 
> Modified: libclc/trunk/generic/include/clc/clc.h
> URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/clc.h?rev=190211&r1=190210&r2=190211&view=diff
> ==============================================================================
> --- libclc/trunk/generic/include/clc/clc.h (original)
> +++ libclc/trunk/generic/include/clc/clc.h Fri Sep  6 17:09:51 2013
> @@ -67,6 +67,7 @@
> #include <clc/integer/clz.h>
> #include <clc/integer/hadd.h>
> #include <clc/integer/mad24.h>
> +#include <clc/integer/mad_hi.h>
> #include <clc/integer/mul24.h>
> #include <clc/integer/mul_hi.h>
> #include <clc/integer/rhadd.h>
> 
> Added: libclc/trunk/generic/include/clc/integer/mad_hi.h
> URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/integer/mad_hi.h?rev=190211&view=auto
> ==============================================================================
> --- libclc/trunk/generic/include/clc/integer/mad_hi.h (added)
> +++ libclc/trunk/generic/include/clc/integer/mad_hi.h Fri Sep  6 17:09:51 2013
> @@ -0,0 +1 @@
> +#define mad_hi(a, b, c) (mul_hi(a,b)+c)
> 
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list