All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2 0/2] cutils: allow compilation with icc
@ 2015-06-23 12:30 Artyom Tarasenko
  2015-06-23 12:30 ` [Qemu-devel] [PATCH v2 1/2] qemu-common: add VEC_OR macro Artyom Tarasenko
  2015-06-23 12:30 ` [Qemu-devel] [PATCH v2 2/2] cutils: allow compilation with icc Artyom Tarasenko
  0 siblings, 2 replies; 3+ messages in thread
From: Artyom Tarasenko @ 2015-06-23 12:30 UTC (permalink / raw)
  To: qemu-devel, Paolo Bonzini; +Cc: Peter Lieven, Artyom Tarasenko, Juan Quintela

changes from the initial version: create a VEC_OR macro as suggested by Paolo

Artyom Tarasenko (2):
  qemu-common: add VEC_OR macro
  cutils: allow compilation with icc

 include/qemu-common.h |  3 +++
 util/cutils.c         | 14 +++++++-------
 2 files changed, 10 insertions(+), 7 deletions(-)

-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Qemu-devel] [PATCH v2 1/2] qemu-common: add VEC_OR macro
  2015-06-23 12:30 [Qemu-devel] [PATCH v2 0/2] cutils: allow compilation with icc Artyom Tarasenko
@ 2015-06-23 12:30 ` Artyom Tarasenko
  2015-06-23 12:30 ` [Qemu-devel] [PATCH v2 2/2] cutils: allow compilation with icc Artyom Tarasenko
  1 sibling, 0 replies; 3+ messages in thread
From: Artyom Tarasenko @ 2015-06-23 12:30 UTC (permalink / raw)
  To: qemu-devel, Paolo Bonzini; +Cc: Peter Lieven, Artyom Tarasenko, Juan Quintela

Intel C Compiler version 15.0.3.187 Build 20150407 doesn't support
'|' function for non floating-point simd operands.

Define VEC_OR macro which uses _mm_or_si128 supported
both in icc and gcc on x86 platform.

Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com>
---
 include/qemu-common.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/qemu-common.h b/include/qemu-common.h
index d52d09c..5be3cdd 100644
--- a/include/qemu-common.h
+++ b/include/qemu-common.h
@@ -455,6 +455,7 @@ void qemu_hexdump(const char *buf, FILE *fp, const char *prefix, size_t size);
 #define VECTYPE        __vector unsigned char
 #define SPLAT(p)       vec_splat(vec_ld(0, p), 0)
 #define ALL_EQ(v1, v2) vec_all_eq(v1, v2)
+#define VEC_OR(v1, v2) ((v1) | (v2))
 /* altivec.h may redefine the bool macro as vector type.
  * Reset it to POSIX semantics. */
 #define bool _Bool
@@ -463,10 +464,12 @@ void qemu_hexdump(const char *buf, FILE *fp, const char *prefix, size_t size);
 #define VECTYPE        __m128i
 #define SPLAT(p)       _mm_set1_epi8(*(p))
 #define ALL_EQ(v1, v2) (_mm_movemask_epi8(_mm_cmpeq_epi8(v1, v2)) == 0xFFFF)
+#define VEC_OR(v1, v2) (_mm_or_si128(v1, v2))
 #else
 #define VECTYPE        unsigned long
 #define SPLAT(p)       (*(p) * (~0UL / 255))
 #define ALL_EQ(v1, v2) ((v1) == (v2))
+#define VEC_OR(v1, v2) ((v1) | (v2))
 #endif
 
 #define BUFFER_FIND_NONZERO_OFFSET_UNROLL_FACTOR 8
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [Qemu-devel] [PATCH v2 2/2] cutils: allow compilation with icc
  2015-06-23 12:30 [Qemu-devel] [PATCH v2 0/2] cutils: allow compilation with icc Artyom Tarasenko
  2015-06-23 12:30 ` [Qemu-devel] [PATCH v2 1/2] qemu-common: add VEC_OR macro Artyom Tarasenko
@ 2015-06-23 12:30 ` Artyom Tarasenko
  1 sibling, 0 replies; 3+ messages in thread
From: Artyom Tarasenko @ 2015-06-23 12:30 UTC (permalink / raw)
  To: qemu-devel, Paolo Bonzini; +Cc: Peter Lieven, Artyom Tarasenko, Juan Quintela

Use VEC_OR macro for operations on VECTYPE operands

Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com>
---
 util/cutils.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/util/cutils.c b/util/cutils.c
index 144b25c..5d1c9eb 100644
--- a/util/cutils.c
+++ b/util/cutils.c
@@ -207,13 +207,13 @@ size_t buffer_find_nonzero_offset(const void *buf, size_t len)
     for (i = BUFFER_FIND_NONZERO_OFFSET_UNROLL_FACTOR;
          i < len / sizeof(VECTYPE);
          i += BUFFER_FIND_NONZERO_OFFSET_UNROLL_FACTOR) {
-        VECTYPE tmp0 = p[i + 0] | p[i + 1];
-        VECTYPE tmp1 = p[i + 2] | p[i + 3];
-        VECTYPE tmp2 = p[i + 4] | p[i + 5];
-        VECTYPE tmp3 = p[i + 6] | p[i + 7];
-        VECTYPE tmp01 = tmp0 | tmp1;
-        VECTYPE tmp23 = tmp2 | tmp3;
-        if (!ALL_EQ(tmp01 | tmp23, zero)) {
+        VECTYPE tmp0 = VEC_OR(p[i + 0], p[i + 1]);
+        VECTYPE tmp1 = VEC_OR(p[i + 2], p[i + 3]);
+        VECTYPE tmp2 = VEC_OR(p[i + 4], p[i + 5]);
+        VECTYPE tmp3 = VEC_OR(p[i + 6], p[i + 7]);
+        VECTYPE tmp01 = VEC_OR(tmp0, tmp1);
+        VECTYPE tmp23 = VEC_OR(tmp2, tmp3);
+        if (!ALL_EQ(VEC_OR(tmp01, tmp23), zero)) {
             break;
         }
     }
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-06-23 12:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-23 12:30 [Qemu-devel] [PATCH v2 0/2] cutils: allow compilation with icc Artyom Tarasenko
2015-06-23 12:30 ` [Qemu-devel] [PATCH v2 1/2] qemu-common: add VEC_OR macro Artyom Tarasenko
2015-06-23 12:30 ` [Qemu-devel] [PATCH v2 2/2] cutils: allow compilation with icc Artyom Tarasenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.