From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42968) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSknY-0001cw-8B for qemu-devel@nongnu.org; Thu, 28 Jul 2016 08:52:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bSknU-0007xa-5Y for qemu-devel@nongnu.org; Thu, 28 Jul 2016 08:52:23 -0400 Sender: Richard Henderson References: <1469688581-30853-1-git-send-email-nikunj@linux.vnet.ibm.com> <1469688581-30853-5-git-send-email-nikunj@linux.vnet.ibm.com> From: Richard Henderson Message-ID: <900e59b4-16f6-25ef-ab82-c33f9fcedcd3@twiddle.net> Date: Thu, 28 Jul 2016 18:22:05 +0530 MIME-Version: 1.0 In-Reply-To: <1469688581-30853-5-git-send-email-nikunj@linux.vnet.ibm.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v1 4/8] target-ppc: add vabsdu[b, h, w] instructions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Nikunj A Dadhania , qemu-ppc@nongnu.org, david@gibson.dropbear.id.au Cc: qemu-devel@nongnu.org, bharata@linux.vnet.ibm.com, aneesh.kumar@linux.vnet.ibm.com, benh@kernel.crashing.org, Sandipan Das On 07/28/2016 12:19 PM, Nikunj A Dadhania wrote: > + r->element[i] = abs(a->element[i] - b->element[i]); \ > + } \ > +} > + > +/* VABSDU - Vector absolute difference unsigned > + * name - instruction mnemonic suffix (b: byte, h: halfword, w: word) > + * element - element type to access from vector > + */ > +#define VABSDU(type, element) \ > + VABSDU_DO(absdu##type, element) > +VABSDU(b, u8) > +VABSDU(h, u16) > +VABSDU(w, u32) From whence are you receiving this abs definition, and how do you expect it to work with an unsigned input? I can only imagine you're getting abs(3), aka int abs(int), from stdlib.h. Which technically does work post-arithmetic promotion for u8 and u16, but it does not for u32. I think we'd prefer an explicit (a > b ? a - b : b - a). r~