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