Kalle Raiskila | 82fe467 | 2010-08-02 08:54:39 +0000 | [diff] [blame] | 1 | ;RUN: llc --march=cellspu %s -o - | FileCheck %s |
| 2 | %vec = type <2 x i32> |
| 3 | |
| 4 | define %vec @test_ret(%vec %param) |
| 5 | { |
| 6 | ;CHECK: bi $lr |
| 7 | ret %vec %param |
| 8 | } |
| 9 | |
| 10 | define %vec @test_add(%vec %param) |
| 11 | { |
Kalle Raiskila | 86a7912 | 2010-08-18 10:04:39 +0000 | [diff] [blame] | 12 | ;CHECK: a {{\$.}}, $3, $3 |
Kalle Raiskila | 82fe467 | 2010-08-02 08:54:39 +0000 | [diff] [blame] | 13 | %1 = add %vec %param, %param |
| 14 | ;CHECK: bi $lr |
| 15 | ret %vec %1 |
| 16 | } |
| 17 | |
| 18 | define %vec @test_sub(%vec %param) |
| 19 | { |
Kalle Raiskila | 86a7912 | 2010-08-18 10:04:39 +0000 | [diff] [blame] | 20 | ;CHECK: sf {{\$.}}, $4, $3 |
Kalle Raiskila | 82fe467 | 2010-08-02 08:54:39 +0000 | [diff] [blame] | 21 | %1 = sub %vec %param, <i32 1, i32 1> |
| 22 | |
| 23 | ;CHECK: bi $lr |
| 24 | ret %vec %1 |
| 25 | } |
| 26 | |
| 27 | define %vec @test_mul(%vec %param) |
| 28 | { |
| 29 | ;CHECK: mpyu |
| 30 | ;CHECK: mpyh |
Kalle Raiskila | 86a7912 | 2010-08-18 10:04:39 +0000 | [diff] [blame] | 31 | ;CHECK: a {{\$., \$., \$.}} |
| 32 | ;CHECK: a {{\$., \$., \$.}} |
Kalle Raiskila | 82fe467 | 2010-08-02 08:54:39 +0000 | [diff] [blame] | 33 | %1 = mul %vec %param, %param |
| 34 | |
| 35 | ;CHECK: bi $lr |
| 36 | ret %vec %1 |
| 37 | } |
| 38 | |
| 39 | define <2 x i32> @test_splat(i32 %param ) { |
Kalle Raiskila | 1cd1b0b | 2010-09-16 12:29:33 +0000 | [diff] [blame] | 40 | ;see svn log for why this is here... |
| 41 | ;CHECK-NOT: or $3, $3, $3 |
Kalle Raiskila | 82fe467 | 2010-08-02 08:54:39 +0000 | [diff] [blame] | 42 | ;CHECK: lqa |
| 43 | ;CHECK: shufb |
| 44 | %sv = insertelement <1 x i32> undef, i32 %param, i32 0 |
| 45 | %rv = shufflevector <1 x i32> %sv, <1 x i32> undef, <2 x i32> zeroinitializer |
| 46 | ;CHECK: bi $lr |
| 47 | ret <2 x i32> %rv |
| 48 | } |
| 49 | |
| 50 | define i32 @test_extract() { |
| 51 | ;CHECK: shufb $3 |
| 52 | %rv = extractelement <2 x i32> zeroinitializer, i32 undef ; <i32> [#uses=1] |
| 53 | ;CHECK: bi $lr |
| 54 | ret i32 %rv |
| 55 | } |
| 56 | |
Kalle Raiskila | bc2697c | 2010-08-04 13:59:48 +0000 | [diff] [blame] | 57 | define void @test_store( %vec %val, %vec* %ptr) |
| 58 | { |
Kalle Raiskila | 86a7912 | 2010-08-18 10:04:39 +0000 | [diff] [blame] | 59 | ;CHECK: stqd $3, 0(${{.}}) |
Kalle Raiskila | bc2697c | 2010-08-04 13:59:48 +0000 | [diff] [blame] | 60 | ;CHECK: bi $lr |
| 61 | store %vec %val, %vec* %ptr |
| 62 | ret void |
| 63 | } |
Kalle Raiskila | 505faa6 | 2010-10-26 10:45:47 +0000 | [diff] [blame] | 64 | |
| 65 | ;Alignment of <2 x i32> is not *directly* defined in the ABI |
| 66 | ;It probably is safe to interpret it as an array, thus having 8 byte |
| 67 | ;alignment (according to ABI). This tests that the size of |
| 68 | ;[2 x <2 x i32>] is 16 bytes, i.e. there is no padding between the |
| 69 | ;two arrays |
| 70 | define <2 x i32>* @test_alignment( [2 x <2 x i32>]* %ptr) |
| 71 | { |
| 72 | ; CHECK-NOT: ai $3, $3, 16 |
| 73 | ; CHECK: ai $3, $3, 8 |
| 74 | ; CHECK: bi $lr |
| 75 | %rv = getelementptr [2 x <2 x i32>]* %ptr, i32 0, i32 1 |
| 76 | ret <2 x i32>* %rv |
| 77 | } |