Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -wasm-keep-registers -wasm-enable-unimplemented-simd -mattr=+simd128 | FileCheck %s --check-prefixes CHECK,SIMD128 |
| 2 | ; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -wasm-keep-registers -wasm-enable-unimplemented-simd -mattr=+simd128 -fast-isel | FileCheck %s --check-prefixes CHECK,SIMD128 |
| 3 | ; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -wasm-keep-registers -mattr=+simd128 | FileCheck %s --check-prefixes CHECK,SIMD128-VM |
| 4 | ; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -wasm-keep-registers -mattr=+simd128 -fast-isel | FileCheck %s --check-prefixes CHECK,SIMD128-VM |
| 5 | ; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -wasm-keep-registers -mattr=-simd128 | FileCheck %s --check-prefixes CHECK,NO-SIMD128 |
| 6 | ; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -wasm-keep-registers -mattr=-simd128 -fast-isel | FileCheck %s --check-prefixes CHECK,NO-SIMD128 |
Derek Schuff | 39bf39f | 2016-08-02 23:16:09 +0000 | [diff] [blame] | 7 | |
| 8 | ; Test that basic SIMD128 arithmetic operations assemble as expected. |
| 9 | |
| 10 | target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128" |
Sam Clegg | a590800 | 2018-05-10 17:49:11 +0000 | [diff] [blame] | 11 | target triple = "wasm32-unknown-unknown" |
Derek Schuff | 39bf39f | 2016-08-02 23:16:09 +0000 | [diff] [blame] | 12 | |
Derek Schuff | 39bf39f | 2016-08-02 23:16:09 +0000 | [diff] [blame] | 13 | ; ============================================================================== |
| 14 | ; 16 x i8 |
| 15 | ; ============================================================================== |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 16 | ; CHECK-LABEL: add_v16i8: |
Derek Schuff | 39bf39f | 2016-08-02 23:16:09 +0000 | [diff] [blame] | 17 | ; NO-SIMD128-NOT: i8x16 |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 18 | ; SIMD128-NEXT: .param v128, v128{{$}} |
| 19 | ; SIMD128-NEXT: .result v128{{$}} |
| 20 | ; SIMD128-NEXT: i8x16.add $push0=, $0, $1{{$}} |
| 21 | ; SIMD128-NEXT: return $pop0{{$}} |
Derek Schuff | 39bf39f | 2016-08-02 23:16:09 +0000 | [diff] [blame] | 22 | define <16 x i8> @add_v16i8(<16 x i8> %x, <16 x i8> %y) { |
| 23 | %a = add <16 x i8> %x, %y |
| 24 | ret <16 x i8> %a |
| 25 | } |
| 26 | |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 27 | ; CHECK-LABEL: sub_v16i8: |
Derek Schuff | 39bf39f | 2016-08-02 23:16:09 +0000 | [diff] [blame] | 28 | ; NO-SIMD128-NOT: i8x16 |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 29 | ; SIMD128-NEXT: .param v128, v128{{$}} |
| 30 | ; SIMD128-NEXT: .result v128{{$}} |
| 31 | ; SIMD128-NEXT: i8x16.sub $push0=, $0, $1{{$}} |
| 32 | ; SIMD128-NEXT: return $pop0{{$}} |
Derek Schuff | 39bf39f | 2016-08-02 23:16:09 +0000 | [diff] [blame] | 33 | define <16 x i8> @sub_v16i8(<16 x i8> %x, <16 x i8> %y) { |
| 34 | %a = sub <16 x i8> %x, %y |
| 35 | ret <16 x i8> %a |
| 36 | } |
| 37 | |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 38 | ; CHECK-LABEL: mul_v16i8: |
Derek Schuff | 39bf39f | 2016-08-02 23:16:09 +0000 | [diff] [blame] | 39 | ; NO-SIMD128-NOT: i8x16 |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 40 | ; SIMD128-NEXT: .param v128, v128{{$}} |
| 41 | ; SIMD128-NEXT: .result v128{{$}} |
| 42 | ; SIMD128-NEXT: i8x16.mul $push0=, $0, $1{{$}} |
| 43 | ; SIMD128-NEXT: return $pop0{{$}} |
Derek Schuff | 39bf39f | 2016-08-02 23:16:09 +0000 | [diff] [blame] | 44 | define <16 x i8> @mul_v16i8(<16 x i8> %x, <16 x i8> %y) { |
| 45 | %a = mul <16 x i8> %x, %y |
| 46 | ret <16 x i8> %a |
| 47 | } |
| 48 | |
Thomas Lively | 88b7443 | 2018-09-14 22:35:12 +0000 | [diff] [blame] | 49 | ; CHECK-LABEL: neg_v16i8: |
| 50 | ; NO-SIMD128-NOT: i8x16 |
| 51 | ; SIMD128-NEXT: .param v128{{$}} |
| 52 | ; SIMD128-NEXT: .result v128{{$}} |
| 53 | ; SIMD128-NEXT: i8x16.neg $push0=, $0{{$}} |
| 54 | ; SIMD128-NEXT: return $pop0{{$}} |
| 55 | define <16 x i8> @neg_v16i8(<16 x i8> %x) { |
| 56 | %a = sub <16 x i8> <i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, |
| 57 | i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0>, |
| 58 | %x |
| 59 | ret <16 x i8> %a |
| 60 | } |
| 61 | |
Thomas Lively | f2550e0 | 2018-09-15 00:45:31 +0000 | [diff] [blame^] | 62 | ; CHECK-LABEL: shl_v16i8: |
| 63 | ; NO-SIMD128-NOT: i8x16 |
| 64 | ; SIMD128-NEXT: .param v128, i32{{$}} |
| 65 | ; SIMD128-NEXT: .result v128{{$}} |
| 66 | ; SIMD128-NEXT: i8x16.shl $push0=, $0, $1{{$}} |
| 67 | ; SIMD128-NEXT: return $pop0{{$}} |
| 68 | define <16 x i8> @shl_v16i8(<16 x i8> %v, i8 %x) { |
| 69 | %t = insertelement <16 x i8> undef, i8 %x, i32 0 |
| 70 | %s = shufflevector <16 x i8> %t, <16 x i8> undef, |
| 71 | <16 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, |
| 72 | i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0> |
| 73 | %a = shl <16 x i8> %v, %s |
| 74 | ret <16 x i8> %a |
| 75 | } |
| 76 | |
| 77 | ; CHECK-LABEL: shl_const_v16i8: |
| 78 | ; NO-SIMD128-NOT: i8x16 |
| 79 | ; SIMD128-NEXT: .param v128{{$}} |
| 80 | ; SIMD128-NEXT: .result v128{{$}} |
| 81 | ; SIMD128-NEXT: i32.const $push[[L0:[0-9]+]]=, 5 |
| 82 | ; SIMD128-NEXT: i8x16.shl $push[[R:[0-9]+]]=, $0, $pop[[L0]]{{$}} |
| 83 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
| 84 | define <16 x i8> @shl_const_v16i8(<16 x i8> %v) { |
| 85 | %a = shl <16 x i8> %v, |
| 86 | <i8 5, i8 5, i8 5, i8 5, i8 5, i8 5, i8 5, i8 5, |
| 87 | i8 5, i8 5, i8 5, i8 5, i8 5, i8 5, i8 5, i8 5> |
| 88 | ret <16 x i8> %a |
| 89 | } |
| 90 | |
| 91 | ; CHECK-LABEL: shr_s_v16i8: |
| 92 | ; NO-SIMD128-NOT: i8x16 |
| 93 | ; SIMD128-NEXT: .param v128, i32{{$}} |
| 94 | ; SIMD128-NEXT: .result v128{{$}} |
| 95 | ; SIMD128-NEXT: i8x16.shr_s $push0=, $0, $1{{$}} |
| 96 | ; SIMD128-NEXT: return $pop0{{$}} |
| 97 | define <16 x i8> @shr_s_v16i8(<16 x i8> %v, i8 %x) { |
| 98 | %t = insertelement <16 x i8> undef, i8 %x, i32 0 |
| 99 | %s = shufflevector <16 x i8> %t, <16 x i8> undef, |
| 100 | <16 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, |
| 101 | i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0> |
| 102 | %a = ashr <16 x i8> %v, %s |
| 103 | ret <16 x i8> %a |
| 104 | } |
| 105 | |
| 106 | ; CHECK-LABEL: shr_u_v16i8: |
| 107 | ; NO-SIMD128-NOT: i8x16 |
| 108 | ; SIMD128-NEXT: .param v128, i32{{$}} |
| 109 | ; SIMD128-NEXT: .result v128{{$}} |
| 110 | ; SIMD128-NEXT: i8x16.shr_u $push0=, $0, $1{{$}} |
| 111 | ; SIMD128-NEXT: return $pop0{{$}} |
| 112 | define <16 x i8> @shr_u_v16i8(<16 x i8> %v, i8 %x) { |
| 113 | %t = insertelement <16 x i8> undef, i8 %x, i32 0 |
| 114 | %s = shufflevector <16 x i8> %t, <16 x i8> undef, |
| 115 | <16 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, |
| 116 | i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0> |
| 117 | %a = lshr <16 x i8> %v, %s |
| 118 | ret <16 x i8> %a |
| 119 | } |
| 120 | |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 121 | ; CHECK-LABEL: and_v16i8: |
Thomas Lively | ec71e01 | 2018-08-28 18:33:31 +0000 | [diff] [blame] | 122 | ; NO-SIMD128-NOT: v128 |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 123 | ; SIMD128-NEXT: .param v128, v128{{$}} |
| 124 | ; SIMD128-NEXT: .result v128{{$}} |
| 125 | ; SIMD128-NEXT: v128.and $push0=, $0, $1{{$}} |
| 126 | ; SIMD128-NEXT: return $pop0{{$}} |
Thomas Lively | c174257 | 2018-08-23 00:48:37 +0000 | [diff] [blame] | 127 | define <16 x i8> @and_v16i8(<16 x i8> %x, <16 x i8> %y) { |
| 128 | %a = and <16 x i8> %x, %y |
| 129 | ret <16 x i8> %a |
| 130 | } |
| 131 | |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 132 | ; CHECK-LABEL: or_v16i8: |
Thomas Lively | ec71e01 | 2018-08-28 18:33:31 +0000 | [diff] [blame] | 133 | ; NO-SIMD128-NOT: v128 |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 134 | ; SIMD128-NEXT: .param v128, v128{{$}} |
| 135 | ; SIMD128-NEXT: .result v128{{$}} |
| 136 | ; SIMD128-NEXT: v128.or $push0=, $0, $1{{$}} |
| 137 | ; SIMD128-NEXT: return $pop0{{$}} |
Thomas Lively | c174257 | 2018-08-23 00:48:37 +0000 | [diff] [blame] | 138 | define <16 x i8> @or_v16i8(<16 x i8> %x, <16 x i8> %y) { |
| 139 | %a = or <16 x i8> %x, %y |
| 140 | ret <16 x i8> %a |
| 141 | } |
| 142 | |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 143 | ; CHECK-LABEL: xor_v16i8: |
Thomas Lively | ec71e01 | 2018-08-28 18:33:31 +0000 | [diff] [blame] | 144 | ; NO-SIMD128-NOT: v128 |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 145 | ; SIMD128-NEXT: .param v128, v128{{$}} |
| 146 | ; SIMD128-NEXT: .result v128{{$}} |
| 147 | ; SIMD128-NEXT: v128.xor $push0=, $0, $1{{$}} |
| 148 | ; SIMD128-NEXT: return $pop0{{$}} |
Thomas Lively | c174257 | 2018-08-23 00:48:37 +0000 | [diff] [blame] | 149 | define <16 x i8> @xor_v16i8(<16 x i8> %x, <16 x i8> %y) { |
| 150 | %a = xor <16 x i8> %x, %y |
| 151 | ret <16 x i8> %a |
| 152 | } |
| 153 | |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 154 | ; CHECK-LABEL: not_v16i8: |
Thomas Lively | 995ad61 | 2018-08-28 18:31:15 +0000 | [diff] [blame] | 155 | ; NO-SIMD128-NOT: v128 |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 156 | ; SIMD128-NEXT: .param v128{{$}} |
| 157 | ; SIMD128-NEXT: .result v128{{$}} |
| 158 | ; SIMD128-NEXT: v128.not $push0=, $0{{$}} |
| 159 | ; SIMD128-NEXT: return $pop0{{$}} |
Thomas Lively | 995ad61 | 2018-08-28 18:31:15 +0000 | [diff] [blame] | 160 | define <16 x i8> @not_v16i8(<16 x i8> %x) { |
| 161 | %a = xor <16 x i8> %x, <i8 -1, i8 -1, i8 -1, i8 -1, |
| 162 | i8 -1, i8 -1, i8 -1, i8 -1, |
| 163 | i8 -1, i8 -1, i8 -1, i8 -1, |
| 164 | i8 -1, i8 -1, i8 -1, i8 -1> |
| 165 | ret <16 x i8> %a |
| 166 | } |
| 167 | |
Derek Schuff | 39bf39f | 2016-08-02 23:16:09 +0000 | [diff] [blame] | 168 | ; ============================================================================== |
| 169 | ; 8 x i16 |
| 170 | ; ============================================================================== |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 171 | ; CHECK-LABEL: add_v8i16: |
Derek Schuff | 39bf39f | 2016-08-02 23:16:09 +0000 | [diff] [blame] | 172 | ; NO-SIMD128-NOT: i16x8 |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 173 | ; SIMD128-NEXT: .param v128, v128{{$}} |
| 174 | ; SIMD128-NEXT: .result v128{{$}} |
| 175 | ; SIMD128-NEXT: i16x8.add $push0=, $0, $1{{$}} |
| 176 | ; SIMD128-NEXT: return $pop0{{$}} |
Derek Schuff | 39bf39f | 2016-08-02 23:16:09 +0000 | [diff] [blame] | 177 | define <8 x i16> @add_v8i16(<8 x i16> %x, <8 x i16> %y) { |
| 178 | %a = add <8 x i16> %x, %y |
| 179 | ret <8 x i16> %a |
| 180 | } |
| 181 | |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 182 | ; CHECK-LABEL: sub_v8i16: |
Derek Schuff | 39bf39f | 2016-08-02 23:16:09 +0000 | [diff] [blame] | 183 | ; NO-SIMD128-NOT: i16x8 |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 184 | ; SIMD128-NEXT: .param v128, v128{{$}} |
| 185 | ; SIMD128-NEXT: .result v128{{$}} |
| 186 | ; SIMD128-NEXT: i16x8.sub $push0=, $0, $1{{$}} |
| 187 | ; SIMD128-NEXT: return $pop0{{$}} |
Derek Schuff | 39bf39f | 2016-08-02 23:16:09 +0000 | [diff] [blame] | 188 | define <8 x i16> @sub_v8i16(<8 x i16> %x, <8 x i16> %y) { |
| 189 | %a = sub <8 x i16> %x, %y |
| 190 | ret <8 x i16> %a |
| 191 | } |
| 192 | |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 193 | ; CHECK-LABEL: mul_v8i16: |
Derek Schuff | 39bf39f | 2016-08-02 23:16:09 +0000 | [diff] [blame] | 194 | ; NO-SIMD128-NOT: i16x8 |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 195 | ; SIMD128-NEXT: .param v128, v128{{$}} |
| 196 | ; SIMD128-NEXT: .result v128{{$}} |
| 197 | ; SIMD128-NEXT: i16x8.mul $push0=, $0, $1{{$}} |
| 198 | ; SIMD128-NEXT: return $pop0{{$}} |
Derek Schuff | 39bf39f | 2016-08-02 23:16:09 +0000 | [diff] [blame] | 199 | define <8 x i16> @mul_v8i16(<8 x i16> %x, <8 x i16> %y) { |
| 200 | %a = mul <8 x i16> %x, %y |
| 201 | ret <8 x i16> %a |
| 202 | } |
| 203 | |
Thomas Lively | 88b7443 | 2018-09-14 22:35:12 +0000 | [diff] [blame] | 204 | ; CHECK-LABEL: neg_v8i16: |
| 205 | ; NO-SIMD128-NOT: i16x8 |
| 206 | ; SIMD128-NEXT: .param v128{{$}} |
| 207 | ; SIMD128-NEXT: .result v128{{$}} |
| 208 | ; SIMD128-NEXT: i16x8.neg $push0=, $0{{$}} |
| 209 | ; SIMD128-NEXT: return $pop0{{$}} |
| 210 | define <8 x i16> @neg_v8i16(<8 x i16> %x) { |
| 211 | %a = sub <8 x i16> <i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0>, |
| 212 | %x |
| 213 | ret <8 x i16> %a |
| 214 | } |
| 215 | |
Thomas Lively | f2550e0 | 2018-09-15 00:45:31 +0000 | [diff] [blame^] | 216 | ; CHECK-LABEL: shl_v8i16: |
| 217 | ; NO-SIMD128-NOT: i16x8 |
| 218 | ; SIMD128-NEXT: .param v128, i32{{$}} |
| 219 | ; SIMD128-NEXT: .result v128{{$}} |
| 220 | ; SIMD128-NEXT: i16x8.shl $push0=, $0, $1{{$}} |
| 221 | ; SIMD128-NEXT: return $pop0{{$}} |
| 222 | define <8 x i16> @shl_v8i16(<8 x i16> %v, i16 %x) { |
| 223 | %t = insertelement <8 x i16> undef, i16 %x, i32 0 |
| 224 | %s = shufflevector <8 x i16> %t, <8 x i16> undef, |
| 225 | <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0> |
| 226 | %a = shl <8 x i16> %v, %s |
| 227 | ret <8 x i16> %a |
| 228 | } |
| 229 | |
| 230 | ; CHECK-LABEL: shl_const_v8i16: |
| 231 | ; NO-SIMD128-NOT: i16x8 |
| 232 | ; SIMD128-NEXT: .param v128{{$}} |
| 233 | ; SIMD128-NEXT: .result v128{{$}} |
| 234 | ; SIMD128-NEXT: i32.const $push[[L0:[0-9]+]]=, 5 |
| 235 | ; SIMD128-NEXT: i16x8.shl $push[[R:[0-9]+]]=, $0, $pop[[L0]]{{$}} |
| 236 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
| 237 | define <8 x i16> @shl_const_v8i16(<8 x i16> %v) { |
| 238 | %a = shl <8 x i16> %v, |
| 239 | <i16 5, i16 5, i16 5, i16 5, i16 5, i16 5, i16 5, i16 5> |
| 240 | ret <8 x i16> %a |
| 241 | } |
| 242 | |
| 243 | ; CHECK-LABEL: shr_s_v8i16: |
| 244 | ; NO-SIMD128-NOT: i16x8 |
| 245 | ; SIMD128-NEXT: .param v128, i32{{$}} |
| 246 | ; SIMD128-NEXT: .result v128{{$}} |
| 247 | ; SIMD128-NEXT: i16x8.shr_s $push0=, $0, $1{{$}} |
| 248 | ; SIMD128-NEXT: return $pop0{{$}} |
| 249 | define <8 x i16> @shr_s_v8i16(<8 x i16> %v, i16 %x) { |
| 250 | %t = insertelement <8 x i16> undef, i16 %x, i32 0 |
| 251 | %s = shufflevector <8 x i16> %t, <8 x i16> undef, |
| 252 | <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0> |
| 253 | %a = ashr <8 x i16> %v, %s |
| 254 | ret <8 x i16> %a |
| 255 | } |
| 256 | |
| 257 | ; CHECK-LABEL: shr_u_v8i16: |
| 258 | ; NO-SIMD128-NOT: i16x8 |
| 259 | ; SIMD128-NEXT: .param v128, i32{{$}} |
| 260 | ; SIMD128-NEXT: .result v128{{$}} |
| 261 | ; SIMD128-NEXT: i16x8.shr_u $push0=, $0, $1{{$}} |
| 262 | ; SIMD128-NEXT: return $pop0{{$}} |
| 263 | define <8 x i16> @shr_u_v8i16(<8 x i16> %v, i16 %x) { |
| 264 | %t = insertelement <8 x i16> undef, i16 %x, i32 0 |
| 265 | %s = shufflevector <8 x i16> %t, <8 x i16> undef, |
| 266 | <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0> |
| 267 | %a = lshr <8 x i16> %v, %s |
| 268 | ret <8 x i16> %a |
| 269 | } |
| 270 | |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 271 | ; CHECK-LABEL: and_v8i16: |
Thomas Lively | ec71e01 | 2018-08-28 18:33:31 +0000 | [diff] [blame] | 272 | ; NO-SIMD128-NOT: v128 |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 273 | ; SIMD128-NEXT: .param v128, v128{{$}} |
| 274 | ; SIMD128-NEXT: .result v128{{$}} |
| 275 | ; SIMD128-NEXT: v128.and $push0=, $0, $1{{$}} |
| 276 | ; SIMD128-NEXT: return $pop0{{$}} |
Thomas Lively | c174257 | 2018-08-23 00:48:37 +0000 | [diff] [blame] | 277 | define <8 x i16> @and_v8i16(<8 x i16> %x, <8 x i16> %y) { |
| 278 | %a = and <8 x i16> %x, %y |
| 279 | ret <8 x i16> %a |
| 280 | } |
| 281 | |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 282 | ; CHECK-LABEL: or_v8i16: |
Thomas Lively | ec71e01 | 2018-08-28 18:33:31 +0000 | [diff] [blame] | 283 | ; NO-SIMD128-NOT: v128 |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 284 | ; SIMD128-NEXT: .param v128, v128{{$}} |
| 285 | ; SIMD128-NEXT: .result v128{{$}} |
| 286 | ; SIMD128-NEXT: v128.or $push0=, $0, $1{{$}} |
| 287 | ; SIMD128-NEXT: return $pop0{{$}} |
Thomas Lively | c174257 | 2018-08-23 00:48:37 +0000 | [diff] [blame] | 288 | define <8 x i16> @or_v8i16(<8 x i16> %x, <8 x i16> %y) { |
| 289 | %a = or <8 x i16> %x, %y |
| 290 | ret <8 x i16> %a |
| 291 | } |
| 292 | |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 293 | ; CHECK-LABEL: xor_v8i16: |
Thomas Lively | ec71e01 | 2018-08-28 18:33:31 +0000 | [diff] [blame] | 294 | ; NO-SIMD128-NOT: v128 |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 295 | ; SIMD128-NEXT: .param v128, v128{{$}} |
| 296 | ; SIMD128-NEXT: .result v128{{$}} |
| 297 | ; SIMD128-NEXT: v128.xor $push0=, $0, $1{{$}} |
| 298 | ; SIMD128-NEXT: return $pop0{{$}} |
Thomas Lively | c174257 | 2018-08-23 00:48:37 +0000 | [diff] [blame] | 299 | define <8 x i16> @xor_v8i16(<8 x i16> %x, <8 x i16> %y) { |
| 300 | %a = xor <8 x i16> %x, %y |
| 301 | ret <8 x i16> %a |
| 302 | } |
| 303 | |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 304 | ; CHECK-LABEL: not_v8i16: |
Thomas Lively | 995ad61 | 2018-08-28 18:31:15 +0000 | [diff] [blame] | 305 | ; NO-SIMD128-NOT: v128 |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 306 | ; SIMD128-NEXT: .param v128{{$}} |
| 307 | ; SIMD128-NEXT: .result v128{{$}} |
| 308 | ; SIMD128-NEXT: v128.not $push0=, $0{{$}} |
| 309 | ; SIMD128-NEXT: return $pop0{{$}} |
Thomas Lively | 995ad61 | 2018-08-28 18:31:15 +0000 | [diff] [blame] | 310 | define <8 x i16> @not_v8i16(<8 x i16> %x) { |
| 311 | %a = xor <8 x i16> %x, <i16 -1, i16 -1, i16 -1, i16 -1, |
| 312 | i16 -1, i16 -1, i16 -1, i16 -1> |
| 313 | ret <8 x i16> %a |
| 314 | } |
| 315 | |
Derek Schuff | 39bf39f | 2016-08-02 23:16:09 +0000 | [diff] [blame] | 316 | ; ============================================================================== |
| 317 | ; 4 x i32 |
| 318 | ; ============================================================================== |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 319 | ; CHECK-LABEL: add_v4i32: |
Derek Schuff | 39bf39f | 2016-08-02 23:16:09 +0000 | [diff] [blame] | 320 | ; NO-SIMD128-NOT: i32x4 |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 321 | ; SIMD128-NEXT: .param v128, v128{{$}} |
| 322 | ; SIMD128-NEXT: .result v128{{$}} |
| 323 | ; SIMD128-NEXT: i32x4.add $push0=, $0, $1{{$}} |
| 324 | ; SIMD128-NEXT: return $pop0{{$}} |
Derek Schuff | 39bf39f | 2016-08-02 23:16:09 +0000 | [diff] [blame] | 325 | define <4 x i32> @add_v4i32(<4 x i32> %x, <4 x i32> %y) { |
| 326 | %a = add <4 x i32> %x, %y |
| 327 | ret <4 x i32> %a |
| 328 | } |
| 329 | |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 330 | ; CHECK-LABEL: sub_v4i32: |
Derek Schuff | 39bf39f | 2016-08-02 23:16:09 +0000 | [diff] [blame] | 331 | ; NO-SIMD128-NOT: i32x4 |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 332 | ; SIMD128-NEXT: .param v128, v128{{$}} |
| 333 | ; SIMD128-NEXT: .result v128{{$}} |
| 334 | ; SIMD128-NEXT: i32x4.sub $push0=, $0, $1{{$}} |
| 335 | ; SIMD128-NEXT: return $pop0{{$}} |
Derek Schuff | 39bf39f | 2016-08-02 23:16:09 +0000 | [diff] [blame] | 336 | define <4 x i32> @sub_v4i32(<4 x i32> %x, <4 x i32> %y) { |
| 337 | %a = sub <4 x i32> %x, %y |
| 338 | ret <4 x i32> %a |
| 339 | } |
| 340 | |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 341 | ; CHECK-LABEL: mul_v4i32: |
Derek Schuff | 39bf39f | 2016-08-02 23:16:09 +0000 | [diff] [blame] | 342 | ; NO-SIMD128-NOT: i32x4 |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 343 | ; SIMD128-NEXT: .param v128, v128{{$}} |
| 344 | ; SIMD128-NEXT: .result v128{{$}} |
| 345 | ; SIMD128-NEXT: i32x4.mul $push0=, $0, $1{{$}} |
| 346 | ; SIMD128-NEXT: return $pop0{{$}} |
Derek Schuff | 39bf39f | 2016-08-02 23:16:09 +0000 | [diff] [blame] | 347 | define <4 x i32> @mul_v4i32(<4 x i32> %x, <4 x i32> %y) { |
| 348 | %a = mul <4 x i32> %x, %y |
| 349 | ret <4 x i32> %a |
| 350 | } |
| 351 | |
Thomas Lively | 88b7443 | 2018-09-14 22:35:12 +0000 | [diff] [blame] | 352 | ; CHECK-LABEL: neg_v4i32: |
| 353 | ; NO-SIMD128-NOT: i32x4 |
| 354 | ; SIMD128-NEXT: .param v128{{$}} |
| 355 | ; SIMD128-NEXT: .result v128{{$}} |
| 356 | ; SIMD128-NEXT: i32x4.neg $push0=, $0{{$}} |
| 357 | ; SIMD128-NEXT: return $pop0{{$}} |
| 358 | define <4 x i32> @neg_v4i32(<4 x i32> %x) { |
| 359 | %a = sub <4 x i32> <i32 0, i32 0, i32 0, i32 0>, %x |
| 360 | ret <4 x i32> %a |
| 361 | } |
| 362 | |
Thomas Lively | f2550e0 | 2018-09-15 00:45:31 +0000 | [diff] [blame^] | 363 | ; CHECK-LABEL: shl_v4i32: |
| 364 | ; NO-SIMD128-NOT: i32x4 |
| 365 | ; SIMD128-NEXT: .param v128, i32{{$}} |
| 366 | ; SIMD128-NEXT: .result v128{{$}} |
| 367 | ; SIMD128-NEXT: i32x4.shl $push0=, $0, $1{{$}} |
| 368 | ; SIMD128-NEXT: return $pop0{{$}} |
| 369 | define <4 x i32> @shl_v4i32(<4 x i32> %v, i32 %x) { |
| 370 | %t = insertelement <4 x i32> undef, i32 %x, i32 0 |
| 371 | %s = shufflevector <4 x i32> %t, <4 x i32> undef, |
| 372 | <4 x i32> <i32 0, i32 0, i32 0, i32 0> |
| 373 | %a = shl <4 x i32> %v, %s |
| 374 | ret <4 x i32> %a |
| 375 | } |
| 376 | |
| 377 | ; CHECK-LABEL: shl_const_v4i32: |
| 378 | ; NO-SIMD128-NOT: i32x4 |
| 379 | ; SIMD128-NEXT: .param v128{{$}} |
| 380 | ; SIMD128-NEXT: .result v128{{$}} |
| 381 | ; SIMD128-NEXT: i32.const $push[[L0:[0-9]+]]=, 5 |
| 382 | ; SIMD128-NEXT: i32x4.shl $push[[R:[0-9]+]]=, $0, $pop[[L0]]{{$}} |
| 383 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
| 384 | define <4 x i32> @shl_const_v4i32(<4 x i32> %v) { |
| 385 | %a = shl <4 x i32> %v, <i32 5, i32 5, i32 5, i32 5> |
| 386 | ret <4 x i32> %a |
| 387 | } |
| 388 | |
| 389 | ; CHECK-LABEL: shr_s_v4i32: |
| 390 | ; NO-SIMD128-NOT: i32x4 |
| 391 | ; SIMD128-NEXT: .param v128, i32{{$}} |
| 392 | ; SIMD128-NEXT: .result v128{{$}} |
| 393 | ; SIMD128-NEXT: i32x4.shr_s $push0=, $0, $1{{$}} |
| 394 | ; SIMD128-NEXT: return $pop0{{$}} |
| 395 | define <4 x i32> @shr_s_v4i32(<4 x i32> %v, i32 %x) { |
| 396 | %t = insertelement <4 x i32> undef, i32 %x, i32 0 |
| 397 | %s = shufflevector <4 x i32> %t, <4 x i32> undef, |
| 398 | <4 x i32> <i32 0, i32 0, i32 0, i32 0> |
| 399 | %a = ashr <4 x i32> %v, %s |
| 400 | ret <4 x i32> %a |
| 401 | } |
| 402 | |
| 403 | ; CHECK-LABEL: shr_u_v4i32: |
| 404 | ; NO-SIMD128-NOT: i32x4 |
| 405 | ; SIMD128-NEXT: .param v128, i32{{$}} |
| 406 | ; SIMD128-NEXT: .result v128{{$}} |
| 407 | ; SIMD128-NEXT: i32x4.shr_u $push0=, $0, $1{{$}} |
| 408 | ; SIMD128-NEXT: return $pop0{{$}} |
| 409 | define <4 x i32> @shr_u_v4i32(<4 x i32> %v, i32 %x) { |
| 410 | %t = insertelement <4 x i32> undef, i32 %x, i32 0 |
| 411 | %s = shufflevector <4 x i32> %t, <4 x i32> undef, |
| 412 | <4 x i32> <i32 0, i32 0, i32 0, i32 0> |
| 413 | %a = lshr <4 x i32> %v, %s |
| 414 | ret <4 x i32> %a |
| 415 | } |
| 416 | |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 417 | ; CHECK-LABEL: and_v4i32: |
Thomas Lively | ec71e01 | 2018-08-28 18:33:31 +0000 | [diff] [blame] | 418 | ; NO-SIMD128-NOT: v128 |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 419 | ; SIMD128-NEXT: .param v128, v128{{$}} |
| 420 | ; SIMD128-NEXT: .result v128{{$}} |
| 421 | ; SIMD128-NEXT: v128.and $push0=, $0, $1{{$}} |
| 422 | ; SIMD128-NEXT: return $pop0{{$}} |
Thomas Lively | c174257 | 2018-08-23 00:48:37 +0000 | [diff] [blame] | 423 | define <4 x i32> @and_v4i32(<4 x i32> %x, <4 x i32> %y) { |
| 424 | %a = and <4 x i32> %x, %y |
| 425 | ret <4 x i32> %a |
| 426 | } |
| 427 | |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 428 | ; CHECK-LABEL: or_v4i32: |
Thomas Lively | ec71e01 | 2018-08-28 18:33:31 +0000 | [diff] [blame] | 429 | ; NO-SIMD128-NOT: v128 |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 430 | ; SIMD128-NEXT: .param v128, v128{{$}} |
| 431 | ; SIMD128-NEXT: .result v128{{$}} |
| 432 | ; SIMD128-NEXT: v128.or $push0=, $0, $1{{$}} |
| 433 | ; SIMD128-NEXT: return $pop0{{$}} |
Thomas Lively | c174257 | 2018-08-23 00:48:37 +0000 | [diff] [blame] | 434 | define <4 x i32> @or_v4i32(<4 x i32> %x, <4 x i32> %y) { |
| 435 | %a = or <4 x i32> %x, %y |
| 436 | ret <4 x i32> %a |
| 437 | } |
| 438 | |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 439 | ; CHECK-LABEL: xor_v4i32: |
Thomas Lively | ec71e01 | 2018-08-28 18:33:31 +0000 | [diff] [blame] | 440 | ; NO-SIMD128-NOT: v128 |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 441 | ; SIMD128-NEXT: .param v128, v128{{$}} |
| 442 | ; SIMD128-NEXT: .result v128{{$}} |
| 443 | ; SIMD128-NEXT: v128.xor $push0=, $0, $1{{$}} |
| 444 | ; SIMD128-NEXT: return $pop0{{$}} |
Thomas Lively | c174257 | 2018-08-23 00:48:37 +0000 | [diff] [blame] | 445 | define <4 x i32> @xor_v4i32(<4 x i32> %x, <4 x i32> %y) { |
| 446 | %a = xor <4 x i32> %x, %y |
| 447 | ret <4 x i32> %a |
| 448 | } |
| 449 | |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 450 | ; CHECK-LABEL: not_v4i32: |
Thomas Lively | 995ad61 | 2018-08-28 18:31:15 +0000 | [diff] [blame] | 451 | ; NO-SIMD128-NOT: v128 |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 452 | ; SIMD128-NEXT: .param v128{{$}} |
| 453 | ; SIMD128-NEXT: .result v128{{$}} |
| 454 | ; SIMD128-NEXT: v128.not $push0=, $0{{$}} |
| 455 | ; SIMD128-NEXT: return $pop0{{$}} |
Thomas Lively | 995ad61 | 2018-08-28 18:31:15 +0000 | [diff] [blame] | 456 | define <4 x i32> @not_v4i32(<4 x i32> %x) { |
| 457 | %a = xor <4 x i32> %x, <i32 -1, i32 -1, i32 -1, i32 -1> |
| 458 | ret <4 x i32> %a |
| 459 | } |
| 460 | |
Derek Schuff | 39bf39f | 2016-08-02 23:16:09 +0000 | [diff] [blame] | 461 | ; ============================================================================== |
Derek Schuff | 51ed131 | 2018-08-07 21:24:01 +0000 | [diff] [blame] | 462 | ; 2 x i64 |
| 463 | ; ============================================================================== |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 464 | ; CHECK-LABEL: add_v2i64: |
Derek Schuff | 51ed131 | 2018-08-07 21:24:01 +0000 | [diff] [blame] | 465 | ; NO-SIMD128-NOT: i64x2 |
Heejin Ahn | 5831e9c | 2018-08-09 23:58:51 +0000 | [diff] [blame] | 466 | ; SIMD128-VM-NOT: i64x2 |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 467 | ; SIMD128-NEXT: .param v128, v128{{$}} |
| 468 | ; SIMD128-NEXT: .result v128{{$}} |
| 469 | ; SIMD128-NEXT: i64x2.add $push0=, $0, $1{{$}} |
| 470 | ; SIMD128-NEXT: return $pop0{{$}} |
Derek Schuff | 51ed131 | 2018-08-07 21:24:01 +0000 | [diff] [blame] | 471 | define <2 x i64> @add_v2i64(<2 x i64> %x, <2 x i64> %y) { |
| 472 | %a = add <2 x i64> %x, %y |
| 473 | ret <2 x i64> %a |
| 474 | } |
| 475 | |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 476 | ; CHECK-LABEL: sub_v2i64: |
Derek Schuff | 51ed131 | 2018-08-07 21:24:01 +0000 | [diff] [blame] | 477 | ; NO-SIMD128-NOT: i64x2 |
Heejin Ahn | 5831e9c | 2018-08-09 23:58:51 +0000 | [diff] [blame] | 478 | ; SIMD128-VM-NOT: i64x2 |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 479 | ; SIMD128-NEXT: .param v128, v128{{$}} |
| 480 | ; SIMD128-NEXT: .result v128{{$}} |
| 481 | ; SIMD128-NEXT: i64x2.sub $push0=, $0, $1{{$}} |
| 482 | ; SIMD128-NEXT: return $pop0{{$}} |
Derek Schuff | 51ed131 | 2018-08-07 21:24:01 +0000 | [diff] [blame] | 483 | define <2 x i64> @sub_v2i64(<2 x i64> %x, <2 x i64> %y) { |
| 484 | %a = sub <2 x i64> %x, %y |
| 485 | ret <2 x i64> %a |
| 486 | } |
| 487 | |
Thomas Lively | 2ee686d | 2018-08-22 23:06:27 +0000 | [diff] [blame] | 488 | ; v2i64.mul is not in spec |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 489 | ; CHECK-LABEL: mul_v2i64: |
Derek Schuff | 51ed131 | 2018-08-07 21:24:01 +0000 | [diff] [blame] | 490 | ; NO-SIMD128-NOT: i64x2 |
Heejin Ahn | 5831e9c | 2018-08-09 23:58:51 +0000 | [diff] [blame] | 491 | ; SIMD128-VM-NOT: i64x2 |
Thomas Lively | 2ee686d | 2018-08-22 23:06:27 +0000 | [diff] [blame] | 492 | ; SIMD128-NOT: i64x2.mul |
| 493 | ; SIMD128: i64x2.extract_lane |
| 494 | ; SIMD128: i64.mul |
Derek Schuff | 51ed131 | 2018-08-07 21:24:01 +0000 | [diff] [blame] | 495 | define <2 x i64> @mul_v2i64(<2 x i64> %x, <2 x i64> %y) { |
| 496 | %a = mul <2 x i64> %x, %y |
| 497 | ret <2 x i64> %a |
| 498 | } |
| 499 | |
Thomas Lively | 88b7443 | 2018-09-14 22:35:12 +0000 | [diff] [blame] | 500 | ; CHECK-LABEL: neg_v2i64: |
| 501 | ; NO-SIMD128-NOT: i64x2 |
| 502 | ; SIMD128-NEXT: .param v128{{$}} |
| 503 | ; SIMD128-NEXT: .result v128{{$}} |
| 504 | ; SIMD128-NEXT: i64x2.neg $push0=, $0{{$}} |
| 505 | ; SIMD128-NEXT: return $pop0{{$}} |
| 506 | define <2 x i64> @neg_v2i64(<2 x i64> %x) { |
| 507 | %a = sub <2 x i64> <i64 0, i64 0>, %x |
| 508 | ret <2 x i64> %a |
| 509 | } |
| 510 | |
Thomas Lively | f2550e0 | 2018-09-15 00:45:31 +0000 | [diff] [blame^] | 511 | ; CHECK-LABEL: shl_v2i64: |
| 512 | ; NO-SIMD128-NOT: i64x2 |
| 513 | ; SIMD128-NEXT: .param v128, i32{{$}} |
| 514 | ; SIMD128-NEXT: .result v128{{$}} |
| 515 | ; SIMD128-NEXT: i64x2.shl $push0=, $0, $1{{$}} |
| 516 | ; SIMD128-NEXT: return $pop0{{$}} |
| 517 | define <2 x i64> @shl_v2i64(<2 x i64> %v, i32 %x) { |
| 518 | %x2 = zext i32 %x to i64 |
| 519 | %t = insertelement <2 x i64> undef, i64 %x2, i32 0 |
| 520 | %s = shufflevector <2 x i64> %t, <2 x i64> undef, <2 x i32> <i32 0, i32 0> |
| 521 | %a = shl <2 x i64> %v, %s |
| 522 | ret <2 x i64> %a |
| 523 | } |
| 524 | |
| 525 | ; CHECK-LABEL: shl_nozext_v2i64: |
| 526 | ; NO-SIMD128-NOT: i64x2 |
| 527 | ; SIMD128-NEXT: .param v128, i64{{$}} |
| 528 | ; SIMD128-NEXT: .result v128{{$}} |
| 529 | ; SIMD128-NEXT: i32.wrap/i64 $push[[L0:[0-9]+]]=, $1{{$}} |
| 530 | ; SIMD128-NEXT: i64x2.shl $push[[R:[0-9]+]]=, $0, $pop[[L0]]{{$}} |
| 531 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
| 532 | define <2 x i64> @shl_nozext_v2i64(<2 x i64> %v, i64 %x) { |
| 533 | %t = insertelement <2 x i64> undef, i64 %x, i32 0 |
| 534 | %s = shufflevector <2 x i64> %t, <2 x i64> undef, <2 x i32> <i32 0, i32 0> |
| 535 | %a = shl <2 x i64> %v, %s |
| 536 | ret <2 x i64> %a |
| 537 | } |
| 538 | |
| 539 | ; CHECK-LABEL: shl_const_v2i64: |
| 540 | ; NO-SIMD128-NOT: i64x2 |
| 541 | ; SIMD128-NEXT: .param v128{{$}} |
| 542 | ; SIMD128-NEXT: .result v128{{$}} |
| 543 | ; SIMD128-NEXT: i64.const $push[[L0:[0-9]+]]=, 5{{$}} |
| 544 | ; SIMD128-NEXT: i32.wrap/i64 $push[[L1:[0-9]+]]=, $pop[[L0]]{{$}} |
| 545 | ; SIMD128-NEXT: i64x2.shl $push[[R:[0-9]+]]=, $0, $pop[[L1]]{{$}} |
| 546 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
| 547 | define <2 x i64> @shl_const_v2i64(<2 x i64> %v) { |
| 548 | %a = shl <2 x i64> %v, <i64 5, i64 5> |
| 549 | ret <2 x i64> %a |
| 550 | } |
| 551 | |
| 552 | ; CHECK-LABEL: shr_s_v2i64: |
| 553 | ; NO-SIMD128-NOT: i64x2 |
| 554 | ; SIMD128-NEXT: .param v128, i32{{$}} |
| 555 | ; SIMD128-NEXT: .result v128{{$}} |
| 556 | ; SIMD128-NEXT: i64x2.shr_s $push0=, $0, $1{{$}} |
| 557 | ; SIMD128-NEXT: return $pop0{{$}} |
| 558 | define <2 x i64> @shr_s_v2i64(<2 x i64> %v, i32 %x) { |
| 559 | %x2 = zext i32 %x to i64 |
| 560 | %t = insertelement <2 x i64> undef, i64 %x2, i32 0 |
| 561 | %s = shufflevector <2 x i64> %t, <2 x i64> undef, <2 x i32> <i32 0, i32 0> |
| 562 | %a = ashr <2 x i64> %v, %s |
| 563 | ret <2 x i64> %a |
| 564 | } |
| 565 | |
| 566 | ; CHECK-LABEL: shr_s_nozext_v2i64: |
| 567 | ; NO-SIMD128-NOT: i64x2 |
| 568 | ; SIMD128-NEXT: .param v128, i64{{$}} |
| 569 | ; SIMD128-NEXT: .result v128{{$}} |
| 570 | ; SIMD128-NEXT: i32.wrap/i64 $push[[L0:[0-9]+]]=, $1{{$}} |
| 571 | ; SIMD128-NEXT: i64x2.shr_s $push[[R:[0-9]+]]=, $0, $pop[[L0]]{{$}} |
| 572 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
| 573 | define <2 x i64> @shr_s_nozext_v2i64(<2 x i64> %v, i64 %x) { |
| 574 | %t = insertelement <2 x i64> undef, i64 %x, i32 0 |
| 575 | %s = shufflevector <2 x i64> %t, <2 x i64> undef, <2 x i32> <i32 0, i32 0> |
| 576 | %a = ashr <2 x i64> %v, %s |
| 577 | ret <2 x i64> %a |
| 578 | } |
| 579 | |
| 580 | ; CHECK-LABEL: shr_u_v2i64: |
| 581 | ; NO-SIMD128-NOT: i64x2 |
| 582 | ; SIMD128-NEXT: .param v128, i32{{$}} |
| 583 | ; SIMD128-NEXT: .result v128{{$}} |
| 584 | ; SIMD128-NEXT: i64x2.shr_u $push0=, $0, $1{{$}} |
| 585 | ; SIMD128-NEXT: return $pop0{{$}} |
| 586 | define <2 x i64> @shr_u_v2i64(<2 x i64> %v, i32 %x) { |
| 587 | %x2 = zext i32 %x to i64 |
| 588 | %t = insertelement <2 x i64> undef, i64 %x2, i32 0 |
| 589 | %s = shufflevector <2 x i64> %t, <2 x i64> undef, <2 x i32> <i32 0, i32 0> |
| 590 | %a = lshr <2 x i64> %v, %s |
| 591 | ret <2 x i64> %a |
| 592 | } |
| 593 | |
| 594 | ; CHECK-LABEL: shr_u_nozext_v2i64: |
| 595 | ; NO-SIMD128-NOT: i64x2 |
| 596 | ; SIMD128-NEXT: .param v128, i64{{$}} |
| 597 | ; SIMD128-NEXT: .result v128{{$}} |
| 598 | ; SIMD128-NEXT: i32.wrap/i64 $push[[L0:[0-9]+]]=, $1{{$}} |
| 599 | ; SIMD128-NEXT: i64x2.shr_u $push[[R:[0-9]+]]=, $0, $pop[[L0]]{{$}} |
| 600 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
| 601 | define <2 x i64> @shr_u_nozext_v2i64(<2 x i64> %v, i64 %x) { |
| 602 | %t = insertelement <2 x i64> undef, i64 %x, i32 0 |
| 603 | %s = shufflevector <2 x i64> %t, <2 x i64> undef, <2 x i32> <i32 0, i32 0> |
| 604 | %a = lshr <2 x i64> %v, %s |
| 605 | ret <2 x i64> %a |
| 606 | } |
| 607 | |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 608 | ; CHECK-LABEL: and_v2i64: |
Thomas Lively | ec71e01 | 2018-08-28 18:33:31 +0000 | [diff] [blame] | 609 | ; NO-SIMD128-NOT: v128 |
| 610 | ; SIMD128-VM-NOT: v128 |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 611 | ; SIMD128-NEXT: .param v128, v128{{$}} |
| 612 | ; SIMD128-NEXT: .result v128{{$}} |
| 613 | ; SIMD128-NEXT: v128.and $push0=, $0, $1{{$}} |
| 614 | ; SIMD128-NEXT: return $pop0{{$}} |
Thomas Lively | c174257 | 2018-08-23 00:48:37 +0000 | [diff] [blame] | 615 | define <2 x i64> @and_v2i64(<2 x i64> %x, <2 x i64> %y) { |
| 616 | %a = and <2 x i64> %x, %y |
| 617 | ret <2 x i64> %a |
| 618 | } |
| 619 | |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 620 | ; CHECK-LABEL: or_v2i64: |
Thomas Lively | ec71e01 | 2018-08-28 18:33:31 +0000 | [diff] [blame] | 621 | ; NO-SIMD128-NOT: v128 |
| 622 | ; SIMD128-VM-NOT: v128 |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 623 | ; SIMD128-NEXT: .param v128, v128{{$}} |
| 624 | ; SIMD128-NEXT: .result v128{{$}} |
| 625 | ; SIMD128-NEXT: v128.or $push0=, $0, $1{{$}} |
| 626 | ; SIMD128-NEXT: return $pop0{{$}} |
Thomas Lively | c174257 | 2018-08-23 00:48:37 +0000 | [diff] [blame] | 627 | define <2 x i64> @or_v2i64(<2 x i64> %x, <2 x i64> %y) { |
| 628 | %a = or <2 x i64> %x, %y |
| 629 | ret <2 x i64> %a |
| 630 | } |
| 631 | |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 632 | ; CHECK-LABEL: xor_v2i64: |
Thomas Lively | ec71e01 | 2018-08-28 18:33:31 +0000 | [diff] [blame] | 633 | ; NO-SIMD128-NOT: v128 |
| 634 | ; SIMD128-VM-NOT: v128 |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 635 | ; SIMD128-NEXT: .param v128, v128{{$}} |
| 636 | ; SIMD128-NEXT: .result v128{{$}} |
| 637 | ; SIMD128-NEXT: v128.xor $push0=, $0, $1{{$}} |
| 638 | ; SIMD128-NEXT: return $pop0{{$}} |
Thomas Lively | c174257 | 2018-08-23 00:48:37 +0000 | [diff] [blame] | 639 | define <2 x i64> @xor_v2i64(<2 x i64> %x, <2 x i64> %y) { |
| 640 | %a = xor <2 x i64> %x, %y |
| 641 | ret <2 x i64> %a |
| 642 | } |
| 643 | |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 644 | ; CHECK-LABEL: not_v2i64: |
Thomas Lively | 995ad61 | 2018-08-28 18:31:15 +0000 | [diff] [blame] | 645 | ; NO-SIMD128-NOT: v128 |
| 646 | ; SIMD128-VM-NOT: v128 |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 647 | ; SIMD128-NEXT: .param v128{{$}} |
| 648 | ; SIMD128-NEXT: .result v128{{$}} |
| 649 | ; SIMD128-NEXT: v128.not $push0=, $0{{$}} |
| 650 | ; SIMD128-NEXT: return $pop0{{$}} |
Thomas Lively | 995ad61 | 2018-08-28 18:31:15 +0000 | [diff] [blame] | 651 | define <2 x i64> @not_v2i64(<2 x i64> %x) { |
| 652 | %a = xor <2 x i64> %x, <i64 -1, i64 -1> |
| 653 | ret <2 x i64> %a |
| 654 | } |
| 655 | |
Derek Schuff | 51ed131 | 2018-08-07 21:24:01 +0000 | [diff] [blame] | 656 | ; ============================================================================== |
Derek Schuff | 39bf39f | 2016-08-02 23:16:09 +0000 | [diff] [blame] | 657 | ; 4 x float |
| 658 | ; ============================================================================== |
Thomas Lively | 88b7443 | 2018-09-14 22:35:12 +0000 | [diff] [blame] | 659 | ; CHECK-LABEL: neg_v4f32: |
| 660 | ; NO-SIMD128-NOT: f32x4 |
| 661 | ; SIMD128-NEXT: .param v128{{$}} |
| 662 | ; SIMD128-NEXT: .result v128{{$}} |
| 663 | ; SIMD128-NEXT: f32x4.neg $push0=, $0{{$}} |
| 664 | ; SIMD128-NEXT: return $pop0{{$}} |
| 665 | define <4 x float> @neg_v4f32(<4 x float> %x) { |
| 666 | %a = fsub <4 x float> <float 0., float 0., float 0., float 0.>, %x |
| 667 | ret <4 x float> %a |
| 668 | } |
| 669 | |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 670 | ; CHECK-LABEL: add_v4f32: |
Derek Schuff | 39bf39f | 2016-08-02 23:16:09 +0000 | [diff] [blame] | 671 | ; NO-SIMD128-NOT: f32x4 |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 672 | ; SIMD128-NEXT: .param v128, v128{{$}} |
| 673 | ; SIMD128-NEXT: .result v128{{$}} |
| 674 | ; SIMD128-NEXT: f32x4.add $push0=, $0, $1{{$}} |
| 675 | ; SIMD128-NEXT: return $pop0{{$}} |
Derek Schuff | 39bf39f | 2016-08-02 23:16:09 +0000 | [diff] [blame] | 676 | define <4 x float> @add_v4f32(<4 x float> %x, <4 x float> %y) { |
| 677 | %a = fadd <4 x float> %x, %y |
| 678 | ret <4 x float> %a |
| 679 | } |
| 680 | |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 681 | ; CHECK-LABEL: sub_v4f32: |
Derek Schuff | 39bf39f | 2016-08-02 23:16:09 +0000 | [diff] [blame] | 682 | ; NO-SIMD128-NOT: f32x4 |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 683 | ; SIMD128-NEXT: .param v128, v128{{$}} |
| 684 | ; SIMD128-NEXT: .result v128{{$}} |
| 685 | ; SIMD128-NEXT: f32x4.sub $push0=, $0, $1{{$}} |
| 686 | ; SIMD128-NEXT: return $pop0{{$}} |
Derek Schuff | 39bf39f | 2016-08-02 23:16:09 +0000 | [diff] [blame] | 687 | define <4 x float> @sub_v4f32(<4 x float> %x, <4 x float> %y) { |
| 688 | %a = fsub <4 x float> %x, %y |
| 689 | ret <4 x float> %a |
| 690 | } |
| 691 | |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 692 | ; CHECK-LABEL: div_v4f32: |
Derek Schuff | 51ed131 | 2018-08-07 21:24:01 +0000 | [diff] [blame] | 693 | ; NO-SIMD128-NOT: f32x4 |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 694 | ; SIMD128-NEXT: .param v128, v128{{$}} |
| 695 | ; SIMD128-NEXT: .result v128{{$}} |
| 696 | ; SIMD128-NEXT: f32x4.div $push0=, $0, $1{{$}} |
| 697 | ; SIMD128-NEXT: return $pop0{{$}} |
Derek Schuff | 51ed131 | 2018-08-07 21:24:01 +0000 | [diff] [blame] | 698 | define <4 x float> @div_v4f32(<4 x float> %x, <4 x float> %y) { |
| 699 | %a = fdiv <4 x float> %x, %y |
| 700 | ret <4 x float> %a |
| 701 | } |
| 702 | |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 703 | ; CHECK-LABEL: mul_v4f32: |
Derek Schuff | 39bf39f | 2016-08-02 23:16:09 +0000 | [diff] [blame] | 704 | ; NO-SIMD128-NOT: f32x4 |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 705 | ; SIMD128-NEXT: .param v128, v128{{$}} |
| 706 | ; SIMD128-NEXT: .result v128{{$}} |
| 707 | ; SIMD128-NEXT: f32x4.mul $push0=, $0, $1{{$}} |
| 708 | ; SIMD128-NEXT: return $pop0{{$}} |
Derek Schuff | 39bf39f | 2016-08-02 23:16:09 +0000 | [diff] [blame] | 709 | define <4 x float> @mul_v4f32(<4 x float> %x, <4 x float> %y) { |
| 710 | %a = fmul <4 x float> %x, %y |
| 711 | ret <4 x float> %a |
| 712 | } |
| 713 | |
Derek Schuff | 51ed131 | 2018-08-07 21:24:01 +0000 | [diff] [blame] | 714 | ; ============================================================================== |
| 715 | ; 2 x double |
| 716 | ; ============================================================================== |
Thomas Lively | 88b7443 | 2018-09-14 22:35:12 +0000 | [diff] [blame] | 717 | ; CHECK-LABEL: neg_v2f64: |
| 718 | ; NO-SIMD128-NOT: f64x2 |
| 719 | ; SIMD128-NEXT: .param v128{{$}} |
| 720 | ; SIMD128-NEXT: .result v128{{$}} |
| 721 | ; SIMD128-NEXT: f64x2.neg $push0=, $0{{$}} |
| 722 | ; SIMD128-NEXT: return $pop0{{$}} |
| 723 | define <2 x double> @neg_v2f64(<2 x double> %x) { |
| 724 | %a = fsub <2 x double> <double 0., double 0.>, %x |
| 725 | ret <2 x double> %a |
| 726 | } |
| 727 | |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 728 | ; CHECK-LABEL: add_v2f64: |
Derek Schuff | 51ed131 | 2018-08-07 21:24:01 +0000 | [diff] [blame] | 729 | ; NO-SIMD128-NOT: f64x2 |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 730 | ; SIMD128-VM-NOT: f62x2 |
| 731 | ; SIMD128-NEXT: .param v128, v128{{$}} |
| 732 | ; SIMD128-NEXT: .result v128{{$}} |
| 733 | ; SIMD128-NEXT: f64x2.add $push0=, $0, $1{{$}} |
| 734 | ; SIMD128-NEXT: return $pop0{{$}} |
Derek Schuff | 51ed131 | 2018-08-07 21:24:01 +0000 | [diff] [blame] | 735 | define <2 x double> @add_v2f64(<2 x double> %x, <2 x double> %y) { |
| 736 | %a = fadd <2 x double> %x, %y |
| 737 | ret <2 x double> %a |
| 738 | } |
| 739 | |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 740 | ; CHECK-LABEL: sub_v2f64: |
Derek Schuff | 51ed131 | 2018-08-07 21:24:01 +0000 | [diff] [blame] | 741 | ; NO-SIMD128-NOT: f64x2 |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 742 | ; SIMD128-VM-NOT: f62x2 |
| 743 | ; SIMD128-NEXT: .param v128, v128{{$}} |
| 744 | ; SIMD128-NEXT: .result v128{{$}} |
| 745 | ; SIMD128-NEXT: f64x2.sub $push0=, $0, $1{{$}} |
| 746 | ; SIMD128-NEXT: return $pop0{{$}} |
Derek Schuff | 51ed131 | 2018-08-07 21:24:01 +0000 | [diff] [blame] | 747 | define <2 x double> @sub_v2f64(<2 x double> %x, <2 x double> %y) { |
| 748 | %a = fsub <2 x double> %x, %y |
| 749 | ret <2 x double> %a |
| 750 | } |
| 751 | |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 752 | ; CHECK-LABEL: div_v2f64: |
Derek Schuff | 51ed131 | 2018-08-07 21:24:01 +0000 | [diff] [blame] | 753 | ; NO-SIMD128-NOT: f64x2 |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 754 | ; SIMD128-VM-NOT: f62x2 |
| 755 | ; SIMD128-NEXT: .param v128, v128{{$}} |
| 756 | ; SIMD128-NEXT: .result v128{{$}} |
| 757 | ; SIMD128-NEXT: f64x2.div $push0=, $0, $1{{$}} |
| 758 | ; SIMD128-NEXT: return $pop0{{$}} |
Derek Schuff | 51ed131 | 2018-08-07 21:24:01 +0000 | [diff] [blame] | 759 | define <2 x double> @div_v2f64(<2 x double> %x, <2 x double> %y) { |
| 760 | %a = fdiv <2 x double> %x, %y |
| 761 | ret <2 x double> %a |
| 762 | } |
| 763 | |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 764 | ; CHECK-LABEL: mul_v2f64: |
Derek Schuff | 51ed131 | 2018-08-07 21:24:01 +0000 | [diff] [blame] | 765 | ; NO-SIMD128-NOT: f64x2 |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 766 | ; SIMD128-VM-NOT: f62x2 |
| 767 | ; SIMD128-NEXT: .param v128, v128{{$}} |
| 768 | ; SIMD128-NEXT: .result v128{{$}} |
| 769 | ; SIMD128-NEXT: f64x2.mul $push0=, $0, $1{{$}} |
| 770 | ; SIMD128-NEXT: return $pop0{{$}} |
Derek Schuff | 51ed131 | 2018-08-07 21:24:01 +0000 | [diff] [blame] | 771 | define <2 x double> @mul_v2f64(<2 x double> %x, <2 x double> %y) { |
| 772 | %a = fmul <2 x double> %x, %y |
| 773 | ret <2 x double> %a |
| 774 | } |