2010-08-02 12:25:47 +02:00
|
|
|
;RUN: llc --march=cellspu %s -o - | FileCheck %s
|
|
|
|
%vec = type <2 x float>
|
|
|
|
|
|
|
|
define %vec @test_ret(%vec %param)
|
|
|
|
{
|
|
|
|
;CHECK: bi $lr
|
|
|
|
ret %vec %param
|
|
|
|
}
|
|
|
|
|
|
|
|
define %vec @test_add(%vec %param)
|
|
|
|
{
|
2010-08-18 12:04:39 +02:00
|
|
|
;CHECK: fa {{\$.}}, $3, $3
|
2010-08-02 12:25:47 +02:00
|
|
|
%1 = fadd %vec %param, %param
|
|
|
|
;CHECK: bi $lr
|
|
|
|
ret %vec %1
|
|
|
|
}
|
|
|
|
|
|
|
|
define %vec @test_sub(%vec %param)
|
|
|
|
{
|
2010-08-18 12:04:39 +02:00
|
|
|
;CHECK: fs {{\$.}}, $3, $3
|
2010-08-02 12:25:47 +02:00
|
|
|
%1 = fsub %vec %param, %param
|
|
|
|
|
|
|
|
;CHECK: bi $lr
|
|
|
|
ret %vec %1
|
|
|
|
}
|
|
|
|
|
|
|
|
define %vec @test_mul(%vec %param)
|
|
|
|
{
|
2010-08-18 12:04:39 +02:00
|
|
|
;CHECK: fm {{\$.}}, $3, $3
|
2010-08-02 12:25:47 +02:00
|
|
|
%1 = fmul %vec %param, %param
|
|
|
|
|
|
|
|
;CHECK: bi $lr
|
|
|
|
ret %vec %1
|
|
|
|
}
|
|
|
|
|
2011-04-09 04:31:26 +02:00
|
|
|
; CHECK: test_splat:
|
2010-08-02 13:22:10 +02:00
|
|
|
define %vec @test_splat(float %param ) {
|
|
|
|
;CHECK: lqa
|
|
|
|
;CHECK: shufb
|
|
|
|
%sv = insertelement <1 x float> undef, float %param, i32 0
|
|
|
|
%rv = shufflevector <1 x float> %sv, <1 x float> undef, <2 x i32> zeroinitializer
|
|
|
|
;CHECK: bi $lr
|
|
|
|
ret %vec %rv
|
|
|
|
}
|
|
|
|
|
2010-08-04 15:59:48 +02:00
|
|
|
define void @test_store(%vec %val, %vec* %ptr){
|
2011-04-09 04:31:26 +02:00
|
|
|
; CHECK: test_store:
|
2010-08-04 15:59:48 +02:00
|
|
|
;CHECK: stqd
|
2011-04-09 04:31:26 +02:00
|
|
|
store %vec zeroinitializer, %vec* null
|
2010-08-04 15:59:48 +02:00
|
|
|
|
2011-04-09 04:31:26 +02:00
|
|
|
;CHECK: stqd $3, 0(${{.*}})
|
2010-08-04 15:59:48 +02:00
|
|
|
;CHECK: bi $lr
|
|
|
|
store %vec %val, %vec* %ptr
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2011-04-09 04:31:26 +02:00
|
|
|
; CHECK: test_insert:
|
2010-08-04 15:59:48 +02:00
|
|
|
define %vec @test_insert(){
|
|
|
|
;CHECK: cwd
|
|
|
|
;CHECK: shufb $3
|
|
|
|
%rv = insertelement %vec undef, float 0.0e+00, i32 undef
|
|
|
|
;CHECK: bi $lr
|
|
|
|
ret %vec %rv
|
|
|
|
}
|
2010-08-02 13:22:10 +02:00
|
|
|
|
2011-04-09 04:31:26 +02:00
|
|
|
; CHECK: test_unaligned_store:
|
|
|
|
|
2010-08-09 18:33:00 +02:00
|
|
|
define void @test_unaligned_store() {
|
2010-10-26 12:45:47 +02:00
|
|
|
;CHECK: cdd
|
2010-08-09 18:33:00 +02:00
|
|
|
;CHECK: shufb
|
|
|
|
;CHECK: stqd
|
|
|
|
%data = alloca [4 x float], align 16 ; <[4 x float]*> [#uses=1]
|
|
|
|
%ptr = getelementptr [4 x float]* %data, i32 0, i32 2 ; <float*> [#uses=1]
|
|
|
|
%vptr = bitcast float* %ptr to <2 x float>* ; <[1 x <2 x float>]*> [#uses=1]
|
2011-04-09 04:31:26 +02:00
|
|
|
store <2 x float> zeroinitializer, <2 x float>* %vptr
|
2010-08-09 18:33:00 +02:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|