From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32840) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bWdvY-00069z-Vb for qemu-devel@nongnu.org; Mon, 08 Aug 2016 02:20:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bWdvV-000483-OP for qemu-devel@nongnu.org; Mon, 08 Aug 2016 02:20:44 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:52617) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bWdvV-00047z-5r for qemu-devel@nongnu.org; Mon, 08 Aug 2016 02:20:41 -0400 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u786Ibsm079976 for ; Mon, 8 Aug 2016 02:20:40 -0400 Received: from e28smtp05.in.ibm.com (e28smtp05.in.ibm.com [125.16.236.5]) by mx0a-001b2d01.pphosted.com with ESMTP id 24nce7dd9p-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 08 Aug 2016 02:20:40 -0400 Received: from localhost by e28smtp05.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 8 Aug 2016 11:50:37 +0530 From: Nikunj A Dadhania In-Reply-To: <79d145c7-f9a5-ebf3-8eea-ba7ae6e88b28@twiddle.net> References: <1470591415-3268-1-git-send-email-nikunj@linux.vnet.ibm.com> <1470591415-3268-3-git-send-email-nikunj@linux.vnet.ibm.com> <79d145c7-f9a5-ebf3-8eea-ba7ae6e88b28@twiddle.net> Date: Mon, 08 Aug 2016 11:50:27 +0530 MIME-Version: 1.0 Content-Type: text/plain Message-Id: <8760rbye6s.fsf@abhimanyu.i-did-not-set--mail-host-address--so-tickle-me> Subject: Re: [Qemu-devel] [PATCH 2/6] target-ppc: Implement darn instruction List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson , qemu-ppc@nongnu.org, david@gibson.dropbear.id.au Cc: qemu-devel@nongnu.org, benh@kernel.crashing.org, Ravi Bangoria Richard Henderson writes: > On 08/07/2016 11:06 PM, Nikunj A Dadhania wrote: >> +target_ulong helper_darn(uint32_t l) >> +{ >> + target_ulong r = UINT64_MAX; >> + >> + if (l <= 2) { >> + do { >> + r = random() * random(); >> + r &= l ? UINT64_MAX : UINT32_MAX; >> + } while (r == UINT64_MAX); >> + } >> + >> + return r; >> +} > > Without considering the rng, I think you should split this into darn32 and > darn64 based on L in translate.c. You can diagnose l==2 in translate.c as well. Sure. Regards Nikunj