From: Eric Blake <eblake@redhat.com>
To: "Paolo Bonzini" <pbonzini@redhat.com>,
"Thomas Huth" <thuth@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@gmail.com>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>
Cc: Peter Maydell <peter.maydell@linaro.org>,
Peter Crosthwaite <crosthwaite.peter@gmail.com>,
qemu trival <qemu-trivial@nongnu.org>,
Michael Tokarev <mjt@tls.msk.ru>, QEMU <qemu-devel@nongnu.org>,
Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-trivial] [Qemu-devel] [PATCH 19/29] disas: use QEMU_IS_ALIGNED macro
Date: Mon, 24 Jul 2017 07:16:41 -0500 [thread overview]
Message-ID: <90438d63-2cfc-ad79-a490-7a50e40fe53a@redhat.com> (raw)
In-Reply-To: <a49428cc-88e9-dbd8-3d2f-207acbef68f9@redhat.com>
[-- Attachment #1.1: Type: text/plain, Size: 1082 bytes --]
On 07/23/2017 09:52 AM, Paolo Bonzini wrote:
>
> But I agree that QEMU_IS_ALIGNED looks weird here. I think it should
> mostly be used when the argument is a pointer, to hide the cast. Uses
> for non-pointer arguments should be decided on a one-by-one basis; "is
> the first argument an address" is definitely a good thing to consider.
> Another might be "is the second argument a variable", because "i % n ==
> 0" is less efficient than "(i & (n - 1)) == 0".
How often is QEMU_IS_ALIGNED used on non-power-of-2? Would it be worth
rewriting it into bit-wise ops, at the expense of declaring that any
code aligning to other values must open-code their own %? Can we have
the compiler help us ensure that the second argument is a power-of-2?
Conversely, if the compiler is given a constant for the second argument,
and is not optimizing modulo power of two into bitwise ops (at least at
CFLAGS=-O2), then that's a compiler bug.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 619 bytes --]
next prev parent reply other threads:[~2017-07-24 12:16 UTC|newest]
Thread overview: 69+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-18 6:09 [Qemu-trivial] [PATCH 00/29] coccinelle script to enforce qemu/osdep.h macros usage Philippe Mathieu-Daudé
2017-07-18 6:09 ` [Qemu-trivial] [PATCH 01/29] coccinelle: add a " Philippe Mathieu-Daudé
2017-07-18 15:18 ` Eric Blake
2017-07-18 6:09 ` [Qemu-trivial] [PATCH 02/29] pci: remove superfluous parenthesis Philippe Mathieu-Daudé
2017-07-19 0:16 ` [Qemu-trivial] [Qemu-devel] " Richard Henderson
2017-07-18 6:09 ` [Qemu-trivial] [PATCH 03/29] qemu-img: use QEMU_IS_ALIGNED macro Philippe Mathieu-Daudé
2017-07-18 15:19 ` Eric Blake
2017-07-18 6:09 ` [Qemu-trivial] [PATCH 04/29] scsi-disk: " Philippe Mathieu-Daudé
2017-07-18 6:09 ` [Qemu-trivial] [PATCH 05/29] block: " Philippe Mathieu-Daudé
2017-07-18 9:59 ` Juan Quintela
2017-07-18 15:25 ` Eric Blake
2017-07-18 6:09 ` [Qemu-trivial] [PATCH 06/29] migration/block: " Philippe Mathieu-Daudé
2017-07-18 9:58 ` Juan Quintela
2017-07-18 11:19 ` [Qemu-trivial] [Qemu-devel] " Alex Bennée
2017-07-18 6:09 ` [Qemu-trivial] [PATCH 07/29] ds1338: " Philippe Mathieu-Daudé
2017-07-18 10:23 ` Alastair D'Silva
2017-07-18 13:23 ` Philippe Mathieu-Daudé
2017-07-18 6:09 ` [Qemu-trivial] [PATCH 08/29] ui: " Philippe Mathieu-Daudé
2017-07-18 6:09 ` [Qemu-trivial] [PATCH 09/29] net: " Philippe Mathieu-Daudé
2017-07-18 17:51 ` Eric Blake
2017-07-18 6:09 ` [Qemu-trivial] [PATCH 10/29] net/rocker: " Philippe Mathieu-Daudé
2017-07-18 17:51 ` Eric Blake
2017-07-21 16:23 ` Philippe Mathieu-Daudé
2017-07-18 6:09 ` [Qemu-trivial] [PATCH 11/29] s390x/sclp: " Philippe Mathieu-Daudé
2017-07-18 9:58 ` Cornelia Huck
2017-07-18 10:03 ` Cornelia Huck
2017-07-18 6:09 ` [Qemu-trivial] [PATCH 12/29] sm501: " Philippe Mathieu-Daudé
2017-07-18 6:09 ` [Qemu-trivial] [PATCH 13/29] tcg: " Philippe Mathieu-Daudé
2017-07-18 6:09 ` [Qemu-trivial] [PATCH 14/29] cris: " Philippe Mathieu-Daudé
2017-07-18 6:09 ` [Qemu-trivial] [PATCH 16/29] lm32: " Philippe Mathieu-Daudé
2017-07-18 11:42 ` Michael Walle
2017-07-18 14:37 ` [Qemu-trivial] [Qemu-devel] " Thomas Huth
2017-07-21 16:29 ` Philippe Mathieu-Daudé
2017-07-18 6:09 ` [Qemu-trivial] [PATCH 18/29] nios2: " Philippe Mathieu-Daudé
2017-07-18 6:09 ` [Qemu-trivial] [PATCH 19/29] disas: " Philippe Mathieu-Daudé
2017-07-18 11:07 ` [Qemu-trivial] [Qemu-devel] " Marc-André Lureau
2017-07-18 14:43 ` Thomas Huth
2017-07-23 14:52 ` Paolo Bonzini
2017-07-24 12:16 ` Eric Blake [this message]
2017-07-18 11:09 ` [Qemu-trivial] " Michael Tokarev
2017-07-18 6:09 ` [Qemu-trivial] [PATCH 20/29] disas: use ARRAY_SIZE macro Philippe Mathieu-Daudé
2017-07-18 6:49 ` David Gibson
2017-07-18 10:55 ` [Qemu-trivial] [Qemu-devel] " Marc-André Lureau
2017-07-18 6:09 ` [Qemu-trivial] [PATCH 21/29] qga: " Philippe Mathieu-Daudé
2017-07-18 11:29 ` [Qemu-trivial] [Qemu-devel] " Marc-André Lureau
2017-07-18 6:09 ` [Qemu-trivial] [PATCH 22/29] vmsvga: " Philippe Mathieu-Daudé
2017-07-18 11:28 ` [Qemu-trivial] [Qemu-devel] " Marc-André Lureau
2017-07-18 6:09 ` [Qemu-trivial] [PATCH 23/29] async: " Philippe Mathieu-Daudé
2017-07-18 10:54 ` [Qemu-trivial] [Qemu-devel] " Marc-André Lureau
2017-07-18 6:10 ` [Qemu-trivial] [PATCH 24/29] tests/acpi: " Philippe Mathieu-Daudé
2017-07-18 6:10 ` [Qemu-trivial] [PATCH 25/29] libqos: " Philippe Mathieu-Daudé
2017-07-18 11:00 ` [Qemu-trivial] [Qemu-devel] " Marc-André Lureau
2017-07-18 11:58 ` [Qemu-trivial] " Laurent Vivier
2017-07-18 13:36 ` Philippe Mathieu-Daudé
2017-07-18 6:10 ` [Qemu-trivial] [PATCH 26/29] tests/tcg: " Philippe Mathieu-Daudé
2017-07-18 10:56 ` [Qemu-trivial] [Qemu-devel] " Marc-André Lureau
2017-07-18 11:16 ` Alex Bennée
2017-07-18 11:24 ` Marc-André Lureau
2017-07-18 13:52 ` Alex Bennée
2017-07-18 13:41 ` Philippe Mathieu-Daudé
2017-07-18 6:10 ` [Qemu-trivial] [PATCH 27/29] tests/hbitmap: " Philippe Mathieu-Daudé
2017-07-18 10:52 ` [Qemu-trivial] [Qemu-devel] " Marc-André Lureau
2017-07-18 15:36 ` John Snow
2017-07-18 6:10 ` [Qemu-trivial] [PATCH 28/29] tests/qapi: use QEMU_IS_ALIGNED macro Philippe Mathieu-Daudé
2017-07-18 10:53 ` [Qemu-trivial] [Qemu-devel] " Marc-André Lureau
2017-07-18 6:10 ` [Qemu-trivial] [PATCH 29/29] tests/qapi: use ARRAY_SIZE macro Philippe Mathieu-Daudé
2017-07-18 10:52 ` [Qemu-trivial] [Qemu-devel] " Marc-André Lureau
[not found] ` <20170718061005.29518-16-f4bug@amsat.org>
2017-07-18 11:08 ` [Qemu-trivial] [Qemu-devel] [PATCH 15/29] microblaze: use QEMU_IS_ALIGNED macro Marc-André Lureau
2017-07-18 14:46 ` Thomas Huth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=90438d63-2cfc-ad79-a490-7a50e40fe53a@redhat.com \
--to=eblake@redhat.com \
--cc=crosthwaite.peter@gmail.com \
--cc=f4bug@amsat.org \
--cc=marcandre.lureau@gmail.com \
--cc=mjt@tls.msk.ru \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
--cc=rth@twiddle.net \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).