mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Michal Simek <michal.simek@xilinx.com>
To: David Laight <David.Laight@ACULAB.COM>,
	'Michal Simek' <michal.simek@xilinx.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"monstr@monstr.eu" <monstr@monstr.eu>,
	"git@xilinx.com" <git@xilinx.com>
Cc: Mahesh Bodapati <mbodapat@xilinx.com>,
	Randy Dunlap <rdunlap@infradead.org>
Subject: Re: [PATCH v2 2/3] microblaze: Do loop unrolling for optimized memset implementation
Date: Mon, 28 Feb 2022 07:38:15 +0100	[thread overview]
Message-ID: <9e6f88c2-a868-71fe-227f-054bab0429d8@xilinx.com> (raw)
In-Reply-To: <a3621a76457646b58a9deef3e861d362@AcuMS.aculab.com>



On 2/25/22 22:50, David Laight wrote:
> From: Michal Simek
>> Sent: 25 February 2022 13:56
>>
>> Align implementation with memcpy and memmove where also remaining bytes are
>> copied via final switch case instead of using simple implementations which
>> loop. But this alignment has much stronger reason and definitely aligning
>> implementation is not the key point here. It is just good to have in mind
>> that the same technique is used already there.
>>
>> In GCC 10, now -ftree-loop-distribute-patterns optimization is on at O2.
>> This optimization causes GCC to convert the while loop in memset.c into a
>> call to memset.
> 
> Gah...
> That is nearly as brain dead as another compiler that would convert
> any byte copy loop (on x86) into 'rep movsb'.
> 
> If I want to call memcpy() I'll call memcpy.
> If I'm copying a few bytes I might write the loop to avoid
> the cost of the call and all the conditional tests for
> buffer length and alignment.
> 
> Don't the compiler writers have better things to do?

Not sure what you want me to say about it. It is current gcc behavior and I 
can't see the way back. I don't think doing loop unrolling here is a big deal 
for me because the same technique is used for years in memcpy and memmove.

Thanks,
Michal


  reply	other threads:[~2022-02-28  6:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-25 13:55 [PATCH v2 0/3] microblaze: Fix issues with freestanding Michal Simek
2022-02-25 13:55 ` [PATCH v2 1/3] microblaze: Use simple memset implementation from lib/string.c Michal Simek
2022-02-25 13:55 ` [PATCH v2 2/3] microblaze: Do loop unrolling for optimized memset implementation Michal Simek
2022-02-25 21:50   ` David Laight
2022-02-28  6:38     ` Michal Simek [this message]
2022-02-25 13:55 ` [PATCH v2 3/3] microblaze: Use simple memmove/memcpy implementation from lib/string.c Michal Simek
2022-04-21  8:56 ` [PATCH v2 0/3] microblaze: Fix issues with freestanding Michal Simek

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=9e6f88c2-a868-71fe-227f-054bab0429d8@xilinx.com \
    --to=michal.simek@xilinx.com \
    --cc=David.Laight@ACULAB.COM \
    --cc=git@xilinx.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mbodapat@xilinx.com \
    --cc=monstr@monstr.eu \
    --cc=rdunlap@infradead.org \
    /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

all inboxes | Powered by JetHome®