Hi,<br><br>I compiled the following code on a Sparc machine, basically it produce different results than a X86 machine.<br><br>-------------------------------------------------------------------------------------------------------------------<br>
; MduleID = '<stdin>'<br>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"<br>target triple = "i386-pc-linux-gnu"<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 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 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 ([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 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 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 inbounds ([4 x i8]* @.str, i32 0, i32 0), i1 %4 ) nounwind<br> %7 = tail call i32 (i8*, ...)* @printf(i8* noalias getelementptr 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>On Sparc I get:<br>
1<br>1<br>0<br>0<br>1<br>1<br>1<br><br>On X86 I get all 1's which I believe is correct. <br><br>I used the following command to compile on sparc: <br>llc -march=sparc llvm_print.bc -o llvm_print.s ( on a x86 machine)<br>
/usr/sfw/bin/gcc -mcpu=v9 -mtune=v9 llvm_print.s -o llvm_print (on sparc)<br><br><br>Could anyone give me some clue about what's going on? Is 'sgt' not working for loaded values? <br><br>Thanks,<br><br>Christine<br>