Scott Michel | b30e8f6 | 2008-12-02 19:53:53 +0000 | [diff] [blame] | 1 | ; RUN: llvm-as -o - %s | llc -march=cellspu > %t1.s |
Scott Michel | f0569be | 2008-12-27 04:51:36 +0000 | [diff] [blame] | 2 | ; RUN: grep shufb %t1.s | count 10 |
Scott Michel | b30e8f6 | 2008-12-02 19:53:53 +0000 | [diff] [blame] | 3 | ; RUN: grep {ilhu.*1799} %t1.s | count 1 |
Scott Michel | f0569be | 2008-12-27 04:51:36 +0000 | [diff] [blame] | 4 | ; RUN: grep {ilhu.*771} %t1.s | count 1 |
Scott Michel | b30e8f6 | 2008-12-02 19:53:53 +0000 | [diff] [blame] | 5 | ; RUN: grep {ilhu.*1543} %t1.s | count 1 |
| 6 | ; RUN: grep {ilhu.*1029} %t1.s | count 1 |
Scott Michel | f0569be | 2008-12-27 04:51:36 +0000 | [diff] [blame] | 7 | ; RUN: grep {ilhu.*515} %t1.s | count 2 |
| 8 | ; RUN: grep xsbh %t1.s | count 2 |
| 9 | ; RUN: grep sfh %t1.s | count 1 |
Scott Michel | b30e8f6 | 2008-12-02 19:53:53 +0000 | [diff] [blame] | 10 | |
| 11 | ; ModuleID = 'trunc.bc' |
| 12 | target datalayout = "E-p:32:32:128-i1:8:128-i8:8:128-i16:16:128-i32:32:128-i64:32:128-f32:32:128-f64:64:128-v64:64:64-v128:128:128-a0:0:128-s0:128:128" |
| 13 | target triple = "spu" |
| 14 | |
| 15 | ; codegen for i128 arguments is not implemented yet on CellSPU |
| 16 | ; once this changes uncomment the functions below |
| 17 | ; and update the expected results accordingly |
| 18 | |
| 19 | ;define i8 @trunc_i128_i8(i128 %u) nounwind readnone { |
| 20 | ;entry: |
| 21 | ; %0 = trunc i128 %u to i8 |
| 22 | ; ret i8 %0 |
| 23 | ;} |
| 24 | ;define i16 @trunc_i128_i16(i128 %u) nounwind readnone { |
| 25 | ;entry: |
| 26 | ; %0 = trunc i128 %u to i16 |
| 27 | ; ret i16 %0 |
| 28 | ;} |
| 29 | ;define i32 @trunc_i128_i32(i128 %u) nounwind readnone { |
| 30 | ;entry: |
| 31 | ; %0 = trunc i128 %u to i32 |
| 32 | ; ret i32 %0 |
| 33 | ;} |
| 34 | ;define i64 @trunc_i128_i64(i128 %u) nounwind readnone { |
| 35 | ;entry: |
| 36 | ; %0 = trunc i128 %u to i64 |
| 37 | ; ret i64 %0 |
| 38 | ;} |
| 39 | |
Scott Michel | f0569be | 2008-12-27 04:51:36 +0000 | [diff] [blame] | 40 | define <16 x i8> @trunc_i64_i8(i64 %u, <16 x i8> %v) nounwind readnone { |
Scott Michel | b30e8f6 | 2008-12-02 19:53:53 +0000 | [diff] [blame] | 41 | entry: |
| 42 | %0 = trunc i64 %u to i8 |
Scott Michel | f0569be | 2008-12-27 04:51:36 +0000 | [diff] [blame] | 43 | %tmp1 = insertelement <16 x i8> %v, i8 %0, i32 10 |
| 44 | ret <16 x i8> %tmp1 |
Scott Michel | b30e8f6 | 2008-12-02 19:53:53 +0000 | [diff] [blame] | 45 | } |
Scott Michel | f0569be | 2008-12-27 04:51:36 +0000 | [diff] [blame] | 46 | define <8 x i16> @trunc_i64_i16(i64 %u, <8 x i16> %v) nounwind readnone { |
Scott Michel | b30e8f6 | 2008-12-02 19:53:53 +0000 | [diff] [blame] | 47 | entry: |
| 48 | %0 = trunc i64 %u to i16 |
Scott Michel | f0569be | 2008-12-27 04:51:36 +0000 | [diff] [blame] | 49 | %tmp1 = insertelement <8 x i16> %v, i16 %0, i32 6 |
| 50 | ret <8 x i16> %tmp1 |
Scott Michel | b30e8f6 | 2008-12-02 19:53:53 +0000 | [diff] [blame] | 51 | } |
| 52 | define i32 @trunc_i64_i32(i64 %u, i32 %v) nounwind readnone { |
| 53 | entry: |
| 54 | %0 = trunc i64 %u to i32 |
Scott Michel | f0569be | 2008-12-27 04:51:36 +0000 | [diff] [blame] | 55 | ret i32 %0 |
Scott Michel | b30e8f6 | 2008-12-02 19:53:53 +0000 | [diff] [blame] | 56 | } |
| 57 | |
| 58 | define i8 @trunc_i32_i8(i32 %u, i8 %v) nounwind readnone { |
| 59 | entry: |
| 60 | %0 = trunc i32 %u to i8 |
| 61 | %1 = sub i8 %0, %v |
| 62 | ret i8 %1 |
| 63 | } |
Scott Michel | f0569be | 2008-12-27 04:51:36 +0000 | [diff] [blame] | 64 | define <8 x i16> @trunc_i32_i16(i32 %u, <8 x i16> %v) nounwind readnone { |
Scott Michel | b30e8f6 | 2008-12-02 19:53:53 +0000 | [diff] [blame] | 65 | entry: |
| 66 | %0 = trunc i32 %u to i16 |
Scott Michel | f0569be | 2008-12-27 04:51:36 +0000 | [diff] [blame] | 67 | %tmp1 = insertelement <8 x i16> %v, i16 %0, i32 3 |
| 68 | ret <8 x i16> %tmp1 |
Scott Michel | b30e8f6 | 2008-12-02 19:53:53 +0000 | [diff] [blame] | 69 | } |
| 70 | |
Scott Michel | f0569be | 2008-12-27 04:51:36 +0000 | [diff] [blame] | 71 | define <16 x i8> @trunc_i16_i8(i16 %u, <16 x i8> %v) nounwind readnone { |
Scott Michel | b30e8f6 | 2008-12-02 19:53:53 +0000 | [diff] [blame] | 72 | entry: |
| 73 | %0 = trunc i16 %u to i8 |
Scott Michel | f0569be | 2008-12-27 04:51:36 +0000 | [diff] [blame] | 74 | %tmp1 = insertelement <16 x i8> %v, i8 %0, i32 5 |
| 75 | ret <16 x i8> %tmp1 |
Scott Michel | b30e8f6 | 2008-12-02 19:53:53 +0000 | [diff] [blame] | 76 | } |