http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45434

--- Comment #8 from Adam Warner <adam at consulting dot net.nz> 2012-01-18 
07:00:44 UTC ---
Apologies for the noise. I had my machine constraints around the wrong way.
Here is the fixed version of the code:

#include <stdint.h>

uint64_t u8l(uint64_t in) {
  uint64_t out;
  asm ("movzbl %b1, %k0" : "=r" (out) : "q" (in));
  return out;
}

uint64_t u8h(uint64_t in) {
  uint64_t out;
  asm ("movzbl %h1, %k0" : "=r" (out) : "Q" (in));
  return out;
}

int main(void) {
  return 0;
}

With the X86-64 Linux ABI u8l() generates "movzbl %dil,%eax" and u8h() "mov
%rdi,%rdx; movzbl %dh,%eax" as expected.

Reply via email to