https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81664
--- Comment #4 from Uroš Bizjak <ubizjak at gmail dot com> --- (In reply to Daniel Fruzynski from comment #2) > So there is another problem here: for some reason both mentioned gcc > versions accepts -mmovbe and -mno-movbe options. If movbe is not supported, > gcc should complain that these options are unrecognized. -mmovbe compile flag is a different thing that "movbe" target attribute. > I also checked generated assembly code and there are no movbe instruction > there. However I noticed that gcc 4.8.5 on Redhat 7 generates different code > when -mmovbe is used - it adds extra instruction marked below with ***. Your test is flawed: - ntohl uses uint32_t, extra instruction is zero-extend to 64bit ulong. - movbe works only from/to memory. Try this test: --cut here-- #include <arpa/inet.h> #include <inttypes.h> extern uint32_t val; uint32_t __attribute__((target("movbe"))) ntohl_movbe(void) { return ntohl (val); } uint32_t __attribute__((target("no-movbe"))) ntohl_no_movbe(void) { return ntohl (val); } --cut here-- gcc -O2: ntohl_movbe: movbe val(%rip), %eax ret .cfi_endproc ntohl_no_movbe: movl val(%rip), %eax bswap %eax ret