http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54231
--- Comment #2 from Thiago Macieira <thiago at kde dot org> 2012-08-11 22:33:31 UTC --- When adding the following source file to the library build: ==== #include <stdlib.h> void bzero_sse2(char *, size_t); void bzero_avx(char *, size_t); extern int avx_supported; void my_bzero(char *ptr, size_t n) { if (avx_supported) bzero_avx(ptr, n); else bzero_sse2(ptr, n); } ==== and compiling everything with -O2 -flto, GCC produces the following function: 00000000000002e0 <my_bzero>: 2e0: mov 0x200171(%rip),%rax # 200458 <my_bzero+0x200178> 2e7: mov (%rax),%eax 2e9: test %eax,%eax 2eb: jne 310 <my_bzero+0x30> 2ed: test %rsi,%rsi 2f0: vpxor %xmm0,%xmm0,%xmm0 2f4: je 30e <my_bzero+0x2e> 2f6: nopw %cs:0x0(%rax,%rax,1) 300: vmovntdq %xmm0,(%rdi) 304: add $0x10,%rdi 308: sub $0x1,%rsi 30c: jne 300 <my_bzero+0x20> 30e: repz retq 310: test %rsi,%rsi 313: je 30e <my_bzero+0x2e> 315: vpxor %xmm0,%xmm0,%xmm0 319: nopl 0x0(%rax) 320: vmovntdq %xmm0,(%rdi) 324: add $0x10,%rdi 328: sub $0x1,%rsi 32c: jne 320 <my_bzero+0x40> 32e: repz retq As can be seen, VEX-prefixed instructions were used in both cases.