[LLVMdev] problem with sgt's on Sparc machine
Christine Cheng
clcheng at stanford.edu
Thu Sep 15 11:06:25 PDT 2011
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.
Best,
Christine
On Thu, Sep 15, 2011 at 10:20 AM, Duncan Sands <baldrick at free.fr> wrote:
> Hi,
>
> > target datalayout =
> >
> "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32"
> > 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.
>
> >
> > @P = global i32 1
> > @dP = global i32 1
> >
> > @.str = private constant [4 x i8] c"%d\0A\00", align 1
> >
> > define i32 @main() nounwind {
> >
> > entry:
> > %. = load i32* @P, align 4
> > %t1 = tail call i32 (i8*, ...)* @printf(i8* noalias getelementptr
> inbounds
> > ([4 x i8]* @.str, i32 0, i32 0), i32 %. ) nounwind
> > %d. = load i32* @dP, align 4
> > %t2 = tail call i32 (i8*, ...)* @printf(i8* noalias getelementptr
> inbounds
> > ([4 x i8]* @.str, i32 0, i32 0), i32 %d. ) nounwind
> > %0 = icmp sgt i32 %., 0
> > %1 = tail call i32 (i8*, ...)* @printf(i8* noalias getelementptr
> inbounds ([4
> > x i8]* @.str, i32 0, i32 0), i1 %0 ) nounwind
> > %2 = icmp sgt i32 %d., 0
> > %3 = tail call i32 (i8*, ...)* @printf(i8* noalias getelementptr
> inbounds
> > ([4 x i8]* @.str, i32 0, i32 0), i1 %2 ) nounwind
> > %t3 = icmp eq i32 %d., %d.
> > %t4 = tail call i32 (i8*, ...)* @printf(i8* noalias getelementptr
> inbounds
> > ([4 x i8]* @.str, i32 0, i32 0), i1 %t3 ) nounwind
> > %4 = icmp sgt i32 1, 0
> > %5 = icmp sgt i32 1, 0
> > %6 = tail call i32 (i8*, ...)* @printf(i8* noalias getelementptr
> inbounds
> > ([4 x i8]* @.str, i32 0, i32 0), i1 %4 ) nounwind
> > %7 = tail call i32 (i8*, ...)* @printf(i8* noalias getelementptr
> inbounds
> > ([4 x i8]* @.str, i32 0, i32 0), i1 %5 ) nounwind
> > ret i32 undef
> > }
> >
> > declare i32 @printf(i8* nocapture, ...) nounwind
> >
> -------------------------------------------------------------------------------------------------------------------
> >
> > On Sparc I get:
> > 1
> > 1
> > 0
> > 0
> > 1
> > 1
> > 1
> >
> > On X86 I get all 1's which I believe is correct.
> >
> > I used the following command to compile on sparc:
> > llc -march=sparc llvm_print.bc -o llvm_print.s ( on a x86 machine)
> > /usr/sfw/bin/gcc -mcpu=v9 -mtune=v9 llvm_print.s -o llvm_print (on
> sparc)
> >
> >
> > Could anyone give me some clue about what's going on? Is 'sgt' not
> working for
> > loaded values?
> >
> > Thanks,
> >
> > Christine
> >
> >
> >
> > _______________________________________________
> > LLVM Developers mailing list
> > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110915/79bde85e/attachment.html>
More information about the llvm-dev
mailing list