summaryrefslogtreecommitdiff
path: root/generic/include
diff options
context:
space:
mode:
authorTom Stellard <thomas.stellard@amd.com>2013-06-26 18:21:13 +0000
committerTom Stellard <thomas.stellard@amd.com>2013-06-26 18:21:13 +0000
commitf1bf4b8307660f83653a5cab6f6fe1567a58f4a1 (patch)
tree886814a1e763ef9d0eb1371b527960df746a575a /generic/include
parent15ba684e4eb0d73bc208766869161f0af1f120ee (diff)
libclc: implement rotate builtin
This implementation does a lot of bit shifting and masking. Suffice to say, this is somewhat suboptimal... but it does look to produce correct results (after the piglit tests were corrected for sign extension issues). Someone who knows LLVM better than I could re-write this more efficiently. Patch by: Aaron Watry git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@184996 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'generic/include')
-rw-r--r--generic/include/clc/clc.h1
-rw-r--r--generic/include/clc/integer/gentype.inc11
-rw-r--r--generic/include/clc/integer/rotate.h2
-rw-r--r--generic/include/clc/integer/rotate.inc1
4 files changed, 15 insertions, 0 deletions
diff --git a/generic/include/clc/clc.h b/generic/include/clc/clc.h
index c3d7d59..72f518a 100644
--- a/generic/include/clc/clc.h
+++ b/generic/include/clc/clc.h
@@ -63,6 +63,7 @@
#include <clc/integer/abs.h>
#include <clc/integer/abs_diff.h>
#include <clc/integer/add_sat.h>
+#include <clc/integer/rotate.h>
#include <clc/integer/sub_sat.h>
/* 6.11.2 and 6.11.3 Shared Integer/Math Functions */
diff --git a/generic/include/clc/integer/gentype.inc b/generic/include/clc/integer/gentype.inc
index 0b32efd..005b9af 100644
--- a/generic/include/clc/integer/gentype.inc
+++ b/generic/include/clc/integer/gentype.inc
@@ -1,3 +1,4 @@
+#define GENSIZE 8
#define GENTYPE char
#define UGENTYPE uchar
#define SGENTYPE char
@@ -94,6 +95,9 @@
#undef UGENTYPE
#undef SGENTYPE
+#undef GENSIZE
+#define GENSIZE 16
+
#define GENTYPE short
#define UGENTYPE ushort
#define SGENTYPE short
@@ -190,6 +194,9 @@
#undef UGENTYPE
#undef SGENTYPE
+#undef GENSIZE
+#define GENSIZE 32
+
#define GENTYPE int
#define UGENTYPE uint
#define SGENTYPE int
@@ -286,6 +293,9 @@
#undef UGENTYPE
#undef SGENTYPE
+#undef GENSIZE
+#define GENSIZE 64
+
#define GENTYPE long
#define UGENTYPE ulong
#define SGENTYPE long
@@ -382,4 +392,5 @@
#undef UGENTYPE
#undef SGENTYPE
+#undef GENSIZE
#undef BODY
diff --git a/generic/include/clc/integer/rotate.h b/generic/include/clc/integer/rotate.h
new file mode 100644
index 0000000..e163bc8
--- /dev/null
+++ b/generic/include/clc/integer/rotate.h
@@ -0,0 +1,2 @@
+#define BODY <clc/integer/rotate.inc>
+#include <clc/integer/gentype.inc>
diff --git a/generic/include/clc/integer/rotate.inc b/generic/include/clc/integer/rotate.inc
new file mode 100644
index 0000000..5720e1c
--- /dev/null
+++ b/generic/include/clc/integer/rotate.inc
@@ -0,0 +1 @@
+_CLC_OVERLOAD _CLC_DECL GENTYPE rotate(GENTYPE x, GENTYPE y);