[oclgrind] 01/01: Address endianness issues in getConstantData()
James Price
jprice-guest at moszumanska.debian.org
Mon May 2 13:04:54 UTC 2016
This is an automated email from the git hooks/post-receive script.
jprice-guest pushed a commit to branch master
in repository oclgrind.
commit 4b13dd07ff34741a6664863912d4e209128bb314
Author: James Price <j.price at bristol.ac.uk>
Date: Mon May 2 13:54:30 2016 +0100
Address endianness issues in getConstantData()
---
debian/changelog | 3 ++-
debian/patches/big-endian.patch | 51 +++++++++++++++++++++++++++++++++++++++++
debian/patches/series | 1 +
3 files changed, 54 insertions(+), 1 deletion(-)
diff --git a/debian/changelog b/debian/changelog
index e3875ee..6d463dd 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,9 @@
oclgrind (15.5-4) unstable; urgency=low
* Fix isnan/isinf usasge for libc 2.23 (Closes: #818823)
+ * Make constant data handling endian agnostic
- -- James Price <j.price at bristol.ac.uk> Fri, 25 Mar 2016 12:09:43 +0000
+ -- James Price <j.price at bristol.ac.uk> Mon, 02 May 2016 13:53:19 +0100
oclgrind (15.5-3) unstable; urgency=low
diff --git a/debian/patches/big-endian.patch b/debian/patches/big-endian.patch
new file mode 100644
index 0000000..01650fc
--- /dev/null
+++ b/debian/patches/big-endian.patch
@@ -0,0 +1,51 @@
+--- a/src/core/common.cpp
++++ b/src/core/common.cpp
+@@ -260,10 +260,27 @@
+ switch (type->getTypeID())
+ {
+ case llvm::Type::IntegerTyID:
+- memcpy(data,
+- ((llvm::ConstantInt*)constant)->getValue().getRawData(),
+- size);
++ {
++ uint64_t ui = ((llvm::ConstantInt*)constant)->getZExtValue();
++ switch (size)
++ {
++ case 1:
++ *((uint8_t*)data) = ui;
++ break;
++ case 2:
++ *((uint16_t*)data) = ui;
++ break;
++ case 4:
++ *((uint32_t*)data) = ui;
++ break;
++ case 8:
++ *((uint64_t*)data) = ui;
++ break;
++ default:
++ FATAL_ERROR("Unsupported constant int size: %u bytes", size);
++ }
+ break;
++ }
+ case llvm::Type::FloatTyID:
+ {
+ *(float*)data =
+--- a/tests/kernels/alignment/packed.ref
++++ b/tests/kernels/alignment/packed.ref
+@@ -1,4 +1,4 @@
+
+ Argument 'out': 4 bytes
+- out[0] = 2
++ out[0] = 33554434
+
+--- a/tests/kernels/alignment/packed.sim
++++ b/tests/kernels/alignment/packed.sim
+@@ -5,6 +5,6 @@
+
+ <size=5 char hex>
+ 0x01
+-0x02 0x00 0x0 0x00
++0x02 0x00 0x00 0x02
+
+ <size=4 fill=0 dump>
diff --git a/debian/patches/series b/debian/patches/series
index 1179602..1e6fa64 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -10,3 +10,4 @@ i386-shift-width.patch
use-opencl-headers.patch
altivec-fix.patch
use-std.patch
+big-endian.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-opencl/oclgrind.git
More information about the Pkg-opencl-commits
mailing list