[test-suite] r276920 - [test-suite] Bitcode simd tests: align memory to 128.
Alina Sbirlea via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 27 14:29:16 PDT 2016
Author: asbirlea
Date: Wed Jul 27 16:29:15 2016
New Revision: 276920
URL: http://llvm.org/viewvc/llvm-project?rev=276920&view=rev
Log:
[test-suite] Bitcode simd tests: align memory to 128.
Summary:
Patch preparing the addition of more tests.
Some require 128 alignment, so update driver to allocate aligned memory.
Reviewers: llvm-commits, mehdi_amini
Differential Revision: https://reviews.llvm.org/D22701
Modified:
test-suite/trunk/Bitcode/simd_ops/simd_ops.cpp
Modified: test-suite/trunk/Bitcode/simd_ops/simd_ops.cpp
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/Bitcode/simd_ops/simd_ops.cpp?rev=276920&r1=276919&r2=276920&view=diff
==============================================================================
--- test-suite/trunk/Bitcode/simd_ops/simd_ops.cpp (original)
+++ test-suite/trunk/Bitcode/simd_ops/simd_ops.cpp Wed Jul 27 16:29:15 2016
@@ -1,5 +1,21 @@
#include "filter_test_op.h"
+#ifdef _MSC_VER
+#include <errno.h>
+#include <malloc.h>
+#endif
+
+// Allocate aligned memory, per recent requirement by the
+// Halide tests updated upstream.
+int allocate_aligned(void **mem, size_t alignment, size_t size) {
+#ifdef _MSC_VER
+ *p = _aligned_malloc(size, alignment);
+ return (*p) ? 0 : errno;
+#else
+ return posix_memalign(mem, alignment, size);
+#endif
+}
+
template<typename T>
T rand_value() {
return (T)(rand() * 0.125) - 100;
@@ -12,7 +28,9 @@ extern "C" void halide_print(void *, con
template<typename T>
buffer_t make_buffer(int w, int h) {
- T *mem = new T[w*h];
+ T *mem;
+ int err = allocate_aligned((void **)&mem, 128, w * h * sizeof(T));
+
buffer_t buf = {0};
buf.host = (uint8_t *)mem;
buf.extent[0] = w;
More information about the llvm-commits
mailing list