2008-03-09 08:16:40 +00:00
|
|
|
; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
|
2007-04-14 20:13:02 +00:00
|
|
|
; RUN: not grep getelementptr
|
2005-01-13 23:26:14 +00:00
|
|
|
|
2008-03-09 08:16:40 +00:00
|
|
|
define i1 @test1(i16* %P, i32 %I, i32 %J) {
|
|
|
|
%X = getelementptr i16* %P, i32 %I ; <i16*> [#uses=1]
|
|
|
|
%Y = getelementptr i16* %P, i32 %J ; <i16*> [#uses=1]
|
|
|
|
%C = icmp ult i16* %X, %Y ; <i1> [#uses=1]
|
|
|
|
ret i1 %C
|
2005-01-13 23:26:14 +00:00
|
|
|
}
|
|
|
|
|
2008-03-09 08:16:40 +00:00
|
|
|
define i1 @test2(i16* %P, i32 %I) {
|
|
|
|
%X = getelementptr i16* %P, i32 %I ; <i16*> [#uses=1]
|
|
|
|
%C = icmp ult i16* %X, %P ; <i1> [#uses=1]
|
|
|
|
ret i1 %C
|
2005-01-13 23:26:14 +00:00
|
|
|
}
|
|
|
|
|
2008-03-09 08:16:40 +00:00
|
|
|
define i32 @test3(i32* %P, i32 %A, i32 %B) {
|
|
|
|
%tmp.4 = getelementptr i32* %P, i32 %A ; <i32*> [#uses=1]
|
|
|
|
%tmp.9 = getelementptr i32* %P, i32 %B ; <i32*> [#uses=1]
|
|
|
|
%tmp.10 = icmp eq i32* %tmp.4, %tmp.9 ; <i1> [#uses=1]
|
|
|
|
%tmp.11 = zext i1 %tmp.10 to i32 ; <i32> [#uses=1]
|
|
|
|
ret i32 %tmp.11
|
2005-01-14 00:26:25 +00:00
|
|
|
}
|
|
|
|
|
2008-03-09 08:16:40 +00:00
|
|
|
define i32 @test4(i32* %P, i32 %A, i32 %B) {
|
|
|
|
%tmp.4 = getelementptr i32* %P, i32 %A ; <i32*> [#uses=1]
|
|
|
|
%tmp.6 = icmp eq i32* %tmp.4, %P ; <i1> [#uses=1]
|
|
|
|
%tmp.7 = zext i1 %tmp.6 to i32 ; <i32> [#uses=1]
|
|
|
|
ret i32 %tmp.7
|
2005-01-14 00:26:25 +00:00
|
|
|
}
|
|
|
|
|