From patchwork Tue Mar 19 12:47:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Palmer Dabbelt X-Patchwork-Id: 1058395 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=sifive.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=sifive.com header.i=@sifive.com header.b="ZyXztxiq"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44Nttm1SnGz9s5c for ; Wed, 20 Mar 2019 00:19:28 +1100 (AEDT) Received: from localhost ([127.0.0.1]:57307 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6EeM-0006rX-2U for incoming@patchwork.ozlabs.org; Tue, 19 Mar 2019 09:19:26 -0400 Received: from eggs.gnu.org ([209.51.188.92]:45163) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6EUE-00078U-NA for qemu-devel@nongnu.org; Tue, 19 Mar 2019 09:09:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h6EGH-0004fh-Id for qemu-devel@nongnu.org; Tue, 19 Mar 2019 08:54:34 -0400 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]:33482) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h6EGH-0004dt-7g for qemu-devel@nongnu.org; Tue, 19 Mar 2019 08:54:33 -0400 Received: by mail-pg1-x542.google.com with SMTP id b12so84442pgk.0 for ; Tue, 19 Mar 2019 05:54:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding:cc:from:to; bh=nbai/EUTYvan1AteNdXSS991xRfK72jOZCM/uUlWSQg=; b=ZyXztxiqoCzVMJL4u8w3aTleH3w744V5e9cPwfY+9buBz5Us+7cwshmFbAYDkRMsRt P8RldsRo6YzJdKZtDsgtBn8ljPIgteRQrNi8iRu7bV3lbVWAk/p6sGPknVxjSrGS/tE9 VkHvP8bbN/brmO6OCPebu17mkxUdiEcfKbgZvo1+zLiMx+RfOEYTXIUErJzDU9euYuDE 4gz2p0smPo0OUOY7SC+VZ4y2tdZLzsQ7+V6+HAj9Iff1vj8li7a3qAM4vL21xOR1gPNO 80AfRFBJLL8gh6S2TM+p71ekf+s6DcAwsxXAZSNgcXB8sTsa9/gkpYdEyohuFdvoZN5A kGvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:cc:from:to; bh=nbai/EUTYvan1AteNdXSS991xRfK72jOZCM/uUlWSQg=; b=J1ud2mpg4ePOSwEHHB9SfY15kCun1LJqVxhMxN02f/sqTQaj4vMY/cakhhI6FL6EwG 77DOiudVVnJhRxhWiHJGTPmwGSEV6T+eLw/k7zukyYzidaTh6F02AIO/4SxqI1r3s2Pi DTzFtFYzPyUMFcT8GTjt46QFAe3px6DqID78+fyN6aotggqE6ueD+tBmAv8yf5a2zOyG g1/0sY/5XU8HAOXtL7DPKUg5K+K739ZJJ1c25Mt9+JbGFJdjx+I1IBIVHgpLADyNMvwt xNpKCb4ZdlsiLHagFB9OZ6/jpb+hUn1h5Yqz0/OKm28Y3RlREZ0OOIhyDSpC1bMl3bOH 903w== X-Gm-Message-State: APjAAAWudGt1OJbYFhC2G1YZP7VUcRNnUR/0aTfiBtsE4XzmZxWdkED1 qW06B2i0ALUULyw/JpyaF7T4FoW4uiX0CYxM X-Google-Smtp-Source: APXvYqwer7SGRvea+dWbxuedcbtO/w986KQZgQDyFmgQq5vcsdsLq8mZS4ymljlFc8FBVwMO3zcHKw== X-Received: by 2002:a17:902:8693:: with SMTP id g19mr2392224plo.157.1553000072235; Tue, 19 Mar 2019 05:54:32 -0700 (PDT) Received: from localhost (2001-b011-7001-1cad-363a-ebbe-dac8-3f4c.dynamic-ip6.hinet.net. [2001:b011:7001:1cad:363a:ebbe:dac8:3f4c]) by smtp.gmail.com with ESMTPSA id j12sm9476997pfa.33.2019.03.19.05.54.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Mar 2019 05:54:31 -0700 (PDT) Date: Tue, 19 Mar 2019 05:47:51 -0700 Message-Id: <20190319124803.13826-8-palmer@sifive.com> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20190319124803.13826-1-palmer@sifive.com> References: <20190319124803.13826-1-palmer@sifive.com> MIME-Version: 1.0 From: Palmer Dabbelt To: Peter Maydell X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::542 Subject: [Qemu-devel] [PULL 07/19] RISC-V: Replace __builtin_popcount with ctpop8 in PLIC 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: , Cc: qemu-riscv@nongnu.org, Sagar Karandikar , Bastian Koppelmann , Palmer Dabbelt , qemu-devel@nongnu.org, Michael Clark , Alistair Francis Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Michael Clark The mode variable only uses the lower 4-bits (M,H,S,U) so replace the GCC specific __builtin_popcount with ctpop8. Cc: Palmer Dabbelt Cc: Sagar Karandikar Cc: Bastian Koppelmann Cc: Alistair Francis Signed-off-by: Michael Clark Signed-off-by: Alistair Francis Signed-off-by: Palmer Dabbelt --- hw/riscv/sifive_plic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/riscv/sifive_plic.c b/hw/riscv/sifive_plic.c index d12ec3fc9a54..b859f919a71d 100644 --- a/hw/riscv/sifive_plic.c +++ b/hw/riscv/sifive_plic.c @@ -383,7 +383,7 @@ static void parse_hart_config(SiFivePLICState *plic) p = plic->hart_config; while ((c = *p++)) { if (c == ',') { - addrid += __builtin_popcount(modes); + addrid += ctpop8(modes); modes = 0; hartid++; } else { @@ -397,7 +397,7 @@ static void parse_hart_config(SiFivePLICState *plic) } } if (modes) { - addrid += __builtin_popcount(modes); + addrid += ctpop8(modes); } hartid++;