Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1675396
| From | Rasmus Villemoes <linux@rasmusvillemoes.dk> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 2/3] Turn bitmap_set and bitmap_clear into memset when possible |
| Date | 2017-06-27 10:00 +0200 |
| Message-ID | <tWTzJ-5PY-35@gated-at.bofh.it> (permalink) |
| References | <tPK8a-7Mn-21@gated-at.bofh.it> <tPK8a-7Mn-19@gated-at.bofh.it> <tPQwW-3ya-31@gated-at.bofh.it> <tWSNj-5uf-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
> It's actually slightly less efficient in the caller (although obviously > memset() is going to execute faster than bitmap_set()). Partly because > x86 made some odd choices about the behaviour of an 8-bit move instruction > (it leaves the upper 24 bits intact, rather than zeroing them, so gcc > has to use a 32-bit move instruction to put 0xff into the second argument > to memset()), Heh, I thought gcc knew and made full use of the semantics of memset, so that only the low byte matters. I suppose there might be architectures where passing -1 is slightly cheaper (at least in code size) than 255... [quick checking] indeed, on x86_64, there's no change in the generated code, but on 32 bit, gcc ends up doing 6a ff push $0xffffffff instead of 68 ff 00 00 00 push $0xff
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: [PATCH 2/3] Turn bitmap_set and bitmap_clear into memset when possible Matthew Wilcox <willy@infradead.org> - 2017-06-27 09:10 +0200 Re: [PATCH 2/3] Turn bitmap_set and bitmap_clear into memset when possible Rasmus Villemoes <linux@rasmusvillemoes.dk> - 2017-06-27 10:00 +0200
csiph-web