Hi Venkatraman,<br><br>I am using LLVM 2.8 and llvm-gcc 4.2. <br><br>The assembly files are attached. In the assembly file, the erroneous result is associated with 'subcc', while the correct ones are associated with 'or'.<br>
<br>Thanks a lot!<br><br>Christine<br><br><div class="gmail_quote">On Fri, Sep 16, 2011 at 2:29 PM, Venkatraman Govindaraju <span dir="ltr"><<a href="mailto:venkatra@cs.wisc.edu">venkatra@cs.wisc.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hello,<br>
<br>
What is your LLVM version? Also, can you attach the assembly generated?<br>
<br>
Thanks,<br>
Venkatraman<br>
<br>
On Thu, Sep 15, 2011 at 5:20 PM, Bruno Cardoso Lopes<br>
<div class="im"><<a href="mailto:bruno.cardoso@gmail.com">bruno.cardoso@gmail.com</a>> wrote:<br>
</div><div><div></div><div class="h5">> Hi,<br>
><br>
> On Thu, Sep 15, 2011 at 3:15 PM, Christine Cheng <<a href="mailto:clcheng@stanford.edu">clcheng@stanford.edu</a>> wrote:<br>
>> Hi guys,<br>
>><br>
>> Thanks for the input. However, it seems that the code still produces the<br>
>> wrong output on a Sparc machine.<br>
>><br>
>> My current llvm_print.bc code is:<br>
>> --------------------------------------------------------------------------------------------------<br>
>> ; MduleID = '<stdin>'<br>
>> target datalayout =<br>
>> "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-n32"<br>
>> target triple = "sparc-unknown-linux"<br>
>><br>
>> @P = global i32 1<br>
>> @dP = global i32 1<br>
>><br>
>> @.str = private constant [4 x i8] c"%d\0A\00", align 1<br>
>><br>
>> define i32 @main() nounwind {<br>
>><br>
>> entry:<br>
>> %. = load i32* @P, align 4<br>
>> %t1 = tail call i32 (i8*, ...)* @printf(i8* noalias getelementptr<br>
>> inbounds ([4 x i8]* @.str, i32 0, i32 0), i32 %. ) nounwind<br>
>> %d. = load i32* @dP, align 4<br>
>> %t2 = tail call i32 (i8*, ...)* @printf(i8* noalias getelementptr<br>
>> inbounds ([4 x i8]* @.str, i32 0, i32 0), i32 %d. ) nounwind<br>
>> %0 = icmp sgt i32 %., 0<br>
>> %1 = tail call i32 (i8*, ...)* @printf(i8* noalias getelementptr inbounds<br>
>> ([4 x i8]* @.str, i32 0, i32 0), i1 %0 ) nounwind<br>
>> %2 = icmp sgt i32 %d., 0<br>
>> %3 = tail call i32 (i8*, ...)* @printf(i8* noalias getelementptr<br>
>> inbounds ([4 x i8]* @.str, i32 0, i32 0), i1 %2 ) nounwind<br>
>> %t3 = icmp eq i32 %d., %d.<br>
>> %t4 = tail call i32 (i8*, ...)* @printf(i8* noalias getelementptr<br>
>> inbounds ([4 x i8]* @.str, i32 0, i32 0), i1 %t3 ) nounwind<br>
>> %4 = icmp sgt i32 1, 0<br>
>> %5 = icmp sgt i32 1, 0<br>
>> %6 = tail call i32 (i8*, ...)* @printf(i8* noalias getelementptr<br>
>> inbounds ([4 x i8]* @.str, i32 0, i32 0), i1 %4 ) nounwind<br>
>> %7 = tail call i32 (i8*, ...)* @printf(i8* noalias getelementptr<br>
>> inbounds ([4 x i8]* @.str, i32 0, i32 0), i1 %5 ) nounwind<br>
>> ret i32 undef<br>
>> }<br>
>><br>
>> declare i32 @printf(i8* nocapture, ...) nounwind<br>
>><br>
>> --------------------------------------------------------------------------------------------------<br>
>><br>
>> The output is still:<br>
>><br>
>> 1<br>
>> 1<br>
>> 0<br>
>> 0<br>
>> 1<br>
>> 1<br>
>> 1<br>
>><br>
>> which should be all ones. Is there a sign error somewhere?<br>
><br>
> Please file a bug to <a href="http://llvm.org/bugs" target="_blank">llvm.org/bugs</a><br>
> I don't know of anyone working on Sparc right now, so if you could dig<br>
> and find out what llvm is generating wrong, someone may provide a fix<br>
> faster. Or if you're willing to right a patch that would be even<br>
> better! :)<br>
><br>
> --<br>
> Bruno Cardoso Lopes<br>
> <a href="http://www.brunocardoso.cc" target="_blank">http://www.brunocardoso.cc</a><br>
><br>
</div></div><div><div></div><div class="h5">> _______________________________________________<br>
> LLVM Developers mailing list<br>
> <a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
><br>
</div></div></blockquote></div><br>