When compiles below testcase with gcc -masm=intel -O2 --cut here-- int test(){ long *ptr = (long*)0xFFFF800000000000;
*ptr = -1; return 0; } --cut here-- movabs is incorrectly translated into "mov [rax], -1", and causes compile error "Error: ambiguous operand size for `mov' ". It should be "mov QWORD PTR [rax], -1" Bootstrap passed. Regression tested on x86_64-unknown-linux-gnu (pc). 2013-08-10 Perez Read <netfirew...@gmail.com> * config/i386/i386.md (*movabs<mode>_1) : Add <ptrsize> PTR before operand 0 for intel asm alternative. * testsuite/gcc.target/i386/movabs-1.c : New test.
Index: gcc/config/i386/i386.md =================================================================== --- gcc/config/i386/i386.md (revision 201646) +++ gcc/config/i386/i386.md (working copy) @@ -2255,7 +2255,7 @@ "TARGET_LP64 && ix86_check_movabs (insn, 0)" "@ movabs{<imodesuffix>}\t{%1, %P0|[%P0], %1} - mov{<imodesuffix>}\t{%1, %a0|%a0, %1}" + mov{<imodesuffix>}\t{%1, %a0|<iptrsize> PTR %a0, %1}" [(set_attr "type" "imov") (set_attr "modrm" "0,*") (set_attr "length_address" "8,0") Index: gcc/testsuite/gcc.target/i386/movabs-1.c =================================================================== --- gcc/testsuite/gcc.target/i386/movabs-1.c (revision 0) +++ gcc/testsuite/gcc.target/i386/movabs-1.c (working copy) @@ -0,0 +1,10 @@ +/* { dg-do assemble } */ +/* { dg-options "-O2 -masm=intel" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target masm_intel } */ + +void +foo (void) +{ + *(volatile long*)0xFFFF800000000000 = -1; +}