From patchwork Mon Jun 13 23:58:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 9174759 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 96A046075D for ; Tue, 14 Jun 2016 00:26:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 89E6627D45 for ; Tue, 14 Jun 2016 00:26:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7EBEA28047; Tue, 14 Jun 2016 00:26:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B578F27D45 for ; Tue, 14 Jun 2016 00:26:00 +0000 (UTC) Received: from localhost ([::1]:60128 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bCcB4-00012K-CW for patchwork-qemu-devel@patchwork.kernel.org; Mon, 13 Jun 2016 20:25:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38726) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bCbl7-0002HN-Mt for qemu-devel@nongnu.org; Mon, 13 Jun 2016 19:59:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bCbl2-0004SA-Nb for qemu-devel@nongnu.org; Mon, 13 Jun 2016 19:59:08 -0400 Received: from mail-qt0-x244.google.com ([2607:f8b0:400d:c0d::244]:34086) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bCbl2-0004S2-KF for qemu-devel@nongnu.org; Mon, 13 Jun 2016 19:59:04 -0400 Received: by mail-qt0-x244.google.com with SMTP id 9so5840932qtg.1 for ; Mon, 13 Jun 2016 16:59:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=+n/2VG0lmN1oA5T78UyYlkfdyAVRm5VkRuQzFK/S6wY=; b=KhbTT5AyqRsUfUvpjQ94r+oaehrugy/Rls07VpRoECfhGI4HovdidL7jwTsjlFsmvT 71YRQ+KVcCFe7P+buMIU9xSbiNMnuPK9N7TEwEmkwbo7UzFEPDeuLPNe1TumOZBbH4XE BEKSVRIx6Cj8LiGXrm2juPE+tC1uK+xTzHgWukVgsoB3KCD+7dNL6rLPZoWhvv4tzQyJ DVMIPUBDr5SM2OQ2YR6YQssxrQx8eVWYCmh9qn42/7+mExB5SG94VWOSlUG8qg89Xfh/ /zQ9ev+1x6yoNUKiCshXpw0AP6Ox4ikwEMxT1QLVcdBy39b2ReVv2khCAfIK3nmGyaiU IeLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=+n/2VG0lmN1oA5T78UyYlkfdyAVRm5VkRuQzFK/S6wY=; b=UYOLtnNTkbvoCTo0/MsA64Cp4ACZ50fb1/3D23A7LhLABCPkTMGBjofZ5sYFopkRlI NneuQbXUR5yBnumGY3DWivzfIyTOlQJ5PYfugs06Qco0YnlbfifwRzLCi2OTw5vys4EP 2cbqqUj4/HRBJLI6CQskpbegnmZEKVFNnsIjuSM8R8CRWYAFVchjlnguI8rhGWp3m+tS 3HnsTgtr3DwgqDa9ytI0sBGsOce+rqK87ysPZGthiT045OMSUqA1/JZ9XZZqdWNWhFjV DAO8kMQKz73517iToxrIVOE1xFnyY+vJq7F6bMrFZ6U176ovShTsp23lgg5L+WZcVCCX BUCQ== X-Gm-Message-State: ALyK8tI4/ombChJ4XIns1AA+xPoEIAEAXiAd5skN9ZuDNCpDnQko4MbBm3+IOKfc/rd6NA== X-Received: by 10.200.43.195 with SMTP id n3mr17050492qtn.72.1465862344182; Mon, 13 Jun 2016 16:59:04 -0700 (PDT) Received: from bigtime.com (71-37-54-227.tukw.qwest.net. [71.37.54.227]) by smtp.gmail.com with ESMTPSA id q200sm7547234qke.31.2016.06.13.16.59.03 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 Jun 2016 16:59:03 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 13 Jun 2016 16:58:09 -0700 Message-Id: <1465862305-14090-10-git-send-email-rth@twiddle.net> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1465862305-14090-1-git-send-email-rth@twiddle.net> References: <1465862305-14090-1-git-send-email-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400d:c0d::244 Subject: [Qemu-devel] [PATCH 09/25] target-openrisc: Implement ff1 and fl1 for 64-bit X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP True, this is unused so far, but commented out is worse than actually implemented properly. Reviewed-by: Bastian Koppelmann Signed-off-by: Richard Henderson --- target-openrisc/int_helper.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/target-openrisc/int_helper.c b/target-openrisc/int_helper.c index 6482f8c..64f837c 100644 --- a/target-openrisc/int_helper.c +++ b/target-openrisc/int_helper.c @@ -26,19 +26,20 @@ target_ulong HELPER(ff1)(target_ulong x) { -/*#ifdef TARGET_OPENRISC64 - return x ? ctz64(x) + 1 : 0; -#else*/ - return x ? ctz32(x) + 1 : 0; -/*#endif*/ + if (x == 0) { + return 0; + } else if (TARGET_LONG_BITS == 64) { + return ctz64(x) + 1; + } else { + return ctz32(x) + 1; + } } target_ulong HELPER(fl1)(target_ulong x) { -/* not used yet, open it when we need or64. */ -/*#ifdef TARGET_OPENRISC64 - return 64 - clz64(x); -#else*/ - return 32 - clz32(x); -/*#endif*/ + if (TARGET_LONG_BITS == 64) { + return 64 - clz64(x); + } else { + return 32 - clz32(x); + } }