2010-08-02 08:54:39 +00:00
|
|
|
;RUN: llc --march=cellspu %s -o - | FileCheck %s
|
|
|
|
%vec = type <2 x i32>
|
|
|
|
|
|
|
|
define %vec @test_ret(%vec %param)
|
|
|
|
{
|
|
|
|
;CHECK: bi $lr
|
|
|
|
ret %vec %param
|
|
|
|
}
|
|
|
|
|
|
|
|
define %vec @test_add(%vec %param)
|
|
|
|
{
|
2010-08-18 10:04:39 +00:00
|
|
|
;CHECK: a {{\$.}}, $3, $3
|
2010-08-02 08:54:39 +00:00
|
|
|
%1 = add %vec %param, %param
|
|
|
|
;CHECK: bi $lr
|
|
|
|
ret %vec %1
|
|
|
|
}
|
|
|
|
|
|
|
|
define %vec @test_sub(%vec %param)
|
|
|
|
{
|
2010-08-18 10:04:39 +00:00
|
|
|
;CHECK: sf {{\$.}}, $4, $3
|
2010-08-02 08:54:39 +00:00
|
|
|
%1 = sub %vec %param, <i32 1, i32 1>
|
|
|
|
|
|
|
|
;CHECK: bi $lr
|
|
|
|
ret %vec %1
|
|
|
|
}
|
|
|
|
|
|
|
|
define %vec @test_mul(%vec %param)
|
|
|
|
{
|
|
|
|
;CHECK: mpyu
|
|
|
|
;CHECK: mpyh
|
2010-08-18 10:04:39 +00:00
|
|
|
;CHECK: a {{\$., \$., \$.}}
|
|
|
|
;CHECK: a {{\$., \$., \$.}}
|
2010-08-02 08:54:39 +00:00
|
|
|
%1 = mul %vec %param, %param
|
|
|
|
|
|
|
|
;CHECK: bi $lr
|
|
|
|
ret %vec %1
|
|
|
|
}
|
|
|
|
|
|
|
|
define <2 x i32> @test_splat(i32 %param ) {
|
2010-09-16 12:29:33 +00:00
|
|
|
;see svn log for why this is here...
|
|
|
|
;CHECK-NOT: or $3, $3, $3
|
2010-08-02 08:54:39 +00:00
|
|
|
;CHECK: lqa
|
|
|
|
;CHECK: shufb
|
|
|
|
%sv = insertelement <1 x i32> undef, i32 %param, i32 0
|
|
|
|
%rv = shufflevector <1 x i32> %sv, <1 x i32> undef, <2 x i32> zeroinitializer
|
|
|
|
;CHECK: bi $lr
|
|
|
|
ret <2 x i32> %rv
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @test_extract() {
|
|
|
|
;CHECK: shufb $3
|
|
|
|
%rv = extractelement <2 x i32> zeroinitializer, i32 undef ; <i32> [#uses=1]
|
|
|
|
;CHECK: bi $lr
|
|
|
|
ret i32 %rv
|
|
|
|
}
|
|
|
|
|
2010-08-04 13:59:48 +00:00
|
|
|
define void @test_store( %vec %val, %vec* %ptr)
|
|
|
|
{
|
2010-08-18 10:04:39 +00:00
|
|
|
;CHECK: stqd $3, 0(${{.}})
|
2010-08-04 13:59:48 +00:00
|
|
|
;CHECK: bi $lr
|
|
|
|
store %vec %val, %vec* %ptr
|
|
|
|
ret void
|
|
|
|
}
|
2010-10-26 10:45:47 +00:00
|
|
|
|
|
|
|
;Alignment of <2 x i32> is not *directly* defined in the ABI
|
|
|
|
;It probably is safe to interpret it as an array, thus having 8 byte
|
|
|
|
;alignment (according to ABI). This tests that the size of
|
|
|
|
;[2 x <2 x i32>] is 16 bytes, i.e. there is no padding between the
|
|
|
|
;two arrays
|
|
|
|
define <2 x i32>* @test_alignment( [2 x <2 x i32>]* %ptr)
|
|
|
|
{
|
|
|
|
; CHECK-NOT: ai $3, $3, 16
|
|
|
|
; CHECK: ai $3, $3, 8
|
|
|
|
; CHECK: bi $lr
|
|
|
|
%rv = getelementptr [2 x <2 x i32>]* %ptr, i32 0, i32 1
|
|
|
|
ret <2 x i32>* %rv
|
|
|
|
}
|