qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 5/6] target-ppc: add vprtyb[w/d/q] instructio


From: Richard Henderson
Subject: Re: [Qemu-devel] [PATCH v2 5/6] target-ppc: add vprtyb[w/d/q] instructions
Date: Thu, 27 Oct 2016 07:16:24 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0

On 10/27/2016 01:36 AM, Nikunj A Dadhania wrote:
Right, it does reduce number of operations:

+#define SIZE_MASK(x) ((1ULL << (x)) - 1)
+static uint64_t vparity(uint64_t f1, uint64_t f2, int size)
+{
+    uint64_t res = f1 ^ f2;
+    if (size == 8) return res;
+    return vparity(res & SIZE_MASK(size/2), res >> (size/2), size/2);
+}

Why are you using recursion for something that should be 5 operations? You're making this more complicated than it needs to be.

  uint64_t res = b->u64[0] ^ b->u64[1];
  res ^= res >> 32;
  res ^= res >> 16;
  res ^= res >> 8;
  r->u64[LO_IDX] = res & 1;


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]