http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50766
Bug #: 50766 Summary: Binutils 2.22.51 rejects bmi2 pext operation with memory operands Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassig...@gcc.gnu.org ReportedBy: ll...@randombit.net This program #include <stdio.h> #include <x86intrin.h> int main() { unsigned int x = 0x23593464; unsigned int y = 0xF9494302; unsigned int z = _pext_u32(x, y); printf("%08X %08X %08X\n", x, y, z); } when compiled with gcc 4.7 without optimizations, produces a call to pext that looks like this: pext %eax, -16(%rbp), %eax which binutils 2.22.51.20111017 rejects with Error: operand size mismatch for `pext' With -O2, gcc places all operands in registers, and as will accept it. Version: $ g++-4.7.0 -v Using built-in specs. COLLECT_GCC=/usr/local/bin/g++-4.7.0 COLLECT_LTO_WRAPPER=/usr/local/gcc-4.7.0-r179617/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ../gcc-svn/configure --program-suffix=-4.7.0-r179617 --prefix=/usr/local/gcc-4.7.0-r179617 --enable-languages=c,c++ Thread model: posix gcc version 4.7.0 20111006 (experimental) (GCC) ) and using $ as --version GNU assembler (GNU Binutils) 2.22.51.20111017 Copyright 2011 Free Software Foundation, Inc. This program is free software; you may redistribute it under the terms of the GNU General Public License version 3 or later. This program has absolutely no warranty. This assembler was configured for a target of `x86_64-unknown-linux-gnu'.