Scott Michel | 170783a | 2007-12-19 20:15:47 +0000 | [diff] [blame] | 1 | ; RUN: llvm-as -o - %s | llc -march=cellspu > %t1.s |
Scott Michel | 1a6cdb6 | 2008-12-01 17:56:02 +0000 | [diff] [blame^] | 2 | ; RUN: grep cbd %t1.s | count 5 |
| 3 | ; RUN: grep chd %t1.s | count 5 |
| 4 | ; RUN: grep cwd %t1.s | count 10 |
| 5 | ; RUN: grep il %t1.s | count 15 |
| 6 | ; RUN: grep ilh %t1.s | count 10 |
Chris Lattner | 994d6cf | 2008-01-18 19:53:43 +0000 | [diff] [blame] | 7 | ; RUN: grep iohl %t1.s | count 1 |
Scott Michel | 1a6cdb6 | 2008-12-01 17:56:02 +0000 | [diff] [blame^] | 8 | ; RUN: grep ilhu %t1.s | count 4 |
| 9 | ; RUN: grep shufb %t1.s | count 26 |
Chris Lattner | 994d6cf | 2008-01-18 19:53:43 +0000 | [diff] [blame] | 10 | ; RUN: grep 17219 %t1.s | count 1 |
| 11 | ; RUN: grep 22598 %t1.s | count 1 |
| 12 | ; RUN: grep -- -39 %t1.s | count 1 |
| 13 | ; RUN: grep 24 %t1.s | count 1 |
Scott Michel | 170783a | 2007-12-19 20:15:47 +0000 | [diff] [blame] | 14 | ; RUN: grep 1159 %t1.s | count 1 |
| 15 | ; ModuleID = 'vecinsert.bc' |
| 16 | target datalayout = "E-p:32:32:128-f64:64:128-f32:32:128-i64:32:128-i32:32:128-i16:16:128-i8:8:128-i1:8:128-a0:0:128-v128:128:128" |
| 17 | target triple = "spu-unknown-elf" |
| 18 | |
| 19 | ; 67 -> 0x43, as 8-bit vector constant load = 0x4343 (17219)0x4343 |
| 20 | define <16 x i8> @test_v16i8(<16 x i8> %P, i8 %x) { |
| 21 | entry: |
Scott Michel | 53dec47 | 2008-03-05 23:00:19 +0000 | [diff] [blame] | 22 | %tmp1 = insertelement <16 x i8> %P, i8 %x, i32 10 |
| 23 | %tmp1.1 = insertelement <16 x i8> %tmp1, i8 67, i32 7 |
| 24 | %tmp1.2 = insertelement <16 x i8> %tmp1.1, i8 %x, i32 15 |
| 25 | ret <16 x i8> %tmp1.2 |
Scott Michel | 170783a | 2007-12-19 20:15:47 +0000 | [diff] [blame] | 26 | } |
| 27 | |
| 28 | ; 22598 -> 0x5846 |
| 29 | define <8 x i16> @test_v8i16(<8 x i16> %P, i16 %x) { |
| 30 | entry: |
Scott Michel | 53dec47 | 2008-03-05 23:00:19 +0000 | [diff] [blame] | 31 | %tmp1 = insertelement <8 x i16> %P, i16 %x, i32 5 |
| 32 | %tmp1.1 = insertelement <8 x i16> %tmp1, i16 22598, i32 7 |
| 33 | %tmp1.2 = insertelement <8 x i16> %tmp1.1, i16 %x, i32 2 |
| 34 | ret <8 x i16> %tmp1.2 |
Scott Michel | 170783a | 2007-12-19 20:15:47 +0000 | [diff] [blame] | 35 | } |
| 36 | |
| 37 | ; 1574023 -> 0x180487 (ILHU 24/IOHL 1159) |
| 38 | define <4 x i32> @test_v4i32_1(<4 x i32> %P, i32 %x) { |
| 39 | entry: |
Scott Michel | 53dec47 | 2008-03-05 23:00:19 +0000 | [diff] [blame] | 40 | %tmp1 = insertelement <4 x i32> %P, i32 %x, i32 2 |
| 41 | %tmp1.1 = insertelement <4 x i32> %tmp1, i32 1574023, i32 1 |
| 42 | %tmp1.2 = insertelement <4 x i32> %tmp1.1, i32 %x, i32 3 |
| 43 | ret <4 x i32> %tmp1.2 |
Scott Michel | 170783a | 2007-12-19 20:15:47 +0000 | [diff] [blame] | 44 | } |
| 45 | |
| 46 | ; Should generate IL for the load |
| 47 | define <4 x i32> @test_v4i32_2(<4 x i32> %P, i32 %x) { |
| 48 | entry: |
Scott Michel | 53dec47 | 2008-03-05 23:00:19 +0000 | [diff] [blame] | 49 | %tmp1 = insertelement <4 x i32> %P, i32 %x, i32 2 |
| 50 | %tmp1.1 = insertelement <4 x i32> %tmp1, i32 -39, i32 1 |
| 51 | %tmp1.2 = insertelement <4 x i32> %tmp1.1, i32 %x, i32 3 |
| 52 | ret <4 x i32> %tmp1.2 |
Scott Michel | 170783a | 2007-12-19 20:15:47 +0000 | [diff] [blame] | 53 | } |
Scott Michel | 1a6cdb6 | 2008-12-01 17:56:02 +0000 | [diff] [blame^] | 54 | |
| 55 | define void @variable_v16i8_1(<16 x i8>* %a, i32 %i) nounwind { |
| 56 | entry: |
| 57 | %arrayidx = getelementptr <16 x i8>* %a, i32 %i |
| 58 | %tmp2 = load <16 x i8>* %arrayidx |
| 59 | %tmp3 = insertelement <16 x i8> %tmp2, i8 1, i32 1 |
| 60 | %tmp8 = insertelement <16 x i8> %tmp3, i8 2, i32 11 |
| 61 | store <16 x i8> %tmp8, <16 x i8>* %arrayidx |
| 62 | ret void |
| 63 | } |
| 64 | |
| 65 | define void @variable_v8i16_1(<8 x i16>* %a, i32 %i) nounwind { |
| 66 | entry: |
| 67 | %arrayidx = getelementptr <8 x i16>* %a, i32 %i |
| 68 | %tmp2 = load <8 x i16>* %arrayidx |
| 69 | %tmp3 = insertelement <8 x i16> %tmp2, i16 1, i32 1 |
| 70 | %tmp8 = insertelement <8 x i16> %tmp3, i16 2, i32 6 |
| 71 | store <8 x i16> %tmp8, <8 x i16>* %arrayidx |
| 72 | ret void |
| 73 | } |
| 74 | |
| 75 | define void @variable_v4i32_1(<4 x i32>* %a, i32 %i) nounwind { |
| 76 | entry: |
| 77 | %arrayidx = getelementptr <4 x i32>* %a, i32 %i |
| 78 | %tmp2 = load <4 x i32>* %arrayidx |
| 79 | %tmp3 = insertelement <4 x i32> %tmp2, i32 1, i32 1 |
| 80 | %tmp8 = insertelement <4 x i32> %tmp3, i32 2, i32 2 |
| 81 | store <4 x i32> %tmp8, <4 x i32>* %arrayidx |
| 82 | ret void |
| 83 | } |
| 84 | |
| 85 | define void @variable_v4f32_1(<4 x float>* %a, i32 %i) nounwind { |
| 86 | entry: |
| 87 | %arrayidx = getelementptr <4 x float>* %a, i32 %i |
| 88 | %tmp2 = load <4 x float>* %arrayidx |
| 89 | %tmp3 = insertelement <4 x float> %tmp2, float 1.000000e+00, i32 1 |
| 90 | %tmp8 = insertelement <4 x float> %tmp3, float 2.000000e+00, i32 2 |
| 91 | store <4 x float> %tmp8, <4 x float>* %arrayidx |
| 92 | ret void |
| 93 | } |
| 94 | |
| 95 | define void @variable_v2i64_1(<2 x i64>* %a, i32 %i) nounwind { |
| 96 | entry: |
| 97 | %arrayidx = getelementptr <2 x i64>* %a, i32 %i |
| 98 | %tmp2 = load <2 x i64>* %arrayidx |
| 99 | %tmp3 = insertelement <2 x i64> %tmp2, i64 615, i32 0 |
| 100 | store <2 x i64> %tmp3, <2 x i64>* %arrayidx |
| 101 | ret void |
| 102 | } |
| 103 | |
| 104 | define void @variable_v2i64_2(<2 x i64>* %a, i32 %i) nounwind { |
| 105 | entry: |
| 106 | %arrayidx = getelementptr <2 x i64>* %a, i32 %i |
| 107 | %tmp2 = load <2 x i64>* %arrayidx |
| 108 | %tmp3 = insertelement <2 x i64> %tmp2, i64 615, i32 1 |
| 109 | store <2 x i64> %tmp3, <2 x i64>* %arrayidx |
| 110 | ret void |
| 111 | } |
| 112 | |
| 113 | define void @variable_v2f64_1(<2 x double>* %a, i32 %i) nounwind { |
| 114 | entry: |
| 115 | %arrayidx = getelementptr <2 x double>* %a, i32 %i |
| 116 | %tmp2 = load <2 x double>* %arrayidx |
| 117 | %tmp3 = insertelement <2 x double> %tmp2, double 1.000000e+00, i32 1 |
| 118 | store <2 x double> %tmp3, <2 x double>* %arrayidx |
| 119 | ret void |
| 120 | } |