From patchwork Wed Sep 23 10:02:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 272952 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65060C4727E for ; Wed, 23 Sep 2020 10:06:59 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F32842076E for ; Wed, 23 Sep 2020 10:06:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="DpTAc5Oy" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F32842076E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:55184 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kL1fu-0004wy-4z for qemu-devel@archiver.kernel.org; Wed, 23 Sep 2020 06:06:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39288) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kL1bj-0008ED-Dg for qemu-devel@nongnu.org; Wed, 23 Sep 2020 06:02:40 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:56793) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kL1be-0001JR-Ae for qemu-devel@nongnu.org; Wed, 23 Sep 2020 06:02:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600855352; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VaJU4qce4d8kLY5vBvpzDPXaE03+xeWvm32Nm0kkdv0=; b=DpTAc5Oyg9czhwXv645EcE2ji3nrwz0Dq8mkmxvC0QYUWGGlAOzRYPWn2FX6J7SYIkUr/s z4l/jREtVGcteSUAr8PZpgHR5htXPhdQPQK61BxWJpxEpoBejhvYVAyAZdlv8QFLDV1tVr 1cE6pKDogyUhNCF+OV4kQNKWkPBGSgQ= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-260-83peldihNlCRObXJPAK-AA-1; Wed, 23 Sep 2020 06:02:29 -0400 X-MC-Unique: 83peldihNlCRObXJPAK-AA-1 Received: by mail-wr1-f69.google.com with SMTP id 33so8594733wrk.12 for ; Wed, 23 Sep 2020 03:02:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VaJU4qce4d8kLY5vBvpzDPXaE03+xeWvm32Nm0kkdv0=; b=ZfBPNERAEQCVd7L1HjggmNDjvJgkblBkNfjqEMxewzB9obnX+uE8sOiqNyHr3VbCsS G7oI5wQ/eUfHiLOL2Ow5x0iOhdYEuuFPcqCJoDNODtg6k6yEhMgf+6flSFrdmm9VZqDt anM+3DAHhceCTZ8RpfP49ezat968qoILDOfMKPlpWrD2E9s3AVXjpGH8JYI1NsokSmnZ N+zfYUgvybIm4+OU4RAmFCezyk46x8BUhmI2FSU6dI4yEOa8FMEFtEiJLfPgjkS5M0I5 PAOATFc8v9Hz8+YevwFfMciQvXW2O+cCGJG7a29IZ9ODhdmE9+KKqIGX2yTeS34o6Zz2 qDpQ== X-Gm-Message-State: AOAM532BFhZau0ql2hW/86Kivnr59YZOeq26eaRItHdaMW78XRnEkUfX N+pmyGHJbEACqo4lwjwg0jUOE0G0I0hvoU7eKqffqwPO1ikdrj6YFVYAY+Oaj5wTUIor2g8UIkq QnVAyXMPLX6zqaII= X-Received: by 2002:a5d:5307:: with SMTP id e7mr10083455wrv.215.1600855347525; Wed, 23 Sep 2020 03:02:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyErCwKgS8P5jJGkmT3fVvMkXsnbfsZMC3MQP86hUlkn2JWmNiVPlc8a9KPYjiOzhfMoa6EIA== X-Received: by 2002:a5d:5307:: with SMTP id e7mr10083433wrv.215.1600855347379; Wed, 23 Sep 2020 03:02:27 -0700 (PDT) Received: from localhost.localdomain (65.red-83-57-170.dynamicip.rima-tde.net. [83.57.170.65]) by smtp.gmail.com with ESMTPSA id t188sm8029162wmf.41.2020.09.23.03.02.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Sep 2020 03:02:26 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 1/4] qemu/bswap: Remove unused qemu_bswap_len() Date: Wed, 23 Sep 2020 12:02:17 +0200 Message-Id: <20200923100220.674903-2-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200923100220.674903-1-philmd@redhat.com> References: <20200923100220.674903-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/23 00:53:58 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Last use of qemu_bswap_len() has been removed in commit e5fd1eb05ec ("apb: add busA qdev property to PBM PCI bridge"). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- include/qemu/bswap.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/include/qemu/bswap.h b/include/qemu/bswap.h index 1d3e4c24e41..8b01c38040c 100644 --- a/include/qemu/bswap.h +++ b/include/qemu/bswap.h @@ -169,12 +169,6 @@ CPU_CONVERT(le, 16, uint16_t) CPU_CONVERT(le, 32, uint32_t) CPU_CONVERT(le, 64, uint64_t) -/* len must be one of 1, 2, 4 */ -static inline uint32_t qemu_bswap_len(uint32_t value, int len) -{ - return bswap32(value) >> (32 - 8 * len); -} - /* * Same as cpu_to_le{16,32}, except that gcc will figure the result is * a compile-time constant if you pass in a constant. So this can be From patchwork Wed Sep 23 10:02:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 272951 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 821DFC2D0A8 for ; Wed, 23 Sep 2020 10:08:58 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 306A62145D for ; Wed, 23 Sep 2020 10:08:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="OBK5gDSj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 306A62145D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:33482 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kL1hp-0007d9-3w for qemu-devel@archiver.kernel.org; Wed, 23 Sep 2020 06:08:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39316) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kL1bm-0008Eb-2d for qemu-devel@nongnu.org; Wed, 23 Sep 2020 06:02:43 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:46269) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kL1bj-0001Jn-Bh for qemu-devel@nongnu.org; Wed, 23 Sep 2020 06:02:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600855355; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/e6JgH5beo3D4jWhUD/I0gOipenUtz7n5NS7zMmoHHk=; b=OBK5gDSjMR71kt3G04EJPC8mm/WQ1NVZxDaGOsKqp99njtXcHw8Mvoa3XeOpi3grG7L5s/ Q4orLxaoIkWbHjV0vdsLTbU+vDZ2D0Zwo1YGR2m2zHfiXjlaAPxMG85RkN7QB2LpoQ87OV DMEOq7GhSOhO4XAPu8rvWsMKizrT37Q= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-514-eIZFTD_4OR2N3uLDAOOe9A-1; Wed, 23 Sep 2020 06:02:34 -0400 X-MC-Unique: eIZFTD_4OR2N3uLDAOOe9A-1 Received: by mail-wm1-f72.google.com with SMTP id c200so2031232wmd.5 for ; Wed, 23 Sep 2020 03:02:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/e6JgH5beo3D4jWhUD/I0gOipenUtz7n5NS7zMmoHHk=; b=r8ht9wrQH21KWFWsxMCTM7bEPbF6xBxkOOUEJgsKOPQBeRzylrjK7ipF/pXAI4UdMz wdWVhT3zqPTMXIUpgnOKHWIMEbPTyNlj9aJEq3Y+uaIKwf03naL+r35lmamjdO7dLsWi ht38k92/UnqFoyWqpiAVfpvz3NNzy9dmIxfoMXmvi/naDTd4k+10dyM2zeSnTjV/Kg0n +ewITsPO/0zM+OPZL0rIH5kkPSX9m5ZoNrHihewunu/eBRXD+n8OdL/qSO0gY9a6LNJJ h3NPZ1oPPT9XSgisAtViS/vKyefyAFX9RrgNwu2VKZqCZMiODyN6tibJxqyYwz+34YIl bDmg== X-Gm-Message-State: AOAM532CfPZN5TpRm8jhcynqGbl1tM+pKnQ5pWwm5JRg18QNUqZKweUx oTBAgvdVkG+159XGA3DCrOF15jB8vaEpdaVfat4o+scKVwfyvbmjrWR7MEA77DnHWZ8aay5/TPz azr/q9N+QbUhURV8= X-Received: by 2002:a7b:c151:: with SMTP id z17mr5888041wmi.53.1600855352231; Wed, 23 Sep 2020 03:02:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw6O0Qjf8oO9lpF3SbviWLdvjTkbe0E561qxviPht1e1wza+nbmlYbMMN1VHTGZHVXBxIqnsg== X-Received: by 2002:a7b:c151:: with SMTP id z17mr5888021wmi.53.1600855352023; Wed, 23 Sep 2020 03:02:32 -0700 (PDT) Received: from localhost.localdomain (65.red-83-57-170.dynamicip.rima-tde.net. [83.57.170.65]) by smtp.gmail.com with ESMTPSA id v9sm31863826wrv.35.2020.09.23.03.02.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Sep 2020 03:02:31 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 2/4] qemu/bswap: Replace bswapXX() by compiler __builtin_bswap() Date: Wed, 23 Sep 2020 12:02:18 +0200 Message-Id: <20200923100220.674903-3-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200923100220.674903-1-philmd@redhat.com> References: <20200923100220.674903-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/23 00:53:58 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Use the compiler built-in function to byte swap values, as the compiler is clever and will fold constants. Suggested-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- include/qemu/bswap.h | 30 ++++-------------------------- 1 file changed, 4 insertions(+), 26 deletions(-) diff --git a/include/qemu/bswap.h b/include/qemu/bswap.h index 8b01c38040c..d1a2f700f2a 100644 --- a/include/qemu/bswap.h +++ b/include/qemu/bswap.h @@ -27,32 +27,10 @@ static inline uint64_t bswap64(uint64_t x) { return bswap_64(x); } -# else -static inline uint16_t bswap16(uint16_t x) -{ - return (((x & 0x00ff) << 8) | - ((x & 0xff00) >> 8)); -} - -static inline uint32_t bswap32(uint32_t x) -{ - return (((x & 0x000000ffU) << 24) | - ((x & 0x0000ff00U) << 8) | - ((x & 0x00ff0000U) >> 8) | - ((x & 0xff000000U) >> 24)); -} - -static inline uint64_t bswap64(uint64_t x) -{ - return (((x & 0x00000000000000ffULL) << 56) | - ((x & 0x000000000000ff00ULL) << 40) | - ((x & 0x0000000000ff0000ULL) << 24) | - ((x & 0x00000000ff000000ULL) << 8) | - ((x & 0x000000ff00000000ULL) >> 8) | - ((x & 0x0000ff0000000000ULL) >> 24) | - ((x & 0x00ff000000000000ULL) >> 40) | - ((x & 0xff00000000000000ULL) >> 56)); -} +#else +# define bswap16(_x) __builtin_bswap16(_x) +# define bswap32(_x) __builtin_bswap32(_x) +# define bswap64(_x) __builtin_bswap64(_x) #endif /* ! CONFIG_MACHINE_BSWAP_H */ static inline void bswap16s(uint16_t *s) From patchwork Wed Sep 23 10:02:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 304629 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29405C4741F for ; Wed, 23 Sep 2020 10:08:59 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A4F462076E for ; Wed, 23 Sep 2020 10:08:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="eCnCkIVM" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A4F462076E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:33632 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kL1hp-0007gn-QH for qemu-devel@archiver.kernel.org; Wed, 23 Sep 2020 06:08:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39350) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kL1bq-0008Hm-D5 for qemu-devel@nongnu.org; Wed, 23 Sep 2020 06:02:47 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:45436) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kL1bn-0001KO-G5 for qemu-devel@nongnu.org; Wed, 23 Sep 2020 06:02:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600855362; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cT9d0kWx7W8f1InGcBfK9ss0HD7cg0vYKo4xIiLm6K4=; b=eCnCkIVMZXW6S9EMXMsEidLnTeB/tg6fkZyqU15iGNoseKjArTy5YR37ob5PGVo0EZHSQS lbWSDeZzCLGiTpGeSGB9mHMHPljNdcGTVE+EjNdFoVM3obJucJIj1YfYKT5+uOd/ZQ+4iU VBNgS//EIVOOAcnGsgFjV9WdqKEdx8w= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-337-oBVDluYIM5GXa9zahNPKEw-1; Wed, 23 Sep 2020 06:02:38 -0400 X-MC-Unique: oBVDluYIM5GXa9zahNPKEw-1 Received: by mail-wm1-f70.google.com with SMTP id m25so2042441wmi.0 for ; Wed, 23 Sep 2020 03:02:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cT9d0kWx7W8f1InGcBfK9ss0HD7cg0vYKo4xIiLm6K4=; b=GixeiOlPm1m9LdzA6EkpIe4TLKyeZIImOI7Mv3kMsbHBkn2Iy/KwxxO3l606a3PnRR jUtpPAavr70x4tQ6SgUPZVpTzJmx4vAUMqM7skR0beHHFodrTZCdHs33o9Gc2TjscW1B IqcSC6RlIIiYxkGPg8dp7xaa3T6bsjipglxsG5hKX6A/GWb+/gMDDGN1el0X7QtTbRyt eL64IqRXdR++AgUIbf2k9847A5+xi4RbgW4bKTow0TUOWGDRArXvEZM73djBPVMB7op1 1bJtyn1vrGnmWHVTmVwlXSDlShqmehuJLGoBJEVfuM0gYBAwJIhp8ryHg0TVhPDSgIfw 70yQ== X-Gm-Message-State: AOAM530ZrK2KcmNTbO0cmc6Zp/DdYxLEBLKEWR5rHpQtDOaTUv2Q6lsi yK+CEFlUBYnjFwWj0bBabyjIYGt3A/DT00Ad2KQmE8yBBvk1BwABVmlPaL2f+MD1YueprzVPDvi C1UjkCYq2ckn76Yc= X-Received: by 2002:adf:f190:: with SMTP id h16mr10400416wro.202.1600855357018; Wed, 23 Sep 2020 03:02:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwzFZSKv5EkW28efsDBlQa2LLR+DlXPzMU4i/rk6WMmnnTBcKYYiz4tEyCUpKgO4gTder7z4A== X-Received: by 2002:adf:f190:: with SMTP id h16mr10400388wro.202.1600855356754; Wed, 23 Sep 2020 03:02:36 -0700 (PDT) Received: from localhost.localdomain (65.red-83-57-170.dynamicip.rima-tde.net. [83.57.170.65]) by smtp.gmail.com with ESMTPSA id n4sm29581314wrp.61.2020.09.23.03.02.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Sep 2020 03:02:36 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 3/4] qemu/bswap: Replace bswapXXs() by compiler __builtin_bswap() Date: Wed, 23 Sep 2020 12:02:19 +0200 Message-Id: <20200923100220.674903-4-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200923100220.674903-1-philmd@redhat.com> References: <20200923100220.674903-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/22 23:02:20 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- include/qemu/bswap.h | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/include/qemu/bswap.h b/include/qemu/bswap.h index d1a2f700f2a..6875e48d617 100644 --- a/include/qemu/bswap.h +++ b/include/qemu/bswap.h @@ -35,29 +35,31 @@ static inline uint64_t bswap64(uint64_t x) static inline void bswap16s(uint16_t *s) { - *s = bswap16(*s); + *s = __builtin_bswap16(*s); } static inline void bswap32s(uint32_t *s) { - *s = bswap32(*s); + *s = __builtin_bswap32(*s); } static inline void bswap64s(uint64_t *s) { - *s = bswap64(*s); + *s = __builtin_bswap64(*s); } #if defined(HOST_WORDS_BIGENDIAN) #define be_bswap(v, size) (v) -#define le_bswap(v, size) glue(bswap, size)(v) +#define le_bswap(v, size) glue(__builtin_bswap, size)(v) #define be_bswaps(v, size) -#define le_bswaps(p, size) do { *p = glue(bswap, size)(*p); } while(0) +#define le_bswaps(p, size) \ + do { *p = glue(__builtin_bswap, size)(*p); } while (0) #else #define le_bswap(v, size) (v) -#define be_bswap(v, size) glue(bswap, size)(v) +#define be_bswap(v, size) glue(__builtin_bswap, size)(v) #define le_bswaps(v, size) -#define be_bswaps(p, size) do { *p = glue(bswap, size)(*p); } while(0) +#define be_bswaps(p, size) \ + do { *p = glue(__builtin_bswap, size)(*p); } while (0) #endif /** From patchwork Wed Sep 23 10:02:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 304630 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9010BC4727E for ; Wed, 23 Sep 2020 10:08:58 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2BA9D2076E for ; Wed, 23 Sep 2020 10:08:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="FOdFXJbq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2BA9D2076E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:33558 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kL1hp-0007ey-51 for qemu-devel@archiver.kernel.org; Wed, 23 Sep 2020 06:08:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39388) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kL1bs-0008IZ-9d for qemu-devel@nongnu.org; Wed, 23 Sep 2020 06:02:48 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:22220 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kL1bq-0001Lb-3W for qemu-devel@nongnu.org; Wed, 23 Sep 2020 06:02:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600855364; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iC4V1PEXAFDMxJmiZikknRbb4O4GLLtG0+6GroPagmU=; b=FOdFXJbqF0Ddync/tk66cSYAR85g97darBJ/dE+806i197+vZ63BtSqIhqTA4LidWIK9Bj W7tXRNt1MR2VSz0wGo++ssaSODGPocCMGhIRVpJ2qzc78l01Vf3r77EZfHz6Zfh0tfl2eV wms5u539f1PvtC0HYMLsKguH1lzBAnM= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-162-aaMKGIxzMpK25O8ef3zEfA-1; Wed, 23 Sep 2020 06:02:43 -0400 X-MC-Unique: aaMKGIxzMpK25O8ef3zEfA-1 Received: by mail-wr1-f69.google.com with SMTP id d13so2209517wrr.23 for ; Wed, 23 Sep 2020 03:02:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iC4V1PEXAFDMxJmiZikknRbb4O4GLLtG0+6GroPagmU=; b=ZhJKFyvPfaX66yZNWCRkTngbSJqimia93oCeKBChX4C/jyS83v+Lrse5dAT1Hqby1V 5gCmq9xTDTsR5oUyHiHaWNX7cjtYDxqZ9JStMwMstQgxEl0JHflUZdzpJVDU1OYk/rWw xBRmH9OJxmcEgxYigpdfXQnGlQ4PX7dQRWtviUKqfLI9OpzaandDioVPK/qwAnzcXXMj L+ryMKvTehJphhptiSEWHeE57wZgPSBxTKso7rYoJ2X5z3Lo3m0g+lLKEelwT8jhqjcF uLZlY63FFQlZglsiEs/iy5mu7Le5dbftYnHvMXppXuBdz2FlDI6gh5AEFAQCoFgFfc36 uU1Q== X-Gm-Message-State: AOAM532IeOhWwqKZT6y93UG8m/oYV+gcF5N3tKSN+C0/QK096sqTPY+t +zeXVlUPgWF3j46T6MFH4bANe6JUfgViwHokmVyin5xnpUTwFf2uj+nSQ0JVctPROokdtmsySbh 6jgFEquT58bSOKv4= X-Received: by 2002:adf:f190:: with SMTP id h16mr10400887wro.202.1600855361848; Wed, 23 Sep 2020 03:02:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzUIwPj6O+U3sHYM/lPBsqJT2haHD47XIhumTZJ21A6kuR3lVIPUaxsGQGtiVtqI625zQGZqQ== X-Received: by 2002:adf:f190:: with SMTP id h16mr10400869wro.202.1600855361707; Wed, 23 Sep 2020 03:02:41 -0700 (PDT) Received: from localhost.localdomain (65.red-83-57-170.dynamicip.rima-tde.net. [83.57.170.65]) by smtp.gmail.com with ESMTPSA id d5sm31892640wrb.28.2020.09.23.03.02.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Sep 2020 03:02:41 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 4/4] qemu/bswap: Remove dependency Date: Wed, 23 Sep 2020 12:02:20 +0200 Message-Id: <20200923100220.674903-5-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200923100220.674903-1-philmd@redhat.com> References: <20200923100220.674903-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=205.139.110.61; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/23 03:55:48 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" All our supported compilers provide the __builtin_bswap() functions. Drop the dependency. Suggested-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- configure | 13 ------------- include/qemu/bswap.h | 17 ----------------- 2 files changed, 30 deletions(-) diff --git a/configure b/configure index e8e8e984f24..bff787daea7 100755 --- a/configure +++ b/configure @@ -4886,16 +4886,6 @@ if test "$docs" != "no" ; then fi fi -# Search for bswap_32 function -byteswap_h=no -cat > $TMPC << EOF -#include -int main(void) { return bswap_32(0); } -EOF -if compile_prog "" "" ; then - byteswap_h=yes -fi - # Search for bswap32 function bswap_h=no cat > $TMPC << EOF @@ -6789,9 +6779,6 @@ fi if test "$st_atim" = "yes" ; then echo "HAVE_STRUCT_STAT_ST_ATIM=y" >> $config_host_mak fi -if test "$byteswap_h" = "yes" ; then - echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak -fi if test "$bswap_h" = "yes" ; then echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak fi diff --git a/include/qemu/bswap.h b/include/qemu/bswap.h index 6875e48d617..c192a6ad3e7 100644 --- a/include/qemu/bswap.h +++ b/include/qemu/bswap.h @@ -10,23 +10,6 @@ # include #elif defined(__HAIKU__) # include -#elif defined(CONFIG_BYTESWAP_H) -# include - -static inline uint16_t bswap16(uint16_t x) -{ - return bswap_16(x); -} - -static inline uint32_t bswap32(uint32_t x) -{ - return bswap_32(x); -} - -static inline uint64_t bswap64(uint64_t x) -{ - return bswap_64(x); -} #else # define bswap16(_x) __builtin_bswap16(_x) # define bswap32(_x) __builtin_bswap32(_x)