Re:A bug story: data alignment in C on x86 (2016)
by Karliss on Tuesday September 04, 2018 @06:46PM
(#17913512)
When was the last time you checked that msvc and icc always use a function call form memcpy? At least the latest versions of msvc and icc can replace memcpy with appropriate move instruction. You can see here https://godbolt.org/z/BX0Wya that msvc 2017, msvc 2015, icc 18.0 and even icc 13.0.1 used a mov instruction for memcpy to uint32 instead of function call.
[ Parent
| on HN ]
Re:A bug story: data alignment in C on x86 (2016)
by userbinator on Tuesday September 04, 2018 @10:36PM
(#17914650)
I believe even MSVC6 will inline memcpy() (and a few others), but it has to be enabled with one of the optimisation switches (intrinsic functions.)
Re:A bug story: data alignment in C on x86 (2016)
by Asooka on Wednesday September 05, 2018 @05:01AM
(#17916247)
Ok, I stand corrected. However, at lower optimisation levels they do not inline memcpy calls, which might matter for you. It's never fun if the debug build is 10 times slower in a hot function...