[cfe-commits] [libclc] r157599 - in /libclc/trunk/generic: include/clc/clc.h include/clc/math/gentype.inc include/clc/math/mad.h include/clc/math/mad.inc lib/SOURCES lib/math/ lib/math/mad.cl lib/math/mad.inc

Peter Collingbourne peter at pcc.me.uk
Mon May 28 17:42:39 PDT 2012


Author: pcc
Date: Mon May 28 19:42:38 2012
New Revision: 157599

URL: http://llvm.org/viewvc/llvm-project?rev=157599&view=rev
Log:
Implement mad builtin.

Added:
    libclc/trunk/generic/include/clc/math/gentype.inc
    libclc/trunk/generic/include/clc/math/mad.h
    libclc/trunk/generic/include/clc/math/mad.inc
    libclc/trunk/generic/lib/math/
    libclc/trunk/generic/lib/math/mad.cl
    libclc/trunk/generic/lib/math/mad.inc
Modified:
    libclc/trunk/generic/include/clc/clc.h
    libclc/trunk/generic/lib/SOURCES

Modified: libclc/trunk/generic/include/clc/clc.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/clc.h?rev=157599&r1=157598&r2=157599&view=diff
==============================================================================
--- libclc/trunk/generic/include/clc/clc.h (original)
+++ libclc/trunk/generic/include/clc/clc.h Mon May 28 19:42:38 2012
@@ -38,6 +38,7 @@
 #include <clc/math/fabs.h>
 #include <clc/math/log.h>
 #include <clc/math/log2.h>
+#include <clc/math/mad.h>
 #include <clc/math/sin.h>
 #include <clc/math/sqrt.h>
 #include <clc/math/native_cos.h>

Added: libclc/trunk/generic/include/clc/math/gentype.inc
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/gentype.inc?rev=157599&view=auto
==============================================================================
--- libclc/trunk/generic/include/clc/math/gentype.inc (added)
+++ libclc/trunk/generic/include/clc/math/gentype.inc Mon May 28 19:42:38 2012
@@ -0,0 +1,51 @@
+#define GENTYPE float
+#include BODY
+#undef GENTYPE
+
+#define GENTYPE float2
+#include BODY
+#undef GENTYPE
+
+#define GENTYPE float3
+#include BODY
+#undef GENTYPE
+
+#define GENTYPE float4
+#include BODY
+#undef GENTYPE
+
+#define GENTYPE float8
+#include BODY
+#undef GENTYPE
+
+#define GENTYPE float16
+#include BODY
+#undef GENTYPE
+
+#ifdef cl_khr_fp64
+#define GENTYPE double
+#include BODY
+#undef GENTYPE
+
+#define GENTYPE double2
+#include BODY
+#undef GENTYPE
+
+#define GENTYPE double3
+#include BODY
+#undef GENTYPE
+
+#define GENTYPE double4
+#include BODY
+#undef GENTYPE
+
+#define GENTYPE double8
+#include BODY
+#undef GENTYPE
+
+#define GENTYPE double16
+#include BODY
+#undef GENTYPE
+#endif
+
+#undef BODY

Added: libclc/trunk/generic/include/clc/math/mad.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/mad.h?rev=157599&view=auto
==============================================================================
--- libclc/trunk/generic/include/clc/math/mad.h (added)
+++ libclc/trunk/generic/include/clc/math/mad.h Mon May 28 19:42:38 2012
@@ -0,0 +1,2 @@
+#define BODY <clc/math/mad.inc>
+#include <clc/math/gentype.inc>

Added: libclc/trunk/generic/include/clc/math/mad.inc
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/mad.inc?rev=157599&view=auto
==============================================================================
--- libclc/trunk/generic/include/clc/math/mad.inc (added)
+++ libclc/trunk/generic/include/clc/math/mad.inc Mon May 28 19:42:38 2012
@@ -0,0 +1 @@
+_CLC_OVERLOAD _CLC_DECL GENTYPE mad(GENTYPE a, GENTYPE b, GENTYPE c);

Modified: libclc/trunk/generic/lib/SOURCES
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/SOURCES?rev=157599&r1=157598&r2=157599&view=diff
==============================================================================
--- libclc/trunk/generic/lib/SOURCES (original)
+++ libclc/trunk/generic/lib/SOURCES Mon May 28 19:42:38 2012
@@ -7,3 +7,4 @@
 integer/add_sat.cl
 integer/add_sat.ll
 integer/add_sat_impl.ll
+math/mad.cl

Added: libclc/trunk/generic/lib/math/mad.cl
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/mad.cl?rev=157599&view=auto
==============================================================================
--- libclc/trunk/generic/lib/math/mad.cl (added)
+++ libclc/trunk/generic/lib/math/mad.cl Mon May 28 19:42:38 2012
@@ -0,0 +1,4 @@
+#include <clc/clc.h>
+
+#define BODY <mad.inc>
+#include <clc/math/gentype.inc>

Added: libclc/trunk/generic/lib/math/mad.inc
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/mad.inc?rev=157599&view=auto
==============================================================================
--- libclc/trunk/generic/lib/math/mad.inc (added)
+++ libclc/trunk/generic/lib/math/mad.inc Mon May 28 19:42:38 2012
@@ -0,0 +1,3 @@
+_CLC_OVERLOAD _CLC_DEF GENTYPE mad(GENTYPE a, GENTYPE b, GENTYPE c) {
+  return a * b + c;
+}





More information about the cfe-commits mailing list