Nemanja Ivanovic | d2c3c51 | 2016-09-23 13:25:31 +0000 | [diff] [blame] | 1 | ; RUN: llc -mcpu=pwr9 -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s |
| 2 | ; RUN: llc -mcpu=pwr9 -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s \ |
| 3 | ; RUN: --check-prefix=CHECK-BE |
| 4 | |
| 5 | @Globi = external global i32, align 4 |
| 6 | @Globf = external global float, align 4 |
| 7 | |
| 8 | define <2 x i64> @test1(i64 %a, i64 %b) { |
| 9 | entry: |
Nemanja Ivanovic | 11049f8 | 2016-10-04 06:59:23 +0000 | [diff] [blame] | 10 | ; The FIXME below is due to the lowering for BUILD_VECTOR needing a re-vamp |
| 11 | ; which will happen in a subsequent patch. |
Nemanja Ivanovic | d2c3c51 | 2016-09-23 13:25:31 +0000 | [diff] [blame] | 12 | ; CHECK-LABEL: test1 |
Nemanja Ivanovic | df1cb52 | 2016-11-29 16:11:34 +0000 | [diff] [blame] | 13 | ; CHECK: mtvsrdd 34, 4, 3 |
Nemanja Ivanovic | d2c3c51 | 2016-09-23 13:25:31 +0000 | [diff] [blame] | 14 | ; CHECK-BE-LABEL: test1 |
Nemanja Ivanovic | df1cb52 | 2016-11-29 16:11:34 +0000 | [diff] [blame] | 15 | ; CHECK-BE: mtvsrdd 34, 3, 4 |
Nemanja Ivanovic | d2c3c51 | 2016-09-23 13:25:31 +0000 | [diff] [blame] | 16 | %vecins = insertelement <2 x i64> undef, i64 %a, i32 0 |
| 17 | %vecins1 = insertelement <2 x i64> %vecins, i64 %b, i32 1 |
| 18 | ret <2 x i64> %vecins1 |
| 19 | } |
| 20 | |
| 21 | define i64 @test2(<2 x i64> %a) { |
| 22 | entry: |
| 23 | ; CHECK-LABEL: test2 |
| 24 | ; CHECK: mfvsrld 3, 34 |
| 25 | %0 = extractelement <2 x i64> %a, i32 0 |
| 26 | ret i64 %0 |
| 27 | } |
| 28 | |
| 29 | define i64 @test3(<2 x i64> %a) { |
| 30 | entry: |
| 31 | ; CHECK-BE-LABEL: test3 |
| 32 | ; CHECK-BE: mfvsrld 3, 34 |
| 33 | %0 = extractelement <2 x i64> %a, i32 1 |
| 34 | ret i64 %0 |
| 35 | } |
| 36 | |
| 37 | define <4 x i32> @test4(i32* nocapture readonly %in) { |
| 38 | entry: |
| 39 | ; CHECK-LABEL: test4 |
| 40 | ; CHECK: lxvwsx 34, 0, 3 |
| 41 | ; CHECK-NOT: xxspltw |
| 42 | ; CHECK-BE-LABEL: test4 |
| 43 | ; CHECK-BE: lxvwsx 34, 0, 3 |
| 44 | ; CHECK-BE-NOT: xxspltw |
| 45 | %0 = load i32, i32* %in, align 4 |
| 46 | %splat.splatinsert = insertelement <4 x i32> undef, i32 %0, i32 0 |
| 47 | %splat.splat = shufflevector <4 x i32> %splat.splatinsert, <4 x i32> undef, <4 x i32> zeroinitializer |
| 48 | ret <4 x i32> %splat.splat |
| 49 | } |
| 50 | |
| 51 | define <4 x float> @test5(float* nocapture readonly %in) { |
| 52 | entry: |
| 53 | ; CHECK-LABEL: test5 |
| 54 | ; CHECK: lxvwsx 34, 0, 3 |
| 55 | ; CHECK-NOT: xxspltw |
| 56 | ; CHECK-BE-LABEL: test5 |
| 57 | ; CHECK-BE: lxvwsx 34, 0, 3 |
| 58 | ; CHECK-BE-NOT: xxspltw |
| 59 | %0 = load float, float* %in, align 4 |
| 60 | %splat.splatinsert = insertelement <4 x float> undef, float %0, i32 0 |
| 61 | %splat.splat = shufflevector <4 x float> %splat.splatinsert, <4 x float> undef, <4 x i32> zeroinitializer |
| 62 | ret <4 x float> %splat.splat |
| 63 | } |
| 64 | |
| 65 | define <4 x i32> @test6() { |
| 66 | entry: |
| 67 | ; CHECK-LABEL: test6 |
| 68 | ; CHECK: addis |
| 69 | ; CHECK: ld [[TOC:[0-9]+]], .LC0 |
| 70 | ; CHECK: lxvwsx 34, 0, 3 |
| 71 | ; CHECK-NOT: xxspltw |
| 72 | ; CHECK-BE-LABEL: test6 |
| 73 | ; CHECK-BE: addis |
| 74 | ; CHECK-BE: ld [[TOC:[0-9]+]], .LC0 |
| 75 | ; CHECK-BE: lxvwsx 34, 0, 3 |
| 76 | ; CHECK-BE-NOT: xxspltw |
| 77 | %0 = load i32, i32* @Globi, align 4 |
| 78 | %splat.splatinsert = insertelement <4 x i32> undef, i32 %0, i32 0 |
| 79 | %splat.splat = shufflevector <4 x i32> %splat.splatinsert, <4 x i32> undef, <4 x i32> zeroinitializer |
| 80 | ret <4 x i32> %splat.splat |
| 81 | } |
| 82 | |
| 83 | define <4 x float> @test7() { |
| 84 | entry: |
| 85 | ; CHECK-LABEL: test7 |
| 86 | ; CHECK: addis |
| 87 | ; CHECK: ld [[TOC:[0-9]+]], .LC1 |
| 88 | ; CHECK: lxvwsx 34, 0, 3 |
| 89 | ; CHECK-NOT: xxspltw |
| 90 | ; CHECK-BE-LABEL: test7 |
| 91 | ; CHECK-BE: addis |
| 92 | ; CHECK-BE: ld [[TOC:[0-9]+]], .LC1 |
| 93 | ; CHECK-BE: lxvwsx 34, 0, 3 |
| 94 | ; CHECK-BE-NOT: xxspltw |
| 95 | %0 = load float, float* @Globf, align 4 |
| 96 | %splat.splatinsert = insertelement <4 x float> undef, float %0, i32 0 |
| 97 | %splat.splat = shufflevector <4 x float> %splat.splatinsert, <4 x float> undef, <4 x i32> zeroinitializer |
| 98 | ret <4 x float> %splat.splat |
| 99 | } |
| 100 | |
| 101 | define <16 x i8> @test8() { |
| 102 | entry: |
| 103 | ; CHECK-LABEL: test8 |
| 104 | ; CHECK: xxlxor 34, 34, 34 |
| 105 | ; CHECK-BE-LABEL: test8 |
| 106 | ; CHECK-BE: xxlxor 34, 34, 34 |
| 107 | ret <16 x i8> zeroinitializer |
| 108 | } |
| 109 | |
| 110 | define <16 x i8> @test9() { |
| 111 | entry: |
| 112 | ; CHECK-LABEL: test9 |
| 113 | ; CHECK: xxspltib 34, 1 |
| 114 | ; CHECK-BE-LABEL: test9 |
| 115 | ; CHECK-BE: xxspltib 34, 1 |
| 116 | ret <16 x i8> <i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1> |
| 117 | } |
| 118 | |
| 119 | define <16 x i8> @test10() { |
| 120 | entry: |
| 121 | ; CHECK-LABEL: test10 |
| 122 | ; CHECK: xxspltib 34, 127 |
| 123 | ; CHECK-BE-LABEL: test10 |
| 124 | ; CHECK-BE: xxspltib 34, 127 |
| 125 | ret <16 x i8> <i8 127, i8 127, i8 127, i8 127, i8 127, i8 127, i8 127, i8 127, i8 127, i8 127, i8 127, i8 127, i8 127, i8 127, i8 127, i8 127> |
| 126 | } |
| 127 | |
| 128 | define <16 x i8> @test11() { |
| 129 | entry: |
| 130 | ; CHECK-LABEL: test11 |
| 131 | ; CHECK: xxspltib 34, 128 |
| 132 | ; CHECK-BE-LABEL: test11 |
| 133 | ; CHECK-BE: xxspltib 34, 128 |
| 134 | ret <16 x i8> <i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128> |
| 135 | } |
| 136 | |
| 137 | define <16 x i8> @test12() { |
| 138 | entry: |
| 139 | ; CHECK-LABEL: test12 |
| 140 | ; CHECK: xxspltib 34, 255 |
| 141 | ; CHECK-BE-LABEL: test12 |
| 142 | ; CHECK-BE: xxspltib 34, 255 |
| 143 | ret <16 x i8> <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1> |
| 144 | } |
| 145 | |
| 146 | define <16 x i8> @test13() { |
| 147 | entry: |
| 148 | ; CHECK-LABEL: test13 |
| 149 | ; CHECK: xxspltib 34, 129 |
| 150 | ; CHECK-BE-LABEL: test13 |
| 151 | ; CHECK-BE: xxspltib 34, 129 |
| 152 | ret <16 x i8> <i8 -127, i8 -127, i8 -127, i8 -127, i8 -127, i8 -127, i8 -127, i8 -127, i8 -127, i8 -127, i8 -127, i8 -127, i8 -127, i8 -127, i8 -127, i8 -127> |
| 153 | } |
| 154 | |
Nemanja Ivanovic | 552c8e9 | 2016-12-15 11:16:20 +0000 | [diff] [blame] | 155 | define <16 x i8> @test13E127() { |
| 156 | entry: |
| 157 | ; CHECK-LABEL: test13E127 |
| 158 | ; CHECK: xxspltib 34, 200 |
| 159 | ; CHECK-BE-LABEL: test13E127 |
| 160 | ; CHECK-BE: xxspltib 34, 200 |
| 161 | ret <16 x i8> <i8 200, i8 200, i8 200, i8 200, i8 200, i8 200, i8 200, i8 200, i8 200, i8 200, i8 200, i8 200, i8 200, i8 200, i8 200, i8 200> |
| 162 | } |
| 163 | |
Nemanja Ivanovic | d2c3c51 | 2016-09-23 13:25:31 +0000 | [diff] [blame] | 164 | define <4 x i32> @test14(<4 x i32> %a, i32* nocapture readonly %b) { |
| 165 | entry: |
| 166 | ; CHECK-LABEL: test14 |
| 167 | ; CHECK: lwz [[LD:[0-9]+]], |
Nemanja Ivanovic | 15748f4 | 2016-12-06 11:47:14 +0000 | [diff] [blame] | 168 | ; CHECK: mtvsrws 34, [[LD]] |
Nemanja Ivanovic | d2c3c51 | 2016-09-23 13:25:31 +0000 | [diff] [blame] | 169 | ; CHECK-BE-LABEL: test14 |
| 170 | ; CHECK-BE: lwz [[LD:[0-9]+]], |
Nemanja Ivanovic | 15748f4 | 2016-12-06 11:47:14 +0000 | [diff] [blame] | 171 | ; CHECK-BE: mtvsrws 34, [[LD]] |
Nemanja Ivanovic | d2c3c51 | 2016-09-23 13:25:31 +0000 | [diff] [blame] | 172 | %0 = load i32, i32* %b, align 4 |
| 173 | %splat.splatinsert = insertelement <4 x i32> undef, i32 %0, i32 0 |
| 174 | %splat.splat = shufflevector <4 x i32> %splat.splatinsert, <4 x i32> undef, <4 x i32> zeroinitializer |
| 175 | %1 = add i32 %0, 5 |
| 176 | store i32 %1, i32* %b, align 4 |
| 177 | ret <4 x i32> %splat.splat |
| 178 | } |