[LLVMdev] llvm-gcc handles inline assembly incorrectly on PowerPC

陳韋任 chenwj at iis.sinica.edu.tw
Wed Mar 23 22:57:38 PDT 2011


Hi, folks

  I don't know if this is a bug or not? But the way how llvm-gcc on ppc
handles inline assembly is different from the one on x86.

  For example, here is the example code:

-----------------------------------------
register int *a asm("r10");

int main() {
  *a = 1;
  return 0;
}
-----------------------------------------

  llvm-gcc on x86 produces LLVM IR belows,

-----------------------------------------
define i32 @main() nounwind {
entry:
  %0 = tail call i32* asm "", "={r10}"() nounwind ; <i32*> [#uses=1]
  store i32 1, i32* %0, align 4
  ret i32 undef
}
-----------------------------------------

  But on ppc, llvm-gcc misses "r" in "r10",

%0 = tail call i32* asm "", "={10}"() nounwind ; <i32*> [#uses=1]
                              ^^^^
                            missing "r"

  Any idea? Thanks.  

Regards,
chenwj

-- 
Wei-Ren Chen (陳韋任)
Parallel Processing Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667




More information about the llvm-dev mailing list