On Mon, 09 Nov 2015 18:58:34 +0100 Greg Kurz <gk...@linux.vnet.ibm.com> wrote:
> When adding cross-endian support, we introduced the TARGET_IS_BIENDIAN macro > and the virtio_access_is_big_endian() helper to have a branchless fast path > in the virtio memory accessors for targets that don't switch endian. > > This was considered as a strong requirement at the time. > > Now we have added a runtime check for virtio 1.0, which ruins the benefit > of the virtio_access_is_big_endian() helper for always little-endian targets. > > With this patch, fixed little-endian targets stop checking for virtio 1.0, > since the result is little-endian in all cases. So always-LE gets optimized, while always-BE and bi-endian stay the same? (Is there a measurable impact?) > The helper also gets renamed > so it is clear it is optimized for fast paths. Even if it isn't actually 'fast' on anything other than fixed-LE? > > Signed-off-by: Greg Kurz <gk...@linux.vnet.ibm.com> > --- > include/hw/virtio/virtio-access.h | 43 > ++++++++++++++++++++----------------- > 1 file changed, 23 insertions(+), 20 deletions(-)