2011-12-05 06:29:09 +00:00
|
|
|
; RUN: llc < %s -march=x86 -mcpu=corei7-avx | FileCheck %s
|
2012-12-30 02:33:22 +00:00
|
|
|
; RUN: opt -instsimplify -disable-output < %s
|
2011-12-05 06:29:09 +00:00
|
|
|
|
2012-02-28 11:54:05 +00:00
|
|
|
;CHECK: AGEP0:
|
2011-12-05 06:29:09 +00:00
|
|
|
define <4 x i32*> @AGEP0(i32* %ptr) nounwind {
|
|
|
|
entry:
|
|
|
|
%vecinit.i = insertelement <4 x i32*> undef, i32* %ptr, i32 0
|
|
|
|
%vecinit2.i = insertelement <4 x i32*> %vecinit.i, i32* %ptr, i32 1
|
|
|
|
%vecinit4.i = insertelement <4 x i32*> %vecinit2.i, i32* %ptr, i32 2
|
|
|
|
%vecinit6.i = insertelement <4 x i32*> %vecinit4.i, i32* %ptr, i32 3
|
|
|
|
;CHECK: padd
|
|
|
|
%A2 = getelementptr <4 x i32*> %vecinit6.i, <4 x i32> <i32 1, i32 2, i32 3, i32 4>
|
|
|
|
;CHECK: padd
|
|
|
|
%A3 = getelementptr <4 x i32*> %A2, <4 x i32> <i32 10, i32 14, i32 19, i32 233>
|
|
|
|
ret <4 x i32*> %A3
|
|
|
|
;CHECK: ret
|
|
|
|
}
|
|
|
|
|
2012-02-28 11:54:05 +00:00
|
|
|
;CHECK: AGEP1:
|
2011-12-05 06:29:09 +00:00
|
|
|
define i32 @AGEP1(<4 x i32*> %param) nounwind {
|
|
|
|
entry:
|
|
|
|
;CHECK: padd
|
|
|
|
%A2 = getelementptr <4 x i32*> %param, <4 x i32> <i32 1, i32 2, i32 3, i32 4>
|
|
|
|
%k = extractelement <4 x i32*> %A2, i32 3
|
|
|
|
%v = load i32* %k
|
|
|
|
ret i32 %v
|
|
|
|
;CHECK: ret
|
|
|
|
}
|
|
|
|
|
2012-02-28 11:54:05 +00:00
|
|
|
;CHECK: AGEP2:
|
2011-12-05 06:29:09 +00:00
|
|
|
define i32 @AGEP2(<4 x i32*> %param, <4 x i32> %off) nounwind {
|
|
|
|
entry:
|
2012-02-28 11:54:05 +00:00
|
|
|
;CHECK: pslld $2
|
2011-12-05 06:29:09 +00:00
|
|
|
;CHECK: padd
|
|
|
|
%A2 = getelementptr <4 x i32*> %param, <4 x i32> %off
|
|
|
|
%k = extractelement <4 x i32*> %A2, i32 3
|
|
|
|
%v = load i32* %k
|
|
|
|
ret i32 %v
|
|
|
|
;CHECK: ret
|
|
|
|
}
|
|
|
|
|
2012-02-28 11:54:05 +00:00
|
|
|
;CHECK: AGEP3:
|
2011-12-05 06:29:09 +00:00
|
|
|
define <4 x i32*> @AGEP3(<4 x i32*> %param, <4 x i32> %off) nounwind {
|
|
|
|
entry:
|
2012-02-28 11:54:05 +00:00
|
|
|
;CHECK: pslld $2
|
2011-12-05 06:29:09 +00:00
|
|
|
;CHECK: padd
|
|
|
|
%A2 = getelementptr <4 x i32*> %param, <4 x i32> %off
|
|
|
|
%v = alloca i32
|
|
|
|
%k = insertelement <4 x i32*> %A2, i32* %v, i32 3
|
|
|
|
ret <4 x i32*> %k
|
|
|
|
;CHECK: ret
|
|
|
|
}
|
|
|
|
|
2012-02-28 11:54:05 +00:00
|
|
|
;CHECK: AGEP4:
|
|
|
|
define <4 x i16*> @AGEP4(<4 x i16*> %param, <4 x i32> %off) nounwind {
|
2011-12-05 06:29:09 +00:00
|
|
|
entry:
|
2012-02-28 11:54:05 +00:00
|
|
|
; Multiply offset by two (add it to itself).
|
2011-12-05 06:29:09 +00:00
|
|
|
;CHECK: padd
|
2012-02-28 11:54:05 +00:00
|
|
|
; add the base to the offset
|
|
|
|
;CHECK: padd
|
|
|
|
%A = getelementptr <4 x i16*> %param, <4 x i32> %off
|
|
|
|
ret <4 x i16*> %A
|
2011-12-05 06:29:09 +00:00
|
|
|
;CHECK: ret
|
|
|
|
}
|
|
|
|
|
2012-02-28 11:54:05 +00:00
|
|
|
;CHECK: AGEP5:
|
2011-12-05 06:29:09 +00:00
|
|
|
define <4 x i8*> @AGEP5(<4 x i8*> %param, <4 x i8> %off) nounwind {
|
|
|
|
entry:
|
2012-02-28 11:54:05 +00:00
|
|
|
;CHECK: paddd
|
2011-12-05 06:29:09 +00:00
|
|
|
%A = getelementptr <4 x i8*> %param, <4 x i8> %off
|
|
|
|
ret <4 x i8*> %A
|
|
|
|
;CHECK: ret
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-02-28 11:54:05 +00:00
|
|
|
; The size of each element is 1 byte. No need to multiply by element size.
|
|
|
|
;CHECK: AGEP6:
|
|
|
|
define <4 x i8*> @AGEP6(<4 x i8*> %param, <4 x i32> %off) nounwind {
|
|
|
|
entry:
|
|
|
|
;CHECK-NOT: pslld
|
|
|
|
%A = getelementptr <4 x i8*> %param, <4 x i32> %off
|
|
|
|
ret <4 x i8*> %A
|
|
|
|
;CHECK: ret
|
|
|
|
}
|
|
|
|
|