[Bug inline-asm/64733] New: MOV instruction error when inline assembly code is used in a C function

2015-01-22 Thread aji at ti dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64733

Bug ID: 64733
   Summary: MOV instruction error when inline assembly code is
used in a C function
   Product: gcc
   Version: 4.9.2
Status: UNCONFIRMED
  Severity: major
  Priority: P3
 Component: inline-asm
  Assignee: unassigned at gcc dot gnu.org
  Reporter: aji at ti dot com

I have a simple C program that calls ASM instructions:
example.c

int example() {
asm volatile("mov X0, #0x1000"); 
asm volatile("mov X1, #0x1003"); 

};

Compiling with following gcc command:
aarch64-none-elf-gcc -march=armv8-a -mtune=cortex-a53 -D DEBUG -c -DGCC
-falign-functions=16 -falign-jumps=8 -falign-loops=8 -fomit-frame-pointer
-funroll-loops -g -D AARCH64 example.c -o example.o

I get this error:
tmp/cctdobg6.s: Assembler messages:
/tmp/cctdobg6.s:22: Error: immediate cannot be moved by a single instruction


[Bug inline-asm/64733] MOV instruction error when inline assembly code is used in a C function

2015-01-22 Thread aji at ti dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64733

--- Comment #2 from aji at ti dot com ---
The issue is with this line of code:
asm volatile("mov X1, #0x1003");

If I modify the mov instruction to take a variable input it works.

val = 0x1003;
asm volatile("mov X1, %0":"=r"(val));

Just want to understand why is this?