aboutsummaryrefslogtreecommitdiffstats
path: root/test/CodeGen/CellSPU/v2i32.ll
blob: dd51be5a71d2e740f54da4b1bc30c0f0591786bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
;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)
{
;CHECK: a {{\$.}}, $3, $3
  %1 = add %vec %param, %param
;CHECK: bi $lr
  ret %vec %1
}

define %vec @test_sub(%vec %param)
{
;CHECK: sf {{\$.}}, $4, $3
  %1 = sub %vec %param, <i32 1, i32 1>

;CHECK: bi $lr
  ret %vec %1
}

define %vec @test_mul(%vec %param)
{
;CHECK: mpyu
;CHECK: mpyh
;CHECK: a {{\$., \$., \$.}}
;CHECK: a {{\$., \$., \$.}}
  %1 = mul %vec %param, %param

;CHECK: bi $lr
  ret %vec %1
}

define <2 x i32> @test_splat(i32 %param ) {
;TODO insertelement transforms to a PREFSLOT2VEC, that trasforms to the 
;     somewhat redundant: 
;CHECK-NOT or $3, $3, $3
;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
}

define void @test_store( %vec %val, %vec* %ptr)
{
;CHECK: stqd $3, 0(${{.}})
;CHECK: bi $lr
  store %vec %val, %vec* %ptr
  ret void
}