From: David Laight <David.Laight@ACULAB.COM>
To: 'Dave Rodgman' <dave.rodgman@arm.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>
Cc: "herbert@gondor.apana.org.au" <herbert@gondor.apana.org.au>,
"davem@davemloft.net" <davem@davemloft.net>,
Matt Sealey <Matt.Sealey@arm.com>,
"nitingupta910@gmail.com" <nitingupta910@gmail.com>,
"markus@oberhumer.com" <markus@oberhumer.com>,
"minchan@kernel.org" <minchan@kernel.org>,
"sergey.senozhatsky.work@gmail.com"
<sergey.senozhatsky.work@gmail.com>,
"sonnyrao@google.com" <sonnyrao@google.com>,
"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
nd <nd@arm.com>
Subject: RE: [PATCH 2/8] lib/lzo: clean-up by introducing COPY16
Date: Fri, 30 Nov 2018 12:27:58 +0000 [thread overview]
Message-ID: <ccb719dd52354cfab8def75689d675af@AcuMS.aculab.com> (raw)
In-Reply-To: <20181130114715.27523-3-dave.rodgman@arm.com>
From: Dave Rodgman
> Sent: 30 November 2018 11:48
> From: Matt Sealey <matt.sealey@arm.com>
>
> Most compilers should be able to merge adjacent loads/stores of sizes
> which are less than but effect a multiple of a machine word size (in
> effect a memcpy() of a constant amount). However the semantics of the
> macro are that it just does the copy, the pointer increment is in the
> code, hence we see
>
> *a = *b
> a += 8
> b += 8
> *a = *b
> a += 8
> b += 8
>
> This introduces a dependency between the two groups of statements which
> seems to defeat said compiler optimizers and generate some very strange
> sequences of addition and subtraction of address offsets (i.e. it is
> overcomplicated).
>
> Since COPY8 is only ever used to copy amounts of 16 bytes (in pairs),
> just define COPY16 as COPY8,COPY8. We leave the definition to preserve
> the need to do unaligned accesses to machine-sized words per the
> original code intent, we just don't use it in the code proper.
>
> COPY16 then gives us code like:
>
> *a = *b
> *(a+8) = *(b+8)
> a += 16
> b += 16
You probably actually want:
t1 = *b;
t2 = *(b+8);
*a = t1;
*(a+8) = t2;
a += 16;
b += 16;
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
next prev parent reply other threads:[~2018-11-30 12:27 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-30 11:47 [PATCH v3 0/7] lib/lzo: performance improvements Dave Rodgman
2018-11-30 11:47 ` [PATCH 1/8] lib/lzo: tidy-up ifdefs Dave Rodgman
2018-11-30 11:47 ` [PATCH 2/8] lib/lzo: clean-up by introducing COPY16 Dave Rodgman
2018-11-30 12:27 ` David Laight [this message]
2018-11-30 11:47 ` [PATCH 3/8] lib/lzo: enable 64-bit CTZ on Arm Dave Rodgman
2018-11-30 11:47 ` [PATCH 4/8] lib/lzo: 64-bit CTZ on arm64 Dave Rodgman
2018-11-30 11:47 ` [PATCH 5/8] lib/lzo: fast 8-byte copy " Dave Rodgman
2018-11-30 11:47 ` [PATCH 6/8] lib/lzo: implement run-length encoding Dave Rodgman
2018-11-30 11:47 ` [PATCH 7/8] lib/lzo: separate lzo-rle from lzo Dave Rodgman
2018-11-30 11:47 ` [PATCH 8/8] zram: default to lzo-rle instead of lzo Dave Rodgman
2018-11-30 14:26 [PATCH v4 0/7] lib/lzo: performance improvements Dave Rodgman
2018-11-30 14:26 ` [PATCH 2/8] lib/lzo: clean-up by introducing COPY16 Dave Rodgman
2018-12-06 15:56 ` Markus F.X.J. Oberhumer
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=ccb719dd52354cfab8def75689d675af@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=Matt.Sealey@arm.com \
--cc=akpm@linux-foundation.org \
--cc=dave.rodgman@arm.com \
--cc=davem@davemloft.net \
--cc=gregkh@linuxfoundation.org \
--cc=herbert@gondor.apana.org.au \
--cc=linux-kernel@vger.kernel.org \
--cc=markus@oberhumer.com \
--cc=minchan@kernel.org \
--cc=nd@arm.com \
--cc=nitingupta910@gmail.com \
--cc=sergey.senozhatsky.work@gmail.com \
--cc=sonnyrao@google.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
Powered by JetHome