problem with sgt's on Sparc machine


I compiled the following code on a Sparc machine, basically it produce different results than a X86 machine.


target datalayout =
target triple = "i386-pc-linux-gnu"

if you are using this target data layout and triple on a Sparc machine,
I'm not surprised you get wrong results.

Ciao, Duncan.

Hi Duncan,

Thanks for the reply! There is no LLVM on the Sparc machine so I cannot compile my code there into .s file. How shall I modify the target data layout and triple so it works on Sparc? Basically I got these from compiling C code using llvm-gcc.


You can use clang for that:
clang -ccc-host-triple sparc-unknown-linux -ccc-clang-archs sparc ...

Hi guys,

Thanks for the input. However, it seems that the code still produces the wrong output on a Sparc machine.

My current llvm_print.bc code is:



  What is your LLVM version? Also, can you attach the assembly generated?


Hi Venkatraman,

I am using LLVM 2.8 and llvm-gcc 4.2.

The assembly files are attached. In the assembly file, the erroneous result is associated with ‘subcc’, while the correct ones are associated with ‘or’.

Thanks a lot!


llvm_print.bc (1.41 KB)

llvm_print.s (1.43 KB)

Hi Christine,

I am using LLVM 2.8 and llvm-gcc 4.2.

Could you please try svn top-of-tree? Clang is also a better choice here.

I can't reproduce this problem with the recent svn trunk. LLVM 2.9 has
lots of fixes for Sparc back-end. So, please at least try with


Hi guys,

Thanks for all the input! Let me try llvm 2.9 first.

Have a nice weekend.