From patchwork Wed Jan 11 16:31:43 2023 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: 641257 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp3348536pvb; Wed, 11 Jan 2023 08:33:16 -0800 (PST) X-Google-Smtp-Source: AMrXdXvaSSsTPO4zNRqOFKdLqDInctQntTtjBQf3KzCWci+1ZvRk2pSkOX+yaUz8isBFXOizQ7hP X-Received: by 2002:a05:7500:f83:b0:ef:b331:8cdb with SMTP id km3-20020a0575000f8300b000efb3318cdbmr3929384gab.3.1673454796606; Wed, 11 Jan 2023 08:33:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673454796; cv=none; d=google.com; s=arc-20160816; b=VRVsWBfQweyJnjCcWkDiz+LnpGhuSoqLaGSkn2OEl/PdiZkVYhia+ehEnuwVfVKo3l TDPazx4tG5dSvxZOO00kroOyhqcmmQbPXyhhg+qevOU+eS9SPvgJGZIGjc0Bq0nbuHro hBQSENLa3kS/NKUNeNj8zjarbiBQNaq9HXYulfrDdhkvkhQ4BS1st0xcvgnmCrI++7G8 18VTnkMSrCgHsySQYC3OxkFhhkrZGB+nIudqoZOvcGiRz8h6TmLKxaKkA50jLFNYBCGL XdavvA57gVyz5rzmOEYj/bOvdQVxWuWYESWoEDnitzT5sjKXVSJ0Dr+3VKOQdq4qOqkX gZXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=uVJHo1RDCZd+0bip3XyoLTSOXBE2Nvo0/rlUOGzHDIg=; b=VeK9CLZzpylyIHOxFz5Z8IcIiHdq3k/QNHpg9C1yxvIkrT+qO0XRfZVJggHJ7WMTbN vjCQQOuUPOFNN3nYqnI1CteEOpzpn+vl0Et/G89JNrvECbpuhlcp4emminAkYkELYuWu Njz+d4tMpA/fqoyJyGuHRDg3QzruuzK8xdhkmSvXOBvq6nz+mGVM5spRB0DsyQtk46zu l2xrstcN8FbvgY9ZusjgorSiglcPBcv4xFqQWtOw6wdWvIPm//x2+gYBTSuoMYbED3lY 6ScrpbP9iHFgqY+fhiPIk0vma17+zTRNedo4r9rnzB5x7BBr/DqfJ3g9AqU1zd3DStB8 PuOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Pvv21SUV; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTP id u13-20020a05620a430d00b006ff0d5b01a0si9006486qko.44.2023.01.11.08.33.16 for ; Wed, 11 Jan 2023 08:33:16 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Pvv21SUV; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pFe1F-0001Fx-Iv; Wed, 11 Jan 2023 11:32:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pFe1D-0001Fn-BG for qemu-devel@nongnu.org; Wed, 11 Jan 2023 11:32:03 -0500 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pFe1B-0006By-Od for qemu-devel@nongnu.org; Wed, 11 Jan 2023 11:32:03 -0500 Received: by mail-wr1-x42b.google.com with SMTP id w1so15631621wrt.8 for ; Wed, 11 Jan 2023 08:32:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=uVJHo1RDCZd+0bip3XyoLTSOXBE2Nvo0/rlUOGzHDIg=; b=Pvv21SUVaC83jCf0kh9CsUdXyavqI2tFaJM+ryj2mTV8yicuXA1+wXlwerBFxpyc3x 4IKuKo2/JNsR4DMn/AQYp4L7DDCDpwz82OBmJ6Wap0JV3BAqj5hk93BaTAWRQxrr8uH9 OAO2Qz0lmw58QW+QGvuCyHJUn+paEg+cPXyyyQrOcY9GdgUo+qM2rv6zBFEnz20pAdZ8 WNFsQ4opMJTNLwNoslrxR0VBR77EGcCqmUW7ImyqDQhVMsnbMzD3fqXKmTKZAwN4YaHN 6YW+rG+ShSsych9GzZtK9HKvsKCcoZkWuz7aFEMlYo4iaHMZO2iuIbPPu+76zQKhgAJl RhYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uVJHo1RDCZd+0bip3XyoLTSOXBE2Nvo0/rlUOGzHDIg=; b=Rn8wvpgJVhv4O3JZnMuPh6GpIy+sxAjglIOUJeB9gliiIFpSMyFvuyExZVaFHQZF2N nCb3K/I/LfYhKULJUC97hgvp9RcFnjqlzAD3gvSgZmQVXnmSFFv06s5y1ieQ5iM5bPUZ gb+pRhq59iV62koG6WA1x0GOUh8aANzuSFo79nikQDUM5/d5iPAIv+dGzq9rGftOKr+e WE9I75Sagd5nRgQfxIk/72HA81/a8fsKQfIOl5CJDHWyAyFRrKOt909NUFARMzoi+AM7 4vqXGUq5HJxkUqMX4MaQgUTOopNunnEKJ6P0AGL1+4zpJHSDcYlhbRBvThm94wyh2wh6 1LiQ== X-Gm-Message-State: AFqh2kpvp2Sx14JLTW+dEMdUuGfTyB3YgfLvYrl90VwvOO2ZLC9CsH6Y XPLjYwAdihM7DrLvG7Ovr4lv9gAOVW4764C6 X-Received: by 2002:a5d:468f:0:b0:2bb:e868:6a45 with SMTP id u15-20020a5d468f000000b002bbe8686a45mr8408715wrq.56.1673454720251; Wed, 11 Jan 2023 08:32:00 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id bo30-20020a056000069e00b0027a57c1a6fbsm14373946wrb.22.2023.01.11.08.31.59 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 11 Jan 2023 08:31:59 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Ryo ONODERA , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Thomas Huth , Ira Weiny , Paolo Bonzini , Kamil Rytarowski , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Reinoud Zandijk , Jonathan Cameron , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Richard Henderson Subject: [PATCH v3 2/6] qemu/bswap: Replace bswapXXs() by compiler __builtin_bswap() Date: Wed, 11 Jan 2023 17:31:43 +0100 Message-Id: <20230111163147.71761-3-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230111163147.71761-1-philmd@linaro.org> References: <20230111163147.71761-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=philmd@linaro.org; helo=mail-wr1-x42b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé --- 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 ca2b4c3f15..d2dafdc54c 100644 --- a/include/qemu/bswap.h +++ b/include/qemu/bswap.h @@ -50,29 +50,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 HOST_BIG_ENDIAN #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 /**