On Wed, Nov 19, 2014 at 05:35:51PM +0600, Yerden Zhumabekov wrote: > > 19.11.2014 16:16, Bruce Richardson ?????: > > On Tue, Nov 18, 2014 at 04:36:24PM -0500, Neil Horman wrote: > >> an alternate option would be to not use the intrinsic, and craft some > >> explicit > >> __asm__ statement that executes the right sse42 instructions. That way > >> the asm > >> is directly emitted, without requiring the -msse42 flag at all, and it > >> will just > >> work in all the files that call it. > >> > > I really don't like that approach. I think using intrinsics is much more > > maintainable. > > > > static inline uint32_t > crc32_sse42_u32(uint32_t data, uint32_t init_val) > { > /*??__asm__ volatile( > ????????????"crc32l %[data], %[init_val];" > ????????????: [init_val] "+r" (init_val) > ????????????: [data] "rm" (data)); > ????return init_val;*/ > > But wait, will __builtin_ia32_crc32si and __builtin_ia32_crc32di > functions do the trick? ICC has them? If builtins work on both icc and gcc, yes, that would be a solution as it creates non sse instructions when the target cpu doesn't support it.
> What about prototyping functions and extracting their bodies to separate > module? Does it break anything? > That would be a variant on the asm inline idea, but yes, I think that would work too Neil > -- > Sincerely, > > Yerden Zhumabekov > State Technical Service > Astana, KZ > >