Thomas Lively | 64a39a1 | 2019-01-10 22:32:11 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s -asm-verbose=false -verify-machineinstrs -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -wasm-keep-registers -mattr=+unimplemented-simd128,+sign-ext | FileCheck %s --check-prefixes CHECK,SIMD128 |
Thomas Lively | b6dac89 | 2018-12-21 06:58:15 +0000 | [diff] [blame] | 2 | ; RUN: llc < %s -asm-verbose=false -verify-machineinstrs -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -wasm-keep-registers -mattr=+simd128,+sign-ext | FileCheck %s --check-prefixes CHECK,SIMD128-VM |
Thomas Lively | 64a39a1 | 2019-01-10 22:32:11 +0000 | [diff] [blame] | 3 | ; RUN: llc < %s -asm-verbose=false -verify-machineinstrs -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -wasm-keep-registers | FileCheck %s --check-prefixes CHECK,NO-SIMD128 |
Heejin Ahn | a0fd9c3 | 2018-08-14 18:53:27 +0000 | [diff] [blame] | 4 | |
| 5 | ; Test that basic SIMD128 vector manipulation operations assemble as expected. |
| 6 | |
| 7 | target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128" |
| 8 | target triple = "wasm32-unknown-unknown" |
| 9 | |
| 10 | ; ============================================================================== |
| 11 | ; 16 x i8 |
| 12 | ; ============================================================================== |
Thomas Lively | 2244292 | 2018-08-21 21:03:18 +0000 | [diff] [blame] | 13 | ; CHECK-LABEL: const_v16i8: |
| 14 | ; NO-SIMD128-NOT: i8x16 |
Thomas Lively | 8dbf29af | 2018-12-20 02:10:22 +0000 | [diff] [blame] | 15 | ; SIMD128-VM-NOT: v128.const |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 16 | ; SIMD128-NEXT: .functype const_v16i8 () -> (v128){{$}} |
Thomas Lively | 66f3dc0 | 2018-09-15 01:12:48 +0000 | [diff] [blame] | 17 | ; SIMD128-NEXT: v128.const $push[[R:[0-9]+]]=, |
Thomas Lively | 2244292 | 2018-08-21 21:03:18 +0000 | [diff] [blame] | 18 | ; SIMD128-SAME: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 |
Thomas Lively | 66f3dc0 | 2018-09-15 01:12:48 +0000 | [diff] [blame] | 19 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
Thomas Lively | 2244292 | 2018-08-21 21:03:18 +0000 | [diff] [blame] | 20 | define <16 x i8> @const_v16i8() { |
| 21 | ret <16 x i8> <i8 00, i8 01, i8 02, i8 03, i8 04, i8 05, i8 06, i8 07, |
| 22 | i8 08, i8 09, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15> |
| 23 | } |
| 24 | |
Derek Schuff | 4ec8bca | 2018-08-15 00:30:27 +0000 | [diff] [blame] | 25 | ; CHECK-LABEL: splat_v16i8: |
| 26 | ; NO-SIMD128-NOT: i8x16 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 27 | ; SIMD128-NEXT: .functype splat_v16i8 (i32) -> (v128){{$}} |
Thomas Lively | 66f3dc0 | 2018-09-15 01:12:48 +0000 | [diff] [blame] | 28 | ; SIMD128-NEXT: i8x16.splat $push[[R:[0-9]+]]=, $0{{$}} |
| 29 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
Derek Schuff | 4ec8bca | 2018-08-15 00:30:27 +0000 | [diff] [blame] | 30 | define <16 x i8> @splat_v16i8(i8 %x) { |
| 31 | %v = insertelement <16 x i8> undef, i8 %x, i32 0 |
| 32 | %res = shufflevector <16 x i8> %v, <16 x i8> undef, |
| 33 | <16 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, |
| 34 | i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0> |
| 35 | ret <16 x i8> %res |
| 36 | } |
| 37 | |
Thomas Lively | 1b55b2b | 2018-09-04 21:26:17 +0000 | [diff] [blame] | 38 | ; CHECK-LABEL: const_splat_v16i8: |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 39 | ; SIMD128: i8x16.splat |
Thomas Lively | da26b84 | 2018-08-23 19:23:13 +0000 | [diff] [blame] | 40 | define <16 x i8> @const_splat_v16i8() { |
| 41 | ret <16 x i8> <i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, |
| 42 | i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42> |
| 43 | } |
| 44 | |
Heejin Ahn | c15a878 | 2018-08-14 19:10:50 +0000 | [diff] [blame] | 45 | ; CHECK-LABEL: extract_v16i8_s: |
Heejin Ahn | a0fd9c3 | 2018-08-14 18:53:27 +0000 | [diff] [blame] | 46 | ; NO-SIMD128-NOT: i8x16 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 47 | ; SIMD128-NEXT: .functype extract_v16i8_s (v128) -> (i32){{$}} |
Thomas Lively | 66f3dc0 | 2018-09-15 01:12:48 +0000 | [diff] [blame] | 48 | ; SIMD128-NEXT: i8x16.extract_lane_s $push[[R:[0-9]+]]=, $0, 13{{$}} |
| 49 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
Heejin Ahn | a0fd9c3 | 2018-08-14 18:53:27 +0000 | [diff] [blame] | 50 | define i32 @extract_v16i8_s(<16 x i8> %v) { |
| 51 | %elem = extractelement <16 x i8> %v, i8 13 |
| 52 | %a = sext i8 %elem to i32 |
| 53 | ret i32 %a |
| 54 | } |
| 55 | |
Thomas Lively | fb84fd7 | 2018-11-02 00:06:56 +0000 | [diff] [blame] | 56 | ; CHECK-LABEL: extract_var_v16i8_s: |
| 57 | ; NO-SIMD128-NOT: i8x16 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 58 | ; SIMD128-NEXT: .functype extract_var_v16i8_s (v128, i32) -> (i32){{$}} |
Sam Clegg | 275d15e | 2019-02-23 00:07:39 +0000 | [diff] [blame] | 59 | ; SIMD128-NEXT: global.get $push[[L0:[0-9]+]]=, __stack_pointer |
Thomas Lively | fb84fd7 | 2018-11-02 00:06:56 +0000 | [diff] [blame] | 60 | ; SIMD128-NEXT: i32.const $push[[L1:[0-9]+]]=, 16 |
| 61 | ; SIMD128-NEXT: i32.sub $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]] |
Thomas Lively | 6a87dda | 2019-01-08 06:25:55 +0000 | [diff] [blame] | 62 | ; SIMD128-NEXT: local.tee $push[[L3:[0-9]+]]=, $2=, $pop[[L2]] |
Thomas Lively | fb84fd7 | 2018-11-02 00:06:56 +0000 | [diff] [blame] | 63 | ; SIMD128-NEXT: v128.store 0($pop[[L3]]), $0 |
| 64 | ; SIMD128-NEXT: i32.const $push[[L4:[0-9]+]]=, 15 |
| 65 | ; SIMD128-NEXT: i32.and $push[[L5:[0-9]+]]=, $1, $pop[[L4]] |
| 66 | ; SIMD128-NEXT: i32.or $push[[L6:[0-9]+]]=, $2, $pop[[L5]] |
| 67 | ; SIMD128-NEXT: i32.load8_s $push[[R:[0-9]+]]=, 0($pop[[L6]]) |
| 68 | ; SIMD128-NEXT: return $pop[[R]] |
| 69 | define i32 @extract_var_v16i8_s(<16 x i8> %v, i32 %i) { |
| 70 | %elem = extractelement <16 x i8> %v, i32 %i |
| 71 | %a = sext i8 %elem to i32 |
| 72 | ret i32 %a |
| 73 | } |
| 74 | |
Thomas Lively | 11a332d0 | 2018-10-19 19:08:06 +0000 | [diff] [blame] | 75 | ; CHECK-LABEL: extract_undef_v16i8_s: |
| 76 | ; NO-SIMD128-NOT: i8x16 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 77 | ; SIMD128-NEXT: .functype extract_undef_v16i8_s (v128) -> (i32){{$}} |
Thomas Lively | 11a332d0 | 2018-10-19 19:08:06 +0000 | [diff] [blame] | 78 | ; SIMD128-NEXT: i8x16.extract_lane_s $push[[R:[0-9]+]]=, $0, 0{{$}} |
| 79 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
| 80 | define i32 @extract_undef_v16i8_s(<16 x i8> %v) { |
| 81 | %elem = extractelement <16 x i8> %v, i8 undef |
| 82 | %a = sext i8 %elem to i32 |
| 83 | ret i32 %a |
| 84 | } |
| 85 | |
Heejin Ahn | c15a878 | 2018-08-14 19:10:50 +0000 | [diff] [blame] | 86 | ; CHECK-LABEL: extract_v16i8_u: |
Heejin Ahn | a0fd9c3 | 2018-08-14 18:53:27 +0000 | [diff] [blame] | 87 | ; NO-SIMD128-NOT: i8x16 |
Thomas Lively | 8dbf29af | 2018-12-20 02:10:22 +0000 | [diff] [blame] | 88 | ; SIMD128-VM-NOT: i8x16.extract_lane_u |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 89 | ; SIMD128-NEXT: .functype extract_v16i8_u (v128) -> (i32){{$}} |
Thomas Lively | 66f3dc0 | 2018-09-15 01:12:48 +0000 | [diff] [blame] | 90 | ; SIMD128-NEXT: i8x16.extract_lane_u $push[[R:[0-9]+]]=, $0, 13{{$}} |
| 91 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
Heejin Ahn | a0fd9c3 | 2018-08-14 18:53:27 +0000 | [diff] [blame] | 92 | define i32 @extract_v16i8_u(<16 x i8> %v) { |
| 93 | %elem = extractelement <16 x i8> %v, i8 13 |
| 94 | %a = zext i8 %elem to i32 |
| 95 | ret i32 %a |
| 96 | } |
| 97 | |
Thomas Lively | fb84fd7 | 2018-11-02 00:06:56 +0000 | [diff] [blame] | 98 | ; CHECK-LABEL: extract_var_v16i8_u: |
| 99 | ; NO-SIMD128-NOT: i8x16 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 100 | ; SIMD128-NEXT: .functype extract_var_v16i8_u (v128, i32) -> (i32){{$}} |
Sam Clegg | 275d15e | 2019-02-23 00:07:39 +0000 | [diff] [blame] | 101 | ; SIMD128-NEXT: global.get $push[[L0:[0-9]+]]=, __stack_pointer{{$}} |
Thomas Lively | fb84fd7 | 2018-11-02 00:06:56 +0000 | [diff] [blame] | 102 | ; SIMD128-NEXT: i32.const $push[[L1:[0-9]+]]=, 16{{$}} |
| 103 | ; SIMD128-NEXT: i32.sub $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}} |
Thomas Lively | 6a87dda | 2019-01-08 06:25:55 +0000 | [diff] [blame] | 104 | ; SIMD128-NEXT: local.tee $push[[L3:[0-9]+]]=, $2=, $pop[[L2]]{{$}} |
Thomas Lively | fb84fd7 | 2018-11-02 00:06:56 +0000 | [diff] [blame] | 105 | ; SIMD128-NEXT: v128.store 0($pop[[L3]]), $0{{$}} |
| 106 | ; SIMD128-NEXT: i32.const $push[[L4:[0-9]+]]=, 15{{$}} |
| 107 | ; SIMD128-NEXT: i32.and $push[[L5:[0-9]+]]=, $1, $pop[[L4]]{{$}} |
| 108 | ; SIMD128-NEXT: i32.or $push[[L6:[0-9]+]]=, $2, $pop[[L5]]{{$}} |
| 109 | ; SIMD128-NEXT: i32.load8_u $push[[R:[0-9]+]]=, 0($pop[[L6]]){{$}} |
| 110 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
| 111 | define i32 @extract_var_v16i8_u(<16 x i8> %v, i32 %i) { |
| 112 | %elem = extractelement <16 x i8> %v, i32 %i |
| 113 | %a = zext i8 %elem to i32 |
| 114 | ret i32 %a |
| 115 | } |
| 116 | |
Thomas Lively | 11a332d0 | 2018-10-19 19:08:06 +0000 | [diff] [blame] | 117 | ; CHECK-LABEL: extract_undef_v16i8_u: |
| 118 | ; NO-SIMD128-NOT: i8x16 |
Thomas Lively | 8dbf29af | 2018-12-20 02:10:22 +0000 | [diff] [blame] | 119 | ; SIMD128-VM-NOT: i8x16.extract_lane_u |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 120 | ; SIMD128-NEXT: .functype extract_undef_v16i8_u (v128) -> (i32){{$}} |
Thomas Lively | 11a332d0 | 2018-10-19 19:08:06 +0000 | [diff] [blame] | 121 | ; SIMD128-NEXT: i8x16.extract_lane_u $push[[R:[0-9]+]]=, $0, 0{{$}} |
| 122 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
| 123 | define i32 @extract_undef_v16i8_u(<16 x i8> %v) { |
| 124 | %elem = extractelement <16 x i8> %v, i8 undef |
| 125 | %a = zext i8 %elem to i32 |
| 126 | ret i32 %a |
| 127 | } |
| 128 | |
Heejin Ahn | c15a878 | 2018-08-14 19:10:50 +0000 | [diff] [blame] | 129 | ; CHECK-LABEL: extract_v16i8: |
Heejin Ahn | a0fd9c3 | 2018-08-14 18:53:27 +0000 | [diff] [blame] | 130 | ; NO-SIMD128-NOT: i8x16 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 131 | ; SIMD128-NEXT: .functype extract_v16i8 (v128) -> (i32){{$}} |
Thomas Lively | 8dbf29af | 2018-12-20 02:10:22 +0000 | [diff] [blame] | 132 | ; SIMD128-NEXT: i8x16.extract_lane_s $push[[R:[0-9]+]]=, $0, 13{{$}} |
Thomas Lively | 66f3dc0 | 2018-09-15 01:12:48 +0000 | [diff] [blame] | 133 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
Heejin Ahn | a0fd9c3 | 2018-08-14 18:53:27 +0000 | [diff] [blame] | 134 | define i8 @extract_v16i8(<16 x i8> %v) { |
| 135 | %elem = extractelement <16 x i8> %v, i8 13 |
| 136 | ret i8 %elem |
| 137 | } |
| 138 | |
Thomas Lively | fb84fd7 | 2018-11-02 00:06:56 +0000 | [diff] [blame] | 139 | ; CHECK-LABEL: extract_var_v16i8: |
| 140 | ; NO-SIMD128-NOT: i8x16 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 141 | ; SIMD128-NEXT: .functype extract_var_v16i8 (v128, i32) -> (i32){{$}} |
Sam Clegg | 275d15e | 2019-02-23 00:07:39 +0000 | [diff] [blame] | 142 | ; SIMD128-NEXT: global.get $push[[L0:[0-9]+]]=, __stack_pointer{{$}} |
Thomas Lively | fb84fd7 | 2018-11-02 00:06:56 +0000 | [diff] [blame] | 143 | ; SIMD128-NEXT: i32.const $push[[L1:[0-9]+]]=, 16{{$}} |
| 144 | ; SIMD128-NEXT: i32.sub $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}} |
Thomas Lively | 6a87dda | 2019-01-08 06:25:55 +0000 | [diff] [blame] | 145 | ; SIMD128-NEXT: local.tee $push[[L3:[0-9]+]]=, $2=, $pop[[L2]]{{$}} |
Thomas Lively | fb84fd7 | 2018-11-02 00:06:56 +0000 | [diff] [blame] | 146 | ; SIMD128-NEXT: v128.store 0($pop[[L3]]), $0{{$}} |
| 147 | ; SIMD128-NEXT: i32.const $push[[L4:[0-9]+]]=, 15{{$}} |
| 148 | ; SIMD128-NEXT: i32.and $push[[L5:[0-9]+]]=, $1, $pop[[L4]]{{$}} |
| 149 | ; SIMD128-NEXT: i32.or $push[[L6:[0-9]+]]=, $2, $pop[[L5]]{{$}} |
| 150 | ; SIMD128-NEXT: i32.load8_u $push[[R:[0-9]+]]=, 0($pop[[L6]]){{$}} |
| 151 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
| 152 | define i8 @extract_var_v16i8(<16 x i8> %v, i32 %i) { |
| 153 | %elem = extractelement <16 x i8> %v, i32 %i |
| 154 | ret i8 %elem |
| 155 | } |
| 156 | |
Thomas Lively | 11a332d0 | 2018-10-19 19:08:06 +0000 | [diff] [blame] | 157 | ; CHECK-LABEL: extract_undef_v16i8: |
| 158 | ; NO-SIMD128-NOT: i8x16 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 159 | ; SIMD128-NEXT: .functype extract_undef_v16i8 (v128) -> (i32){{$}} |
Thomas Lively | 8dbf29af | 2018-12-20 02:10:22 +0000 | [diff] [blame] | 160 | ; SIMD128-NEXT: i8x16.extract_lane_s $push[[R:[0-9]+]]=, $0, 0{{$}} |
Thomas Lively | 11a332d0 | 2018-10-19 19:08:06 +0000 | [diff] [blame] | 161 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
| 162 | define i8 @extract_undef_v16i8(<16 x i8> %v) { |
| 163 | %elem = extractelement <16 x i8> %v, i8 undef |
| 164 | ret i8 %elem |
| 165 | } |
| 166 | |
Derek Schuff | 82812fb | 2018-08-15 16:18:51 +0000 | [diff] [blame] | 167 | ; CHECK-LABEL: replace_v16i8: |
| 168 | ; NO-SIMD128-NOT: i8x16 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 169 | ; SIMD128-NEXT: .functype replace_v16i8 (v128, i32) -> (v128){{$}} |
Thomas Lively | 66f3dc0 | 2018-09-15 01:12:48 +0000 | [diff] [blame] | 170 | ; SIMD128-NEXT: i8x16.replace_lane $push[[R:[0-9]+]]=, $0, 11, $1{{$}} |
| 171 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
Derek Schuff | 82812fb | 2018-08-15 16:18:51 +0000 | [diff] [blame] | 172 | define <16 x i8> @replace_v16i8(<16 x i8> %v, i8 %x) { |
| 173 | %res = insertelement <16 x i8> %v, i8 %x, i32 11 |
| 174 | ret <16 x i8> %res |
| 175 | } |
| 176 | |
Thomas Lively | fb84fd7 | 2018-11-02 00:06:56 +0000 | [diff] [blame] | 177 | ; CHECK-LABEL: replace_var_v16i8: |
| 178 | ; NO-SIMD128-NOT: i8x16 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 179 | ; SIMD128-NEXT: .functype replace_var_v16i8 (v128, i32, i32) -> (v128){{$}} |
Sam Clegg | 275d15e | 2019-02-23 00:07:39 +0000 | [diff] [blame] | 180 | ; SIMD128-NEXT: global.get $push[[L0:[0-9]+]]=, __stack_pointer{{$}} |
Thomas Lively | fb84fd7 | 2018-11-02 00:06:56 +0000 | [diff] [blame] | 181 | ; SIMD128-NEXT: i32.const $push[[L1:[0-9]+]]=, 16{{$}} |
| 182 | ; SIMD128-NEXT: i32.sub $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}} |
Thomas Lively | 6a87dda | 2019-01-08 06:25:55 +0000 | [diff] [blame] | 183 | ; SIMD128-NEXT: local.tee $push[[L3:[0-9]+]]=, $3=, $pop[[L2]]{{$}} |
Thomas Lively | fb84fd7 | 2018-11-02 00:06:56 +0000 | [diff] [blame] | 184 | ; SIMD128-NEXT: v128.store 0($pop[[L3]]), $0{{$}} |
| 185 | ; SIMD128-NEXT: i32.const $push[[L4:[0-9]+]]=, 15{{$}} |
| 186 | ; SIMD128-NEXT: i32.and $push[[L5:[0-9]+]]=, $1, $pop[[L4]]{{$}} |
| 187 | ; SIMD128-NEXT: i32.or $push[[L6:[0-9]+]]=, $3, $pop[[L5]]{{$}} |
| 188 | ; SIMD128-NEXT: i32.store8 0($pop[[L6]]), $2{{$}} |
| 189 | ; SIMD128-NEXT: v128.load $push[[R:[0-9]+]]=, 0($3){{$}} |
| 190 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
| 191 | define <16 x i8> @replace_var_v16i8(<16 x i8> %v, i32 %i, i8 %x) { |
| 192 | %res = insertelement <16 x i8> %v, i8 %x, i32 %i |
| 193 | ret <16 x i8> %res |
| 194 | } |
| 195 | |
Thomas Lively | 11a332d0 | 2018-10-19 19:08:06 +0000 | [diff] [blame] | 196 | ; CHECK-LABEL: replace_undef_v16i8: |
| 197 | ; NO-SIMD128-NOT: i8x16 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 198 | ; SIMD128-NEXT: .functype replace_undef_v16i8 (v128, i32) -> (v128){{$}} |
Thomas Lively | 11a332d0 | 2018-10-19 19:08:06 +0000 | [diff] [blame] | 199 | ; SIMD128-NEXT: i8x16.replace_lane $push[[R:[0-9]+]]=, $0, 0, $1{{$}} |
| 200 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
| 201 | define <16 x i8> @replace_undef_v16i8(<16 x i8> %v, i8 %x) { |
| 202 | %res = insertelement <16 x i8> %v, i8 %x, i32 undef |
| 203 | ret <16 x i8> %res |
| 204 | } |
| 205 | |
Thomas Lively | a0d2581 | 2018-09-07 21:54:46 +0000 | [diff] [blame] | 206 | ; CHECK-LABEL: shuffle_v16i8: |
| 207 | ; NO-SIMD128-NOT: v8x16 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 208 | ; SIMD128-NEXT: .functype shuffle_v16i8 (v128, v128) -> (v128){{$}} |
Thomas Lively | 66f3dc0 | 2018-09-15 01:12:48 +0000 | [diff] [blame] | 209 | ; SIMD128-NEXT: v8x16.shuffle $push[[R:[0-9]+]]=, $0, $1, |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 210 | ; SIMD128-SAME: 0, 17, 2, 19, 4, 21, 6, 23, 8, 25, 10, 27, 12, 29, 14, 31{{$}} |
Thomas Lively | 66f3dc0 | 2018-09-15 01:12:48 +0000 | [diff] [blame] | 211 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
Thomas Lively | a0d2581 | 2018-09-07 21:54:46 +0000 | [diff] [blame] | 212 | define <16 x i8> @shuffle_v16i8(<16 x i8> %x, <16 x i8> %y) { |
| 213 | %res = shufflevector <16 x i8> %x, <16 x i8> %y, |
| 214 | <16 x i32> <i32 0, i32 17, i32 2, i32 19, i32 4, i32 21, i32 6, i32 23, |
| 215 | i32 8, i32 25, i32 10, i32 27, i32 12, i32 29, i32 14, i32 31> |
| 216 | ret <16 x i8> %res |
| 217 | } |
| 218 | |
Thomas Lively | 11a332d0 | 2018-10-19 19:08:06 +0000 | [diff] [blame] | 219 | ; CHECK-LABEL: shuffle_undef_v16i8: |
| 220 | ; NO-SIMD128-NOT: v8x16 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 221 | ; SIMD128-NEXT: .functype shuffle_undef_v16i8 (v128, v128) -> (v128){{$}} |
Thomas Lively | 11a332d0 | 2018-10-19 19:08:06 +0000 | [diff] [blame] | 222 | ; SIMD128-NEXT: v8x16.shuffle $push[[R:[0-9]+]]=, $0, $0, |
| 223 | ; SIMD128-SAME: 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0{{$}} |
| 224 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
| 225 | define <16 x i8> @shuffle_undef_v16i8(<16 x i8> %x, <16 x i8> %y) { |
| 226 | %res = shufflevector <16 x i8> %x, <16 x i8> %y, |
| 227 | <16 x i32> <i32 1, i32 undef, i32 undef, i32 undef, |
| 228 | i32 undef, i32 undef, i32 undef, i32 undef, |
| 229 | i32 undef, i32 undef, i32 undef, i32 undef, |
| 230 | i32 undef, i32 undef, i32 undef, i32 undef> |
| 231 | ret <16 x i8> %res |
| 232 | } |
| 233 | |
Thomas Lively | 2ee686d | 2018-08-22 23:06:27 +0000 | [diff] [blame] | 234 | ; CHECK-LABEL: build_v16i8: |
| 235 | ; NO-SIMD128-NOT: i8x16 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 236 | ; SIMD128-NEXT: .functype build_v16i8 (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> (v128){{$}} |
Thomas Lively | 66f3dc0 | 2018-09-15 01:12:48 +0000 | [diff] [blame] | 237 | ; SIMD128-NEXT: i8x16.splat $push[[L0:[0-9]+]]=, $0{{$}} |
| 238 | ; SIMD128-NEXT: i8x16.replace_lane $push[[L1:[0-9]+]]=, $pop[[L0]], 1, $1{{$}} |
| 239 | ; SIMD128-NEXT: i8x16.replace_lane $push[[L2:[0-9]+]]=, $pop[[L1]], 2, $2{{$}} |
| 240 | ; SIMD128-NEXT: i8x16.replace_lane $push[[L3:[0-9]+]]=, $pop[[L2]], 3, $3{{$}} |
| 241 | ; SIMD128-NEXT: i8x16.replace_lane $push[[L4:[0-9]+]]=, $pop[[L3]], 4, $4{{$}} |
| 242 | ; SIMD128-NEXT: i8x16.replace_lane $push[[L5:[0-9]+]]=, $pop[[L4]], 5, $5{{$}} |
| 243 | ; SIMD128-NEXT: i8x16.replace_lane $push[[L6:[0-9]+]]=, $pop[[L5]], 6, $6{{$}} |
| 244 | ; SIMD128-NEXT: i8x16.replace_lane $push[[L7:[0-9]+]]=, $pop[[L6]], 7, $7{{$}} |
| 245 | ; SIMD128-NEXT: i8x16.replace_lane $push[[L8:[0-9]+]]=, $pop[[L7]], 8, $8{{$}} |
| 246 | ; SIMD128-NEXT: i8x16.replace_lane $push[[L9:[0-9]+]]=, $pop[[L8]], 9, $9{{$}} |
| 247 | ; SIMD128-NEXT: i8x16.replace_lane $push[[L10:[0-9]+]]=, $pop[[L9]], 10, $10{{$}} |
| 248 | ; SIMD128-NEXT: i8x16.replace_lane $push[[L11:[0-9]+]]=, $pop[[L10]], 11, $11{{$}} |
| 249 | ; SIMD128-NEXT: i8x16.replace_lane $push[[L12:[0-9]+]]=, $pop[[L11]], 12, $12{{$}} |
| 250 | ; SIMD128-NEXT: i8x16.replace_lane $push[[L13:[0-9]+]]=, $pop[[L12]], 13, $13{{$}} |
| 251 | ; SIMD128-NEXT: i8x16.replace_lane $push[[L14:[0-9]+]]=, $pop[[L13]], 14, $14{{$}} |
| 252 | ; SIMD128-NEXT: i8x16.replace_lane $push[[R:[0-9]+]]=, $pop[[L14]], 15, $15{{$}} |
| 253 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
Thomas Lively | 2ee686d | 2018-08-22 23:06:27 +0000 | [diff] [blame] | 254 | define <16 x i8> @build_v16i8(i8 %x0, i8 %x1, i8 %x2, i8 %x3, |
| 255 | i8 %x4, i8 %x5, i8 %x6, i8 %x7, |
| 256 | i8 %x8, i8 %x9, i8 %x10, i8 %x11, |
| 257 | i8 %x12, i8 %x13, i8 %x14, i8 %x15) { |
| 258 | %t0 = insertelement <16 x i8> undef, i8 %x0, i32 0 |
| 259 | %t1 = insertelement <16 x i8> %t0, i8 %x1, i32 1 |
| 260 | %t2 = insertelement <16 x i8> %t1, i8 %x2, i32 2 |
| 261 | %t3 = insertelement <16 x i8> %t2, i8 %x3, i32 3 |
| 262 | %t4 = insertelement <16 x i8> %t3, i8 %x4, i32 4 |
| 263 | %t5 = insertelement <16 x i8> %t4, i8 %x5, i32 5 |
| 264 | %t6 = insertelement <16 x i8> %t5, i8 %x6, i32 6 |
| 265 | %t7 = insertelement <16 x i8> %t6, i8 %x7, i32 7 |
| 266 | %t8 = insertelement <16 x i8> %t7, i8 %x8, i32 8 |
| 267 | %t9 = insertelement <16 x i8> %t8, i8 %x9, i32 9 |
| 268 | %t10 = insertelement <16 x i8> %t9, i8 %x10, i32 10 |
| 269 | %t11 = insertelement <16 x i8> %t10, i8 %x11, i32 11 |
| 270 | %t12 = insertelement <16 x i8> %t11, i8 %x12, i32 12 |
| 271 | %t13 = insertelement <16 x i8> %t12, i8 %x13, i32 13 |
| 272 | %t14 = insertelement <16 x i8> %t13, i8 %x14, i32 14 |
| 273 | %res = insertelement <16 x i8> %t14, i8 %x15, i32 15 |
| 274 | ret <16 x i8> %res |
| 275 | } |
| 276 | |
Heejin Ahn | a0fd9c3 | 2018-08-14 18:53:27 +0000 | [diff] [blame] | 277 | ; ============================================================================== |
| 278 | ; 8 x i16 |
| 279 | ; ============================================================================== |
Thomas Lively | 2244292 | 2018-08-21 21:03:18 +0000 | [diff] [blame] | 280 | ; CHECK-LABEL: const_v8i16: |
| 281 | ; NO-SIMD128-NOT: i16x8 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 282 | ; SIMD128-NEXT: .functype const_v8i16 () -> (v128){{$}} |
Thomas Lively | 66f3dc0 | 2018-09-15 01:12:48 +0000 | [diff] [blame] | 283 | ; SIMD128-NEXT: v128.const $push[[R:[0-9]+]]=, 256, 770, 1284, 1798, 2312, 2826, 3340, 3854{{$}} |
| 284 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
Thomas Lively | 2244292 | 2018-08-21 21:03:18 +0000 | [diff] [blame] | 285 | define <8 x i16> @const_v8i16() { |
| 286 | ret <8 x i16> <i16 256, i16 770, i16 1284, i16 1798, |
| 287 | i16 2312, i16 2826, i16 3340, i16 3854> |
| 288 | } |
| 289 | |
Derek Schuff | 4ec8bca | 2018-08-15 00:30:27 +0000 | [diff] [blame] | 290 | ; CHECK-LABEL: splat_v8i16: |
| 291 | ; NO-SIMD128-NOT: i16x8 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 292 | ; SIMD128-NEXT: .functype splat_v8i16 (i32) -> (v128){{$}} |
Thomas Lively | 66f3dc0 | 2018-09-15 01:12:48 +0000 | [diff] [blame] | 293 | ; SIMD128-NEXT: i16x8.splat $push[[R:[0-9]+]]=, $0{{$}} |
| 294 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
Derek Schuff | 4ec8bca | 2018-08-15 00:30:27 +0000 | [diff] [blame] | 295 | define <8 x i16> @splat_v8i16(i16 %x) { |
| 296 | %v = insertelement <8 x i16> undef, i16 %x, i32 0 |
| 297 | %res = shufflevector <8 x i16> %v, <8 x i16> undef, |
| 298 | <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0> |
| 299 | ret <8 x i16> %res |
| 300 | } |
| 301 | |
Thomas Lively | cfab8b4 | 2018-09-04 21:51:32 +0000 | [diff] [blame] | 302 | ; CHECK-LABEL: const_splat_v8i16: |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 303 | ; SIMD128: i16x8.splat |
Thomas Lively | da26b84 | 2018-08-23 19:23:13 +0000 | [diff] [blame] | 304 | define <8 x i16> @const_splat_v8i16() { |
| 305 | ret <8 x i16> <i16 42, i16 42, i16 42, i16 42, i16 42, i16 42, i16 42, i16 42> |
| 306 | } |
| 307 | |
Heejin Ahn | c15a878 | 2018-08-14 19:10:50 +0000 | [diff] [blame] | 308 | ; CHECK-LABEL: extract_v8i16_s: |
Heejin Ahn | a0fd9c3 | 2018-08-14 18:53:27 +0000 | [diff] [blame] | 309 | ; NO-SIMD128-NOT: i16x8 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 310 | ; SIMD128-NEXT: .functype extract_v8i16_s (v128) -> (i32){{$}} |
Thomas Lively | 66f3dc0 | 2018-09-15 01:12:48 +0000 | [diff] [blame] | 311 | ; SIMD128-NEXT: i16x8.extract_lane_s $push[[R:[0-9]+]]=, $0, 5{{$}} |
| 312 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
Heejin Ahn | a0fd9c3 | 2018-08-14 18:53:27 +0000 | [diff] [blame] | 313 | define i32 @extract_v8i16_s(<8 x i16> %v) { |
| 314 | %elem = extractelement <8 x i16> %v, i16 5 |
| 315 | %a = sext i16 %elem to i32 |
| 316 | ret i32 %a |
| 317 | } |
| 318 | |
Thomas Lively | fb84fd7 | 2018-11-02 00:06:56 +0000 | [diff] [blame] | 319 | ; CHECK-LABEL: extract_var_v8i16_s: |
| 320 | ; NO-SIMD128-NOT: i16x8 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 321 | ; SIMD128-NEXT: .functype extract_var_v8i16_s (v128, i32) -> (i32){{$}} |
Sam Clegg | 275d15e | 2019-02-23 00:07:39 +0000 | [diff] [blame] | 322 | ; SIMD128-NEXT: global.get $push[[L0:[0-9]+]]=, __stack_pointer{{$}} |
Thomas Lively | fb84fd7 | 2018-11-02 00:06:56 +0000 | [diff] [blame] | 323 | ; SIMD128-NEXT: i32.const $push[[L1:[0-9]+]]=, 16{{$}} |
| 324 | ; SIMD128-NEXT: i32.sub $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}} |
Thomas Lively | 6a87dda | 2019-01-08 06:25:55 +0000 | [diff] [blame] | 325 | ; SIMD128-NEXT: local.tee $push[[L3:[0-9]+]]=, $2=, $pop[[L2]]{{$}} |
Thomas Lively | fb84fd7 | 2018-11-02 00:06:56 +0000 | [diff] [blame] | 326 | ; SIMD128-NEXT: v128.store 0($pop[[L3]]), $0{{$}} |
| 327 | ; SIMD128-NEXT: i32.const $push[[L4:[0-9]+]]=, 7{{$}} |
| 328 | ; SIMD128-NEXT: i32.and $push[[L5:[0-9]+]]=, $1, $pop[[L4]]{{$}} |
| 329 | ; SIMD128-NEXT: i32.const $push[[L6:[0-9]+]]=, 1{{$}} |
| 330 | ; SIMD128-NEXT: i32.shl $push[[L7:[0-9]+]]=, $pop[[L5]], $pop[[L6]]{{$}} |
| 331 | ; SIMD128-NEXT: i32.or $push[[L8:[0-9]+]]=, $2, $pop[[L7]]{{$}} |
| 332 | ; SIMD128-NEXT: i32.load16_s $push[[R:[0-9]+]]=, 0($pop[[L8]]){{$}} |
| 333 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
| 334 | define i32 @extract_var_v8i16_s(<8 x i16> %v, i32 %i) { |
| 335 | %elem = extractelement <8 x i16> %v, i32 %i |
| 336 | %a = sext i16 %elem to i32 |
| 337 | ret i32 %a |
| 338 | } |
| 339 | |
Thomas Lively | 11a332d0 | 2018-10-19 19:08:06 +0000 | [diff] [blame] | 340 | ; CHECK-LABEL: extract_undef_v8i16_s: |
| 341 | ; NO-SIMD128-NOT: i16x8 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 342 | ; SIMD128-NEXT: .functype extract_undef_v8i16_s (v128) -> (i32){{$}} |
Thomas Lively | 11a332d0 | 2018-10-19 19:08:06 +0000 | [diff] [blame] | 343 | ; SIMD128-NEXT: i16x8.extract_lane_s $push[[R:[0-9]+]]=, $0, 0{{$}} |
| 344 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
| 345 | define i32 @extract_undef_v8i16_s(<8 x i16> %v) { |
| 346 | %elem = extractelement <8 x i16> %v, i16 undef |
| 347 | %a = sext i16 %elem to i32 |
| 348 | ret i32 %a |
| 349 | } |
| 350 | |
Heejin Ahn | c15a878 | 2018-08-14 19:10:50 +0000 | [diff] [blame] | 351 | ; CHECK-LABEL: extract_v8i16_u: |
Heejin Ahn | a0fd9c3 | 2018-08-14 18:53:27 +0000 | [diff] [blame] | 352 | ; NO-SIMD128-NOT: i16x8 |
Thomas Lively | 8dbf29af | 2018-12-20 02:10:22 +0000 | [diff] [blame] | 353 | ; SIMD128-VM-NOT: i16x8.extract_lane_u |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 354 | ; SIMD128-NEXT: .functype extract_v8i16_u (v128) -> (i32){{$}} |
Thomas Lively | 66f3dc0 | 2018-09-15 01:12:48 +0000 | [diff] [blame] | 355 | ; SIMD128-NEXT: i16x8.extract_lane_u $push[[R:[0-9]+]]=, $0, 5{{$}} |
| 356 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
Heejin Ahn | a0fd9c3 | 2018-08-14 18:53:27 +0000 | [diff] [blame] | 357 | define i32 @extract_v8i16_u(<8 x i16> %v) { |
| 358 | %elem = extractelement <8 x i16> %v, i16 5 |
| 359 | %a = zext i16 %elem to i32 |
| 360 | ret i32 %a |
| 361 | } |
| 362 | |
Thomas Lively | fb84fd7 | 2018-11-02 00:06:56 +0000 | [diff] [blame] | 363 | ; CHECK-LABEL: extract_var_v8i16_u: |
| 364 | ; NO-SIMD128-NOT: i16x8 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 365 | ; SIMD128-NEXT: .functype extract_var_v8i16_u (v128, i32) -> (i32){{$}} |
Sam Clegg | 275d15e | 2019-02-23 00:07:39 +0000 | [diff] [blame] | 366 | ; SIMD128-NEXT: global.get $push[[L0:[0-9]+]]=, __stack_pointer{{$}} |
Thomas Lively | fb84fd7 | 2018-11-02 00:06:56 +0000 | [diff] [blame] | 367 | ; SIMD128-NEXT: i32.const $push[[L1:[0-9]+]]=, 16{{$}} |
| 368 | ; SIMD128-NEXT: i32.sub $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}} |
Thomas Lively | 6a87dda | 2019-01-08 06:25:55 +0000 | [diff] [blame] | 369 | ; SIMD128-NEXT: local.tee $push[[L3:[0-9]+]]=, $2=, $pop[[L2]]{{$}} |
Thomas Lively | fb84fd7 | 2018-11-02 00:06:56 +0000 | [diff] [blame] | 370 | ; SIMD128-NEXT: v128.store 0($pop[[L3]]), $0{{$}} |
| 371 | ; SIMD128-NEXT: i32.const $push[[L4:[0-9]+]]=, 7{{$}} |
| 372 | ; SIMD128-NEXT: i32.and $push[[L5:[0-9]+]]=, $1, $pop[[L4]]{{$}} |
| 373 | ; SIMD128-NEXT: i32.const $push[[L6:[0-9]+]]=, 1{{$}} |
| 374 | ; SIMD128-NEXT: i32.shl $push[[L7:[0-9]+]]=, $pop[[L5]], $pop[[L6]]{{$}} |
| 375 | ; SIMD128-NEXT: i32.or $push[[L8:[0-9]+]]=, $2, $pop[[L7]]{{$}} |
| 376 | ; SIMD128-NEXT: i32.load16_u $push[[R:[0-9]+]]=, 0($pop[[L8]]){{$}} |
| 377 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
| 378 | define i32 @extract_var_v8i16_u(<8 x i16> %v, i32 %i) { |
| 379 | %elem = extractelement <8 x i16> %v, i32 %i |
| 380 | %a = zext i16 %elem to i32 |
| 381 | ret i32 %a |
| 382 | } |
| 383 | |
Thomas Lively | 11a332d0 | 2018-10-19 19:08:06 +0000 | [diff] [blame] | 384 | ; CHECK-LABEL: extract_undef_v8i16_u: |
| 385 | ; NO-SIMD128-NOT: i16x8 |
Thomas Lively | 8dbf29af | 2018-12-20 02:10:22 +0000 | [diff] [blame] | 386 | ; SIMD128-VM-NOT: i16x8.extract_lane_u |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 387 | ; SIMD128-NEXT: .functype extract_undef_v8i16_u (v128) -> (i32){{$}} |
Thomas Lively | 11a332d0 | 2018-10-19 19:08:06 +0000 | [diff] [blame] | 388 | ; SIMD128-NEXT: i16x8.extract_lane_u $push[[R:[0-9]+]]=, $0, 0{{$}} |
| 389 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
| 390 | define i32 @extract_undef_v8i16_u(<8 x i16> %v) { |
| 391 | %elem = extractelement <8 x i16> %v, i16 undef |
| 392 | %a = zext i16 %elem to i32 |
| 393 | ret i32 %a |
| 394 | } |
| 395 | |
Heejin Ahn | c15a878 | 2018-08-14 19:10:50 +0000 | [diff] [blame] | 396 | ; CHECK-LABEL: extract_v8i16: |
Heejin Ahn | a0fd9c3 | 2018-08-14 18:53:27 +0000 | [diff] [blame] | 397 | ; NO-SIMD128-NOT: i16x8 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 398 | ; SIMD128-NEXT: .functype extract_v8i16 (v128) -> (i32){{$}} |
Thomas Lively | 8dbf29af | 2018-12-20 02:10:22 +0000 | [diff] [blame] | 399 | ; SIMD128-NEXT: i16x8.extract_lane_s $push[[R:[0-9]+]]=, $0, 5{{$}} |
Thomas Lively | 66f3dc0 | 2018-09-15 01:12:48 +0000 | [diff] [blame] | 400 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
Heejin Ahn | a0fd9c3 | 2018-08-14 18:53:27 +0000 | [diff] [blame] | 401 | define i16 @extract_v8i16(<8 x i16> %v) { |
| 402 | %elem = extractelement <8 x i16> %v, i16 5 |
| 403 | ret i16 %elem |
| 404 | } |
| 405 | |
Thomas Lively | fb84fd7 | 2018-11-02 00:06:56 +0000 | [diff] [blame] | 406 | ; CHECK-LABEL: extract_var_v8i16: |
| 407 | ; NO-SIMD128-NOT: i16x8 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 408 | ; SIMD128-NEXT: .functype extract_var_v8i16 (v128, i32) -> (i32){{$}} |
Sam Clegg | 275d15e | 2019-02-23 00:07:39 +0000 | [diff] [blame] | 409 | ; SIMD128-NEXT: global.get $push[[L0:[0-9]+]]=, __stack_pointer{{$}} |
Thomas Lively | fb84fd7 | 2018-11-02 00:06:56 +0000 | [diff] [blame] | 410 | ; SIMD128-NEXT: i32.const $push[[L1:[0-9]+]]=, 16{{$}} |
| 411 | ; SIMD128-NEXT: i32.sub $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}} |
Thomas Lively | 6a87dda | 2019-01-08 06:25:55 +0000 | [diff] [blame] | 412 | ; SIMD128-NEXT: local.tee $push[[L3:[0-9]+]]=, $2=, $pop[[L2]]{{$}} |
Thomas Lively | fb84fd7 | 2018-11-02 00:06:56 +0000 | [diff] [blame] | 413 | ; SIMD128-NEXT: v128.store 0($pop[[L3]]), $0{{$}} |
| 414 | ; SIMD128-NEXT: i32.const $push[[L4:[0-9]+]]=, 7{{$}} |
| 415 | ; SIMD128-NEXT: i32.and $push[[L5:[0-9]+]]=, $1, $pop[[L4]]{{$}} |
| 416 | ; SIMD128-NEXT: i32.const $push[[L6:[0-9]+]]=, 1{{$}} |
| 417 | ; SIMD128-NEXT: i32.shl $push[[L7:[0-9]+]]=, $pop[[L5]], $pop[[L6]]{{$}} |
| 418 | ; SIMD128-NEXT: i32.or $push[[L8:[0-9]+]]=, $2, $pop[[L7]]{{$}} |
| 419 | ; SIMD128-NEXT: i32.load16_u $push[[R:[0-9]+]]=, 0($pop[[L8]]){{$}} |
| 420 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
| 421 | define i16 @extract_var_v8i16(<8 x i16> %v, i32 %i) { |
| 422 | %elem = extractelement <8 x i16> %v, i32 %i |
| 423 | ret i16 %elem |
| 424 | } |
| 425 | |
Thomas Lively | 11a332d0 | 2018-10-19 19:08:06 +0000 | [diff] [blame] | 426 | ; CHECK-LABEL: extract_undef_v8i16: |
| 427 | ; NO-SIMD128-NOT: i16x8 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 428 | ; SIMD128-NEXT: .functype extract_undef_v8i16 (v128) -> (i32){{$}} |
Thomas Lively | 8dbf29af | 2018-12-20 02:10:22 +0000 | [diff] [blame] | 429 | ; SIMD128-NEXT: i16x8.extract_lane_s $push[[R:[0-9]+]]=, $0, 0{{$}} |
Thomas Lively | 11a332d0 | 2018-10-19 19:08:06 +0000 | [diff] [blame] | 430 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
| 431 | define i16 @extract_undef_v8i16(<8 x i16> %v) { |
| 432 | %elem = extractelement <8 x i16> %v, i16 undef |
| 433 | ret i16 %elem |
| 434 | } |
| 435 | |
Derek Schuff | 82812fb | 2018-08-15 16:18:51 +0000 | [diff] [blame] | 436 | ; CHECK-LABEL: replace_v8i16: |
| 437 | ; NO-SIMD128-NOT: i16x8 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 438 | ; SIMD128-NEXT: .functype replace_v8i16 (v128, i32) -> (v128){{$}} |
Thomas Lively | 66f3dc0 | 2018-09-15 01:12:48 +0000 | [diff] [blame] | 439 | ; SIMD128-NEXT: i16x8.replace_lane $push[[R:[0-9]+]]=, $0, 7, $1{{$}} |
| 440 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
Derek Schuff | 82812fb | 2018-08-15 16:18:51 +0000 | [diff] [blame] | 441 | define <8 x i16> @replace_v8i16(<8 x i16> %v, i16 %x) { |
| 442 | %res = insertelement <8 x i16> %v, i16 %x, i32 7 |
| 443 | ret <8 x i16> %res |
| 444 | } |
| 445 | |
Thomas Lively | fb84fd7 | 2018-11-02 00:06:56 +0000 | [diff] [blame] | 446 | ; CHECK-LABEL: replace_var_v8i16: |
| 447 | ; NO-SIMD128-NOT: i16x8 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 448 | ; SIMD128-NEXT: .functype replace_var_v8i16 (v128, i32, i32) -> (v128){{$}} |
Sam Clegg | 275d15e | 2019-02-23 00:07:39 +0000 | [diff] [blame] | 449 | ; SIMD128-NEXT: global.get $push[[L0:[0-9]+]]=, __stack_pointer{{$}} |
Thomas Lively | fb84fd7 | 2018-11-02 00:06:56 +0000 | [diff] [blame] | 450 | ; SIMD128-NEXT: i32.const $push[[L1:[0-9]+]]=, 16{{$}} |
| 451 | ; SIMD128-NEXT: i32.sub $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}} |
Thomas Lively | 6a87dda | 2019-01-08 06:25:55 +0000 | [diff] [blame] | 452 | ; SIMD128-NEXT: local.tee $push[[L3:[0-9]+]]=, $3=, $pop[[L2]]{{$}} |
Thomas Lively | fb84fd7 | 2018-11-02 00:06:56 +0000 | [diff] [blame] | 453 | ; SIMD128-NEXT: v128.store 0($pop[[L3]]), $0{{$}} |
| 454 | ; SIMD128-NEXT: i32.const $push[[L4:[0-9]+]]=, 7{{$}} |
| 455 | ; SIMD128-NEXT: i32.and $push[[L5:[0-9]+]]=, $1, $pop[[L4]]{{$}} |
| 456 | ; SIMD128-NEXT: i32.const $push[[L6:[0-9]+]]=, 1{{$}} |
| 457 | ; SIMD128-NEXT: i32.shl $push[[L7:[0-9]+]]=, $pop[[L5]], $pop[[L6]]{{$}} |
| 458 | ; SIMD128-NEXT: i32.or $push[[L8:[0-9]+]]=, $3, $pop[[L7]]{{$}} |
| 459 | ; SIMD128-NEXT: i32.store16 0($pop[[L8]]), $2{{$}} |
| 460 | ; SIMD128-NEXT: v128.load $push[[R:[0-9]+]]=, 0($3){{$}} |
| 461 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
| 462 | define <8 x i16> @replace_var_v8i16(<8 x i16> %v, i32 %i, i16 %x) { |
| 463 | %res = insertelement <8 x i16> %v, i16 %x, i32 %i |
| 464 | ret <8 x i16> %res |
| 465 | } |
| 466 | |
Thomas Lively | 11a332d0 | 2018-10-19 19:08:06 +0000 | [diff] [blame] | 467 | ; CHECK-LABEL: replace_undef_v8i16: |
| 468 | ; NO-SIMD128-NOT: i16x8 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 469 | ; SIMD128-NEXT: .functype replace_undef_v8i16 (v128, i32) -> (v128){{$}} |
Thomas Lively | 11a332d0 | 2018-10-19 19:08:06 +0000 | [diff] [blame] | 470 | ; SIMD128-NEXT: i16x8.replace_lane $push[[R:[0-9]+]]=, $0, 0, $1{{$}} |
| 471 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
| 472 | define <8 x i16> @replace_undef_v8i16(<8 x i16> %v, i16 %x) { |
| 473 | %res = insertelement <8 x i16> %v, i16 %x, i32 undef |
| 474 | ret <8 x i16> %res |
| 475 | } |
| 476 | |
Thomas Lively | a0d2581 | 2018-09-07 21:54:46 +0000 | [diff] [blame] | 477 | ; CHECK-LABEL: shuffle_v8i16: |
| 478 | ; NO-SIMD128-NOT: v8x16 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 479 | ; SIMD128-NEXT: .functype shuffle_v8i16 (v128, v128) -> (v128){{$}} |
Thomas Lively | 66f3dc0 | 2018-09-15 01:12:48 +0000 | [diff] [blame] | 480 | ; SIMD128-NEXT: v8x16.shuffle $push[[R:[0-9]+]]=, $0, $1, |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 481 | ; SIMD128-SAME: 0, 1, 18, 19, 4, 5, 22, 23, 8, 9, 26, 27, 12, 13, 30, 31{{$}} |
Thomas Lively | 66f3dc0 | 2018-09-15 01:12:48 +0000 | [diff] [blame] | 482 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
Thomas Lively | a0d2581 | 2018-09-07 21:54:46 +0000 | [diff] [blame] | 483 | define <8 x i16> @shuffle_v8i16(<8 x i16> %x, <8 x i16> %y) { |
| 484 | %res = shufflevector <8 x i16> %x, <8 x i16> %y, |
| 485 | <8 x i32> <i32 0, i32 9, i32 2, i32 11, i32 4, i32 13, i32 6, i32 15> |
| 486 | ret <8 x i16> %res |
| 487 | } |
| 488 | |
Thomas Lively | 11a332d0 | 2018-10-19 19:08:06 +0000 | [diff] [blame] | 489 | ; CHECK-LABEL: shuffle_undef_v8i16: |
| 490 | ; NO-SIMD128-NOT: v8x16 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 491 | ; SIMD128-NEXT: .functype shuffle_undef_v8i16 (v128, v128) -> (v128){{$}} |
Thomas Lively | 11a332d0 | 2018-10-19 19:08:06 +0000 | [diff] [blame] | 492 | ; SIMD128-NEXT: v8x16.shuffle $push[[R:[0-9]+]]=, $0, $0, |
| 493 | ; SIMD128-SAME: 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0{{$}} |
| 494 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
| 495 | define <8 x i16> @shuffle_undef_v8i16(<8 x i16> %x, <8 x i16> %y) { |
| 496 | %res = shufflevector <8 x i16> %x, <8 x i16> %y, |
| 497 | <8 x i32> <i32 1, i32 undef, i32 undef, i32 undef, |
| 498 | i32 undef, i32 undef, i32 undef, i32 undef> |
| 499 | ret <8 x i16> %res |
| 500 | } |
| 501 | |
Thomas Lively | 2ee686d | 2018-08-22 23:06:27 +0000 | [diff] [blame] | 502 | ; CHECK-LABEL: build_v8i16: |
| 503 | ; NO-SIMD128-NOT: i16x8 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 504 | ; SIMD128-NEXT: .functype build_v8i16 (i32, i32, i32, i32, i32, i32, i32, i32) -> (v128){{$}} |
Thomas Lively | 66f3dc0 | 2018-09-15 01:12:48 +0000 | [diff] [blame] | 505 | ; SIMD128-NEXT: i16x8.splat $push[[L0:[0-9]+]]=, $0{{$}} |
| 506 | ; SIMD128-NEXT: i16x8.replace_lane $push[[L1:[0-9]+]]=, $pop[[L0]], 1, $1{{$}} |
| 507 | ; SIMD128-NEXT: i16x8.replace_lane $push[[L2:[0-9]+]]=, $pop[[L1]], 2, $2{{$}} |
| 508 | ; SIMD128-NEXT: i16x8.replace_lane $push[[L3:[0-9]+]]=, $pop[[L2]], 3, $3{{$}} |
| 509 | ; SIMD128-NEXT: i16x8.replace_lane $push[[L4:[0-9]+]]=, $pop[[L3]], 4, $4{{$}} |
| 510 | ; SIMD128-NEXT: i16x8.replace_lane $push[[L5:[0-9]+]]=, $pop[[L4]], 5, $5{{$}} |
| 511 | ; SIMD128-NEXT: i16x8.replace_lane $push[[L6:[0-9]+]]=, $pop[[L5]], 6, $6{{$}} |
| 512 | ; SIMD128-NEXT: i16x8.replace_lane $push[[R:[0-9]+]]=, $pop[[L6]], 7, $7{{$}} |
| 513 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
Thomas Lively | 2ee686d | 2018-08-22 23:06:27 +0000 | [diff] [blame] | 514 | define <8 x i16> @build_v8i16(i16 %x0, i16 %x1, i16 %x2, i16 %x3, |
| 515 | i16 %x4, i16 %x5, i16 %x6, i16 %x7) { |
| 516 | %t0 = insertelement <8 x i16> undef, i16 %x0, i32 0 |
| 517 | %t1 = insertelement <8 x i16> %t0, i16 %x1, i32 1 |
| 518 | %t2 = insertelement <8 x i16> %t1, i16 %x2, i32 2 |
| 519 | %t3 = insertelement <8 x i16> %t2, i16 %x3, i32 3 |
| 520 | %t4 = insertelement <8 x i16> %t3, i16 %x4, i32 4 |
| 521 | %t5 = insertelement <8 x i16> %t4, i16 %x5, i32 5 |
| 522 | %t6 = insertelement <8 x i16> %t5, i16 %x6, i32 6 |
| 523 | %res = insertelement <8 x i16> %t6, i16 %x7, i32 7 |
| 524 | ret <8 x i16> %res |
| 525 | } |
| 526 | |
Heejin Ahn | a0fd9c3 | 2018-08-14 18:53:27 +0000 | [diff] [blame] | 527 | ; ============================================================================== |
| 528 | ; 4 x i32 |
| 529 | ; ============================================================================== |
Thomas Lively | 2244292 | 2018-08-21 21:03:18 +0000 | [diff] [blame] | 530 | ; CHECK-LABEL: const_v4i32: |
| 531 | ; NO-SIMD128-NOT: i32x4 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 532 | ; SIMD128-NEXT: .functype const_v4i32 () -> (v128){{$}} |
Thomas Lively | 66f3dc0 | 2018-09-15 01:12:48 +0000 | [diff] [blame] | 533 | ; SIMD128-NEXT: v128.const $push[[R:[0-9]+]]=, 50462976, 117835012, 185207048, 252579084{{$}} |
| 534 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
Thomas Lively | 2244292 | 2018-08-21 21:03:18 +0000 | [diff] [blame] | 535 | define <4 x i32> @const_v4i32() { |
| 536 | ret <4 x i32> <i32 50462976, i32 117835012, i32 185207048, i32 252579084> |
| 537 | } |
| 538 | |
Derek Schuff | 4ec8bca | 2018-08-15 00:30:27 +0000 | [diff] [blame] | 539 | ; CHECK-LABEL: splat_v4i32: |
| 540 | ; NO-SIMD128-NOT: i32x4 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 541 | ; SIMD128-NEXT: .functype splat_v4i32 (i32) -> (v128){{$}} |
Thomas Lively | 66f3dc0 | 2018-09-15 01:12:48 +0000 | [diff] [blame] | 542 | ; SIMD128-NEXT: i32x4.splat $push[[R:[0-9]+]]=, $0{{$}} |
| 543 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
Derek Schuff | 4ec8bca | 2018-08-15 00:30:27 +0000 | [diff] [blame] | 544 | define <4 x i32> @splat_v4i32(i32 %x) { |
| 545 | %v = insertelement <4 x i32> undef, i32 %x, i32 0 |
| 546 | %res = shufflevector <4 x i32> %v, <4 x i32> undef, |
| 547 | <4 x i32> <i32 0, i32 0, i32 0, i32 0> |
| 548 | ret <4 x i32> %res |
| 549 | } |
| 550 | |
Thomas Lively | 1b55b2b | 2018-09-04 21:26:17 +0000 | [diff] [blame] | 551 | ; CHECK-LABEL: const_splat_v4i32: |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 552 | ; SIMD128: i32x4.splat |
Thomas Lively | da26b84 | 2018-08-23 19:23:13 +0000 | [diff] [blame] | 553 | define <4 x i32> @const_splat_v4i32() { |
| 554 | ret <4 x i32> <i32 42, i32 42, i32 42, i32 42> |
| 555 | } |
| 556 | |
Heejin Ahn | c15a878 | 2018-08-14 19:10:50 +0000 | [diff] [blame] | 557 | ; CHECK-LABEL: extract_v4i32: |
Heejin Ahn | a0fd9c3 | 2018-08-14 18:53:27 +0000 | [diff] [blame] | 558 | ; NO-SIMD128-NOT: i32x4 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 559 | ; SIMD128-NEXT: .functype extract_v4i32 (v128) -> (i32){{$}} |
Thomas Lively | 66f3dc0 | 2018-09-15 01:12:48 +0000 | [diff] [blame] | 560 | ; SIMD128-NEXT: i32x4.extract_lane $push[[R:[0-9]+]]=, $0, 3{{$}} |
| 561 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
Heejin Ahn | a0fd9c3 | 2018-08-14 18:53:27 +0000 | [diff] [blame] | 562 | define i32 @extract_v4i32(<4 x i32> %v) { |
| 563 | %elem = extractelement <4 x i32> %v, i32 3 |
| 564 | ret i32 %elem |
| 565 | } |
| 566 | |
Thomas Lively | fb84fd7 | 2018-11-02 00:06:56 +0000 | [diff] [blame] | 567 | ; CHECK-LABEL: extract_var_v4i32: |
| 568 | ; NO-SIMD128-NOT: i32x4 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 569 | ; SIMD128-NEXT: .functype extract_var_v4i32 (v128, i32) -> (i32){{$}} |
Sam Clegg | 275d15e | 2019-02-23 00:07:39 +0000 | [diff] [blame] | 570 | ; SIMD128-NEXT: global.get $push[[L0:[0-9]+]]=, __stack_pointer{{$}} |
Thomas Lively | fb84fd7 | 2018-11-02 00:06:56 +0000 | [diff] [blame] | 571 | ; SIMD128-NEXT: i32.const $push[[L1:[0-9]+]]=, 16{{$}} |
| 572 | ; SIMD128-NEXT: i32.sub $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}} |
Thomas Lively | 6a87dda | 2019-01-08 06:25:55 +0000 | [diff] [blame] | 573 | ; SIMD128-NEXT: local.tee $push[[L3:[0-9]+]]=, $2=, $pop[[L2]]{{$}} |
Thomas Lively | fb84fd7 | 2018-11-02 00:06:56 +0000 | [diff] [blame] | 574 | ; SIMD128-NEXT: v128.store 0($pop[[L3]]), $0{{$}} |
| 575 | ; SIMD128-NEXT: i32.const $push[[L4:[0-9]+]]=, 3{{$}} |
| 576 | ; SIMD128-NEXT: i32.and $push[[L5:[0-9]+]]=, $1, $pop[[L4]]{{$}} |
| 577 | ; SIMD128-NEXT: i32.const $push[[L6:[0-9]+]]=, 2{{$}} |
| 578 | ; SIMD128-NEXT: i32.shl $push[[L7:[0-9]+]]=, $pop[[L5]], $pop[[L6]]{{$}} |
| 579 | ; SIMD128-NEXT: i32.or $push[[L4:[0-9]+]]=, $2, $pop[[L7]]{{$}} |
| 580 | ; SIMD128-NEXT: i32.load $push[[R:[0-9]+]]=, 0($pop[[L4]]){{$}} |
| 581 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
| 582 | define i32 @extract_var_v4i32(<4 x i32> %v, i32 %i) { |
| 583 | %elem = extractelement <4 x i32> %v, i32 %i |
| 584 | ret i32 %elem |
| 585 | } |
| 586 | |
Thomas Lively | 11a332d0 | 2018-10-19 19:08:06 +0000 | [diff] [blame] | 587 | ; CHECK-LABEL: extract_undef_v4i32: |
| 588 | ; NO-SIMD128-NOT: i32x4 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 589 | ; SIMD128-NEXT: .functype extract_undef_v4i32 (v128) -> (i32){{$}} |
Thomas Lively | 11a332d0 | 2018-10-19 19:08:06 +0000 | [diff] [blame] | 590 | ; SIMD128-NEXT: i32x4.extract_lane $push[[R:[0-9]+]]=, $0, 0{{$}} |
| 591 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
| 592 | define i32 @extract_undef_v4i32(<4 x i32> %v) { |
| 593 | %elem = extractelement <4 x i32> %v, i32 undef |
| 594 | ret i32 %elem |
| 595 | } |
| 596 | |
Derek Schuff | 82812fb | 2018-08-15 16:18:51 +0000 | [diff] [blame] | 597 | ; CHECK-LABEL: replace_v4i32: |
| 598 | ; NO-SIMD128-NOT: i32x4 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 599 | ; SIMD128-NEXT: .functype replace_v4i32 (v128, i32) -> (v128){{$}} |
Thomas Lively | 66f3dc0 | 2018-09-15 01:12:48 +0000 | [diff] [blame] | 600 | ; SIMD128-NEXT: i32x4.replace_lane $push[[R:[0-9]+]]=, $0, 2, $1{{$}} |
| 601 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
Derek Schuff | 82812fb | 2018-08-15 16:18:51 +0000 | [diff] [blame] | 602 | define <4 x i32> @replace_v4i32(<4 x i32> %v, i32 %x) { |
| 603 | %res = insertelement <4 x i32> %v, i32 %x, i32 2 |
| 604 | ret <4 x i32> %res |
| 605 | } |
| 606 | |
Thomas Lively | fb84fd7 | 2018-11-02 00:06:56 +0000 | [diff] [blame] | 607 | ; CHECK-LABEL: replace_var_v4i32: |
| 608 | ; NO-SIMD128-NOT: i32x4 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 609 | ; SIMD128-NEXT: .functype replace_var_v4i32 (v128, i32, i32) -> (v128){{$}} |
Sam Clegg | 275d15e | 2019-02-23 00:07:39 +0000 | [diff] [blame] | 610 | ; SIMD128-NEXT: global.get $push[[L0:[0-9]+]]=, __stack_pointer{{$}} |
Thomas Lively | fb84fd7 | 2018-11-02 00:06:56 +0000 | [diff] [blame] | 611 | ; SIMD128-NEXT: i32.const $push[[L1:[0-9]+]]=, 16{{$}} |
| 612 | ; SIMD128-NEXT: i32.sub $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}} |
Thomas Lively | 6a87dda | 2019-01-08 06:25:55 +0000 | [diff] [blame] | 613 | ; SIMD128-NEXT: local.tee $push[[L3:[0-9]+]]=, $3=, $pop[[L2]]{{$}} |
Thomas Lively | fb84fd7 | 2018-11-02 00:06:56 +0000 | [diff] [blame] | 614 | ; SIMD128-NEXT: v128.store 0($pop[[L3]]), $0{{$}} |
| 615 | ; SIMD128-NEXT: i32.const $push[[L4:[0-9]+]]=, 3{{$}} |
| 616 | ; SIMD128-NEXT: i32.and $push[[L5:[0-9]+]]=, $1, $pop[[L4]]{{$}} |
| 617 | ; SIMD128-NEXT: i32.const $push[[L6:[0-9]+]]=, 2{{$}} |
| 618 | ; SIMD128-NEXT: i32.shl $push[[L7:[0-9]+]]=, $pop[[L5]], $pop[[L6]]{{$}} |
| 619 | ; SIMD128-NEXT: i32.or $push[[L4:[0-9]+]]=, $3, $pop[[L7]]{{$}} |
| 620 | ; SIMD128-NEXT: i32.store 0($pop[[L4]]), $2{{$}} |
| 621 | ; SIMD128-NEXT: v128.load $push[[R:[0-9]+]]=, 0($3){{$}} |
| 622 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
| 623 | define <4 x i32> @replace_var_v4i32(<4 x i32> %v, i32 %i, i32 %x) { |
| 624 | %res = insertelement <4 x i32> %v, i32 %x, i32 %i |
| 625 | ret <4 x i32> %res |
| 626 | } |
| 627 | |
Thomas Lively | 11a332d0 | 2018-10-19 19:08:06 +0000 | [diff] [blame] | 628 | ; CHECK-LABEL: replace_undef_v4i32: |
| 629 | ; NO-SIMD128-NOT: i32x4 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 630 | ; SIMD128-NEXT: .functype replace_undef_v4i32 (v128, i32) -> (v128){{$}} |
Thomas Lively | 11a332d0 | 2018-10-19 19:08:06 +0000 | [diff] [blame] | 631 | ; SIMD128-NEXT: i32x4.replace_lane $push[[R:[0-9]+]]=, $0, 0, $1{{$}} |
| 632 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
| 633 | define <4 x i32> @replace_undef_v4i32(<4 x i32> %v, i32 %x) { |
| 634 | %res = insertelement <4 x i32> %v, i32 %x, i32 undef |
| 635 | ret <4 x i32> %res |
| 636 | } |
| 637 | |
Thomas Lively | a0d2581 | 2018-09-07 21:54:46 +0000 | [diff] [blame] | 638 | ; CHECK-LABEL: shuffle_v4i32: |
| 639 | ; NO-SIMD128-NOT: v8x16 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 640 | ; SIMD128-NEXT: .functype shuffle_v4i32 (v128, v128) -> (v128){{$}} |
Thomas Lively | 66f3dc0 | 2018-09-15 01:12:48 +0000 | [diff] [blame] | 641 | ; SIMD128-NEXT: v8x16.shuffle $push[[R:[0-9]+]]=, $0, $1, |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 642 | ; SIMD128-SAME: 0, 1, 2, 3, 20, 21, 22, 23, 8, 9, 10, 11, 28, 29, 30, 31{{$}} |
Thomas Lively | 66f3dc0 | 2018-09-15 01:12:48 +0000 | [diff] [blame] | 643 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
Thomas Lively | a0d2581 | 2018-09-07 21:54:46 +0000 | [diff] [blame] | 644 | define <4 x i32> @shuffle_v4i32(<4 x i32> %x, <4 x i32> %y) { |
| 645 | %res = shufflevector <4 x i32> %x, <4 x i32> %y, |
| 646 | <4 x i32> <i32 0, i32 5, i32 2, i32 7> |
| 647 | ret <4 x i32> %res |
| 648 | } |
| 649 | |
Thomas Lively | 11a332d0 | 2018-10-19 19:08:06 +0000 | [diff] [blame] | 650 | ; CHECK-LABEL: shuffle_undef_v4i32: |
| 651 | ; NO-SIMD128-NOT: v8x16 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 652 | ; SIMD128-NEXT: .functype shuffle_undef_v4i32 (v128, v128) -> (v128){{$}} |
Thomas Lively | 11a332d0 | 2018-10-19 19:08:06 +0000 | [diff] [blame] | 653 | ; SIMD128-NEXT: v8x16.shuffle $push[[R:[0-9]+]]=, $0, $0, |
| 654 | ; SIMD128-SAME: 4, 5, 6, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0{{$}} |
| 655 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
| 656 | define <4 x i32> @shuffle_undef_v4i32(<4 x i32> %x, <4 x i32> %y) { |
| 657 | %res = shufflevector <4 x i32> %x, <4 x i32> %y, |
| 658 | <4 x i32> <i32 1, i32 undef, i32 undef, i32 undef> |
| 659 | ret <4 x i32> %res |
| 660 | } |
| 661 | |
Thomas Lively | 2ee686d | 2018-08-22 23:06:27 +0000 | [diff] [blame] | 662 | ; CHECK-LABEL: build_v4i32: |
| 663 | ; NO-SIMD128-NOT: i32x4 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 664 | ; SIMD128-NEXT: .functype build_v4i32 (i32, i32, i32, i32) -> (v128){{$}} |
Thomas Lively | 66f3dc0 | 2018-09-15 01:12:48 +0000 | [diff] [blame] | 665 | ; SIMD128-NEXT: i32x4.splat $push[[L0:[0-9]+]]=, $0{{$}} |
| 666 | ; SIMD128-NEXT: i32x4.replace_lane $push[[L1:[0-9]+]]=, $pop[[L0]], 1, $1{{$}} |
| 667 | ; SIMD128-NEXT: i32x4.replace_lane $push[[L2:[0-9]+]]=, $pop[[L1]], 2, $2{{$}} |
| 668 | ; SIMD128-NEXT: i32x4.replace_lane $push[[R:[0-9]+]]=, $pop[[L2]], 3, $3{{$}} |
| 669 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
Thomas Lively | 2ee686d | 2018-08-22 23:06:27 +0000 | [diff] [blame] | 670 | define <4 x i32> @build_v4i32(i32 %x0, i32 %x1, i32 %x2, i32 %x3) { |
| 671 | %t0 = insertelement <4 x i32> undef, i32 %x0, i32 0 |
| 672 | %t1 = insertelement <4 x i32> %t0, i32 %x1, i32 1 |
| 673 | %t2 = insertelement <4 x i32> %t1, i32 %x2, i32 2 |
| 674 | %res = insertelement <4 x i32> %t2, i32 %x3, i32 3 |
| 675 | ret <4 x i32> %res |
| 676 | } |
| 677 | |
Heejin Ahn | a0fd9c3 | 2018-08-14 18:53:27 +0000 | [diff] [blame] | 678 | ; ============================================================================== |
| 679 | ; 2 x i64 |
| 680 | ; ============================================================================== |
Thomas Lively | 2244292 | 2018-08-21 21:03:18 +0000 | [diff] [blame] | 681 | ; CHECK-LABEL: const_v2i64: |
| 682 | ; NO-SIMD128-NOT: i64x2 |
| 683 | ; SIMD128-VM-NOT: i64x2 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 684 | ; SIMD128-NEXT: .functype const_v2i64 () -> (v128){{$}} |
Thomas Lively | 66f3dc0 | 2018-09-15 01:12:48 +0000 | [diff] [blame] | 685 | ; SIMD128-NEXT: v128.const $push[[R:[0-9]+]]=, 506097522914230528, 1084818905618843912{{$}} |
| 686 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
Thomas Lively | 2244292 | 2018-08-21 21:03:18 +0000 | [diff] [blame] | 687 | define <2 x i64> @const_v2i64() { |
| 688 | ret <2 x i64> <i64 506097522914230528, i64 1084818905618843912> |
| 689 | } |
| 690 | |
Derek Schuff | 4ec8bca | 2018-08-15 00:30:27 +0000 | [diff] [blame] | 691 | ; CHECK-LABEL: splat_v2i64: |
| 692 | ; NO-SIMD128-NOT: i64x2 |
| 693 | ; SIMD128-VM-NOT: i64x2 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 694 | ; SIMD128-NEXT: .functype splat_v2i64 (i64) -> (v128){{$}} |
Thomas Lively | 66f3dc0 | 2018-09-15 01:12:48 +0000 | [diff] [blame] | 695 | ; SIMD128-NEXT: i64x2.splat $push[[R:[0-9]+]]=, $0{{$}} |
| 696 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
Derek Schuff | 4ec8bca | 2018-08-15 00:30:27 +0000 | [diff] [blame] | 697 | define <2 x i64> @splat_v2i64(i64 %x) { |
| 698 | %t1 = insertelement <2 x i64> zeroinitializer, i64 %x, i32 0 |
| 699 | %res = insertelement <2 x i64> %t1, i64 %x, i32 1 |
| 700 | ret <2 x i64> %res |
| 701 | } |
| 702 | |
Thomas Lively | 1b55b2b | 2018-09-04 21:26:17 +0000 | [diff] [blame] | 703 | ; CHECK-LABEL: const_splat_v2i64: |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 704 | ; SIMD128: i64x2.splat |
Thomas Lively | 1b55b2b | 2018-09-04 21:26:17 +0000 | [diff] [blame] | 705 | define <2 x i64> @const_splat_v2i64() { |
| 706 | ret <2 x i64> <i64 42, i64 42> |
| 707 | } |
| 708 | |
Heejin Ahn | c15a878 | 2018-08-14 19:10:50 +0000 | [diff] [blame] | 709 | ; CHECK-LABEL: extract_v2i64: |
Heejin Ahn | a0fd9c3 | 2018-08-14 18:53:27 +0000 | [diff] [blame] | 710 | ; NO-SIMD128-NOT: i64x2 |
| 711 | ; SIMD128-VM-NOT: i64x2 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 712 | ; SIMD128-NEXT: .functype extract_v2i64 (v128) -> (i64){{$}} |
Thomas Lively | 66f3dc0 | 2018-09-15 01:12:48 +0000 | [diff] [blame] | 713 | ; SIMD128-NEXT: i64x2.extract_lane $push[[R:[0-9]+]]=, $0, 1{{$}} |
| 714 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
Heejin Ahn | a0fd9c3 | 2018-08-14 18:53:27 +0000 | [diff] [blame] | 715 | define i64 @extract_v2i64(<2 x i64> %v) { |
| 716 | %elem = extractelement <2 x i64> %v, i64 1 |
| 717 | ret i64 %elem |
| 718 | } |
| 719 | |
Thomas Lively | fb84fd7 | 2018-11-02 00:06:56 +0000 | [diff] [blame] | 720 | ; CHECK-LABEL: extract_var_v2i64: |
| 721 | ; NO-SIMD128-NOT: i64x2 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 722 | ; SIMD128-NEXT: .functype extract_var_v2i64 (v128, i32) -> (i64){{$}} |
Sam Clegg | 275d15e | 2019-02-23 00:07:39 +0000 | [diff] [blame] | 723 | ; SIMD128-NEXT: global.get $push[[L0:[0-9]+]]=, __stack_pointer{{$}} |
Thomas Lively | fb84fd7 | 2018-11-02 00:06:56 +0000 | [diff] [blame] | 724 | ; SIMD128-NEXT: i32.const $push[[L1:[0-9]+]]=, 16{{$}} |
| 725 | ; SIMD128-NEXT: i32.sub $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}} |
Thomas Lively | 6a87dda | 2019-01-08 06:25:55 +0000 | [diff] [blame] | 726 | ; SIMD128-NEXT: local.tee $push[[L3:[0-9]+]]=, $2=, $pop[[L2]]{{$}} |
Thomas Lively | fb84fd7 | 2018-11-02 00:06:56 +0000 | [diff] [blame] | 727 | ; SIMD128-NEXT: v128.store 0($pop[[L3]]), $0{{$}} |
| 728 | ; SIMD128-NEXT: i32.const $push[[L2:[0-9]+]]=, 1{{$}} |
| 729 | ; SIMD128-NEXT: i32.and $push[[L5:[0-9]+]]=, $1, $pop[[L2]]{{$}} |
| 730 | ; SIMD128-NEXT: i32.const $push[[L6:[0-9]+]]=, 3{{$}} |
| 731 | ; SIMD128-NEXT: i32.shl $push[[L7:[0-9]+]]=, $pop[[L5]], $pop[[L6]]{{$}} |
| 732 | ; SIMD128-NEXT: i32.or $push[[L2:[0-9]+]]=, $2, $pop[[L7]]{{$}} |
| 733 | ; SIMD128-NEXT: i64.load $push[[R:[0-9]+]]=, 0($pop[[L2]]){{$}} |
| 734 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
| 735 | define i64 @extract_var_v2i64(<2 x i64> %v, i32 %i) { |
| 736 | %elem = extractelement <2 x i64> %v, i32 %i |
| 737 | ret i64 %elem |
| 738 | } |
| 739 | |
Thomas Lively | 11a332d0 | 2018-10-19 19:08:06 +0000 | [diff] [blame] | 740 | ; CHECK-LABEL: extract_undef_v2i64: |
| 741 | ; NO-SIMD128-NOT: i64x2 |
| 742 | ; SIMD128-VM-NOT: i64x2 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 743 | ; SIMD128-NEXT: .functype extract_undef_v2i64 (v128) -> (i64){{$}} |
Thomas Lively | 11a332d0 | 2018-10-19 19:08:06 +0000 | [diff] [blame] | 744 | ; SIMD128-NEXT: i64x2.extract_lane $push[[R:[0-9]+]]=, $0, 0{{$}} |
| 745 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
| 746 | define i64 @extract_undef_v2i64(<2 x i64> %v) { |
| 747 | %elem = extractelement <2 x i64> %v, i64 undef |
| 748 | ret i64 %elem |
| 749 | } |
| 750 | |
Derek Schuff | 82812fb | 2018-08-15 16:18:51 +0000 | [diff] [blame] | 751 | ; CHECK-LABEL: replace_v2i64: |
| 752 | ; NO-SIMD128-NOT: i64x2 |
| 753 | ; SIMD128-VM-NOT: i64x2 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 754 | ; SIMD128-NEXT: .functype replace_v2i64 (v128, i64) -> (v128){{$}} |
Thomas Lively | 66f3dc0 | 2018-09-15 01:12:48 +0000 | [diff] [blame] | 755 | ; SIMD128-NEXT: i64x2.replace_lane $push[[R:[0-9]+]]=, $0, 0, $1{{$}} |
| 756 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
Derek Schuff | 82812fb | 2018-08-15 16:18:51 +0000 | [diff] [blame] | 757 | define <2 x i64> @replace_v2i64(<2 x i64> %v, i64 %x) { |
| 758 | %res = insertelement <2 x i64> %v, i64 %x, i32 0 |
| 759 | ret <2 x i64> %res |
| 760 | } |
| 761 | |
Thomas Lively | fb84fd7 | 2018-11-02 00:06:56 +0000 | [diff] [blame] | 762 | ; CHECK-LABEL: replace_var_v2i64: |
| 763 | ; NO-SIMD128-NOT: i64x2 |
| 764 | ; SIMD128-VM-NOT: i64x2 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 765 | ; SIMD128-NEXT: .functype replace_var_v2i64 (v128, i32, i64) -> (v128){{$}} |
Sam Clegg | 275d15e | 2019-02-23 00:07:39 +0000 | [diff] [blame] | 766 | ; SIMD128-NEXT: global.get $push[[L0:[0-9]+]]=, __stack_pointer{{$}} |
Thomas Lively | fb84fd7 | 2018-11-02 00:06:56 +0000 | [diff] [blame] | 767 | ; SIMD128-NEXT: i32.const $push[[L1:[0-9]+]]=, 16{{$}} |
| 768 | ; SIMD128-NEXT: i32.sub $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}} |
Thomas Lively | 6a87dda | 2019-01-08 06:25:55 +0000 | [diff] [blame] | 769 | ; SIMD128-NEXT: local.tee $push[[L3:[0-9]+]]=, $3=, $pop[[L2]]{{$}} |
Thomas Lively | fb84fd7 | 2018-11-02 00:06:56 +0000 | [diff] [blame] | 770 | ; SIMD128-NEXT: v128.store 0($pop[[L3]]), $0{{$}} |
| 771 | ; SIMD128-NEXT: i32.const $push[[L2:[0-9]+]]=, 1{{$}} |
| 772 | ; SIMD128-NEXT: i32.and $push[[L5:[0-9]+]]=, $1, $pop[[L2]]{{$}} |
| 773 | ; SIMD128-NEXT: i32.const $push[[L6:[0-9]+]]=, 3{{$}} |
| 774 | ; SIMD128-NEXT: i32.shl $push[[L7:[0-9]+]]=, $pop[[L5]], $pop[[L6]]{{$}} |
| 775 | ; SIMD128-NEXT: i32.or $push[[L2:[0-9]+]]=, $3, $pop[[L7]]{{$}} |
| 776 | ; SIMD128-NEXT: i64.store 0($pop[[L2]]), $2{{$}} |
| 777 | ; SIMD128-NEXT: v128.load $push[[R:[0-9]+]]=, 0($3){{$}} |
| 778 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
| 779 | define <2 x i64> @replace_var_v2i64(<2 x i64> %v, i32 %i, i64 %x) { |
| 780 | %res = insertelement <2 x i64> %v, i64 %x, i32 %i |
| 781 | ret <2 x i64> %res |
| 782 | } |
| 783 | |
Thomas Lively | 11a332d0 | 2018-10-19 19:08:06 +0000 | [diff] [blame] | 784 | ; CHECK-LABEL: replace_undef_v2i64: |
| 785 | ; NO-SIMD128-NOT: i64x2 |
| 786 | ; SIMD128-VM-NOT: i64x2 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 787 | ; SIMD128-NEXT: .functype replace_undef_v2i64 (v128, i64) -> (v128){{$}} |
Thomas Lively | 11a332d0 | 2018-10-19 19:08:06 +0000 | [diff] [blame] | 788 | ; SIMD128-NEXT: i64x2.replace_lane $push[[R:[0-9]+]]=, $0, 0, $1{{$}} |
| 789 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
| 790 | define <2 x i64> @replace_undef_v2i64(<2 x i64> %v, i64 %x) { |
| 791 | %res = insertelement <2 x i64> %v, i64 %x, i32 undef |
| 792 | ret <2 x i64> %res |
| 793 | } |
| 794 | |
Thomas Lively | a0d2581 | 2018-09-07 21:54:46 +0000 | [diff] [blame] | 795 | ; CHECK-LABEL: shuffle_v2i64: |
| 796 | ; NO-SIMD128-NOT: v8x16 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 797 | ; SIMD128-NEXT: .functype shuffle_v2i64 (v128, v128) -> (v128){{$}} |
Thomas Lively | 66f3dc0 | 2018-09-15 01:12:48 +0000 | [diff] [blame] | 798 | ; SIMD128-NEXT: v8x16.shuffle $push[[R:[0-9]+]]=, $0, $1, |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 799 | ; SIMD128-SAME: 0, 1, 2, 3, 4, 5, 6, 7, 24, 25, 26, 27, 28, 29, 30, 31{{$}} |
Thomas Lively | 66f3dc0 | 2018-09-15 01:12:48 +0000 | [diff] [blame] | 800 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
Thomas Lively | a0d2581 | 2018-09-07 21:54:46 +0000 | [diff] [blame] | 801 | define <2 x i64> @shuffle_v2i64(<2 x i64> %x, <2 x i64> %y) { |
| 802 | %res = shufflevector <2 x i64> %x, <2 x i64> %y, <2 x i32> <i32 0, i32 3> |
| 803 | ret <2 x i64> %res |
| 804 | } |
| 805 | |
Thomas Lively | 11a332d0 | 2018-10-19 19:08:06 +0000 | [diff] [blame] | 806 | ; CHECK-LABEL: shuffle_undef_v2i64: |
| 807 | ; NO-SIMD128-NOT: v8x16 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 808 | ; SIMD128-NEXT: .functype shuffle_undef_v2i64 (v128, v128) -> (v128){{$}} |
Thomas Lively | 11a332d0 | 2018-10-19 19:08:06 +0000 | [diff] [blame] | 809 | ; SIMD128-NEXT: v8x16.shuffle $push[[R:[0-9]+]]=, $0, $0, |
| 810 | ; SIMD128-SAME: 8, 9, 10, 11, 12, 13, 14, 15, 0, 0, 0, 0, 0, 0, 0, 0{{$}} |
| 811 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
| 812 | define <2 x i64> @shuffle_undef_v2i64(<2 x i64> %x, <2 x i64> %y) { |
| 813 | %res = shufflevector <2 x i64> %x, <2 x i64> %y, |
| 814 | <2 x i32> <i32 1, i32 undef> |
| 815 | ret <2 x i64> %res |
| 816 | } |
| 817 | |
Thomas Lively | 2ee686d | 2018-08-22 23:06:27 +0000 | [diff] [blame] | 818 | ; CHECK-LABEL: build_v2i64: |
| 819 | ; NO-SIMD128-NOT: i64x2 |
| 820 | ; SIMD128-VM-NOT: i64x2 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 821 | ; SIMD128-NEXT: .functype build_v2i64 (i64, i64) -> (v128){{$}} |
Thomas Lively | 66f3dc0 | 2018-09-15 01:12:48 +0000 | [diff] [blame] | 822 | ; SIMD128-NEXT: i64x2.splat $push[[L0:[0-9]+]]=, $0{{$}} |
| 823 | ; SIMD128-NEXT: i64x2.replace_lane $push[[R:[0-9]+]]=, $pop[[L0]], 1, $1{{$}} |
| 824 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
Thomas Lively | 2ee686d | 2018-08-22 23:06:27 +0000 | [diff] [blame] | 825 | define <2 x i64> @build_v2i64(i64 %x0, i64 %x1) { |
| 826 | %t0 = insertelement <2 x i64> undef, i64 %x0, i32 0 |
| 827 | %res = insertelement <2 x i64> %t0, i64 %x1, i32 1 |
| 828 | ret <2 x i64> %res |
| 829 | } |
| 830 | |
Heejin Ahn | a0fd9c3 | 2018-08-14 18:53:27 +0000 | [diff] [blame] | 831 | ; ============================================================================== |
| 832 | ; 4 x f32 |
| 833 | ; ============================================================================== |
Thomas Lively | 2244292 | 2018-08-21 21:03:18 +0000 | [diff] [blame] | 834 | ; CHECK-LABEL: const_v4f32: |
| 835 | ; NO-SIMD128-NOT: f32x4 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 836 | ; SIMD128-NEXT: .functype const_v4f32 () -> (v128){{$}} |
Thomas Lively | 66f3dc0 | 2018-09-15 01:12:48 +0000 | [diff] [blame] | 837 | ; SIMD128-NEXT: v128.const $push[[R:[0-9]+]]=, |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 838 | ; SIMD128-SAME: 0x1.0402p-121, 0x1.0c0a08p-113, 0x1.14121p-105, 0x1.1c1a18p-97{{$}} |
Thomas Lively | 66f3dc0 | 2018-09-15 01:12:48 +0000 | [diff] [blame] | 839 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
Thomas Lively | 2244292 | 2018-08-21 21:03:18 +0000 | [diff] [blame] | 840 | define <4 x float> @const_v4f32() { |
| 841 | ret <4 x float> <float 0x3860402000000000, float 0x38e0c0a080000000, |
| 842 | float 0x3961412100000000, float 0x39e1c1a180000000> |
| 843 | } |
| 844 | |
Derek Schuff | 4ec8bca | 2018-08-15 00:30:27 +0000 | [diff] [blame] | 845 | ; CHECK-LABEL: splat_v4f32: |
| 846 | ; NO-SIMD128-NOT: f32x4 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 847 | ; SIMD128-NEXT: .functype splat_v4f32 (f32) -> (v128){{$}} |
Thomas Lively | 66f3dc0 | 2018-09-15 01:12:48 +0000 | [diff] [blame] | 848 | ; SIMD128-NEXT: f32x4.splat $push[[R:[0-9]+]]=, $0{{$}} |
| 849 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
Derek Schuff | 4ec8bca | 2018-08-15 00:30:27 +0000 | [diff] [blame] | 850 | define <4 x float> @splat_v4f32(float %x) { |
| 851 | %v = insertelement <4 x float> undef, float %x, i32 0 |
| 852 | %res = shufflevector <4 x float> %v, <4 x float> undef, |
| 853 | <4 x i32> <i32 0, i32 0, i32 0, i32 0> |
| 854 | ret <4 x float> %res |
| 855 | } |
| 856 | |
Thomas Lively | da26b84 | 2018-08-23 19:23:13 +0000 | [diff] [blame] | 857 | ; CHECK-LABEL: const_splat_v4f32 |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 858 | ; SIMD128: f32x4.splat |
Thomas Lively | da26b84 | 2018-08-23 19:23:13 +0000 | [diff] [blame] | 859 | define <4 x float> @const_splat_v4f32() { |
| 860 | ret <4 x float> <float 42., float 42., float 42., float 42.> |
| 861 | } |
| 862 | |
Heejin Ahn | c15a878 | 2018-08-14 19:10:50 +0000 | [diff] [blame] | 863 | ; CHECK-LABEL: extract_v4f32: |
Heejin Ahn | a0fd9c3 | 2018-08-14 18:53:27 +0000 | [diff] [blame] | 864 | ; NO-SIMD128-NOT: f32x4 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 865 | ; SIMD128-NEXT: .functype extract_v4f32 (v128) -> (f32){{$}} |
Thomas Lively | 66f3dc0 | 2018-09-15 01:12:48 +0000 | [diff] [blame] | 866 | ; SIMD128-NEXT: f32x4.extract_lane $push[[R:[0-9]+]]=, $0, 3{{$}} |
| 867 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
Heejin Ahn | a0fd9c3 | 2018-08-14 18:53:27 +0000 | [diff] [blame] | 868 | define float @extract_v4f32(<4 x float> %v) { |
| 869 | %elem = extractelement <4 x float> %v, i32 3 |
| 870 | ret float %elem |
| 871 | } |
| 872 | |
Thomas Lively | fb84fd7 | 2018-11-02 00:06:56 +0000 | [diff] [blame] | 873 | ; CHECK-LABEL: extract_var_v4f32: |
| 874 | ; NO-SIMD128-NOT: i64x2 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 875 | ; SIMD128-NEXT: .functype extract_var_v4f32 (v128, i32) -> (f32){{$}} |
Sam Clegg | 275d15e | 2019-02-23 00:07:39 +0000 | [diff] [blame] | 876 | ; SIMD128-NEXT: global.get $push[[L0:[0-9]+]]=, __stack_pointer{{$}} |
Thomas Lively | fb84fd7 | 2018-11-02 00:06:56 +0000 | [diff] [blame] | 877 | ; SIMD128-NEXT: i32.const $push[[L1:[0-9]+]]=, 16{{$}} |
| 878 | ; SIMD128-NEXT: i32.sub $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}} |
Thomas Lively | 6a87dda | 2019-01-08 06:25:55 +0000 | [diff] [blame] | 879 | ; SIMD128-NEXT: local.tee $push[[L3:[0-9]+]]=, $2=, $pop[[L2]]{{$}} |
Thomas Lively | fb84fd7 | 2018-11-02 00:06:56 +0000 | [diff] [blame] | 880 | ; SIMD128-NEXT: v128.store 0($pop[[L3]]), $0{{$}} |
| 881 | ; SIMD128-NEXT: i32.const $push[[L2:[0-9]+]]=, 3{{$}} |
| 882 | ; SIMD128-NEXT: i32.and $push[[L5:[0-9]+]]=, $1, $pop[[L2]]{{$}} |
| 883 | ; SIMD128-NEXT: i32.const $push[[L6:[0-9]+]]=, 2{{$}} |
| 884 | ; SIMD128-NEXT: i32.shl $push[[L7:[0-9]+]]=, $pop[[L5]], $pop[[L6]]{{$}} |
| 885 | ; SIMD128-NEXT: i32.or $push[[L2:[0-9]+]]=, $2, $pop[[L7]]{{$}} |
| 886 | ; SIMD128-NEXT: f32.load $push[[R:[0-9]+]]=, 0($pop[[L2]]){{$}} |
| 887 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
| 888 | define float @extract_var_v4f32(<4 x float> %v, i32 %i) { |
| 889 | %elem = extractelement <4 x float> %v, i32 %i |
| 890 | ret float %elem |
| 891 | } |
| 892 | |
Thomas Lively | 11a332d0 | 2018-10-19 19:08:06 +0000 | [diff] [blame] | 893 | ; CHECK-LABEL: extract_undef_v4f32: |
| 894 | ; NO-SIMD128-NOT: f32x4 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 895 | ; SIMD128-NEXT: .functype extract_undef_v4f32 (v128) -> (f32){{$}} |
Thomas Lively | 11a332d0 | 2018-10-19 19:08:06 +0000 | [diff] [blame] | 896 | ; SIMD128-NEXT: f32x4.extract_lane $push[[R:[0-9]+]]=, $0, 0{{$}} |
| 897 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
| 898 | define float @extract_undef_v4f32(<4 x float> %v) { |
| 899 | %elem = extractelement <4 x float> %v, i32 undef |
| 900 | ret float %elem |
| 901 | } |
| 902 | |
Derek Schuff | 82812fb | 2018-08-15 16:18:51 +0000 | [diff] [blame] | 903 | ; CHECK-LABEL: replace_v4f32: |
| 904 | ; NO-SIMD128-NOT: f32x4 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 905 | ; SIMD128-NEXT: .functype replace_v4f32 (v128, f32) -> (v128){{$}} |
Thomas Lively | 66f3dc0 | 2018-09-15 01:12:48 +0000 | [diff] [blame] | 906 | ; SIMD128-NEXT: f32x4.replace_lane $push[[R:[0-9]+]]=, $0, 2, $1{{$}} |
| 907 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
Derek Schuff | 82812fb | 2018-08-15 16:18:51 +0000 | [diff] [blame] | 908 | define <4 x float> @replace_v4f32(<4 x float> %v, float %x) { |
| 909 | %res = insertelement <4 x float> %v, float %x, i32 2 |
| 910 | ret <4 x float> %res |
| 911 | } |
| 912 | |
Thomas Lively | fb84fd7 | 2018-11-02 00:06:56 +0000 | [diff] [blame] | 913 | ; CHECK-LABEL: replace_var_v4f32: |
| 914 | ; NO-SIMD128-NOT: f32x4 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 915 | ; SIMD128-NEXT: .functype replace_var_v4f32 (v128, i32, f32) -> (v128){{$}} |
Sam Clegg | 275d15e | 2019-02-23 00:07:39 +0000 | [diff] [blame] | 916 | ; SIMD128-NEXT: global.get $push[[L0:[0-9]+]]=, __stack_pointer{{$}} |
Thomas Lively | fb84fd7 | 2018-11-02 00:06:56 +0000 | [diff] [blame] | 917 | ; SIMD128-NEXT: i32.const $push[[L1:[0-9]+]]=, 16{{$}} |
| 918 | ; SIMD128-NEXT: i32.sub $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}} |
Thomas Lively | 6a87dda | 2019-01-08 06:25:55 +0000 | [diff] [blame] | 919 | ; SIMD128-NEXT: local.tee $push[[L3:[0-9]+]]=, $3=, $pop[[L2]]{{$}} |
Thomas Lively | fb84fd7 | 2018-11-02 00:06:56 +0000 | [diff] [blame] | 920 | ; SIMD128-NEXT: v128.store 0($pop[[L3]]), $0{{$}} |
| 921 | ; SIMD128-NEXT: i32.const $push[[L2:[0-9]+]]=, 3{{$}} |
| 922 | ; SIMD128-NEXT: i32.and $push[[L5:[0-9]+]]=, $1, $pop[[L2]]{{$}} |
| 923 | ; SIMD128-NEXT: i32.const $push[[L6:[0-9]+]]=, 2{{$}} |
| 924 | ; SIMD128-NEXT: i32.shl $push[[L7:[0-9]+]]=, $pop[[L5]], $pop[[L6]]{{$}} |
| 925 | ; SIMD128-NEXT: i32.or $push[[L2:[0-9]+]]=, $3, $pop[[L7]]{{$}} |
| 926 | ; SIMD128-NEXT: f32.store 0($pop[[L2]]), $2{{$}} |
| 927 | ; SIMD128-NEXT: v128.load $push[[R:[0-9]+]]=, 0($3){{$}} |
| 928 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
| 929 | define <4 x float> @replace_var_v4f32(<4 x float> %v, i32 %i, float %x) { |
| 930 | %res = insertelement <4 x float> %v, float %x, i32 %i |
| 931 | ret <4 x float> %res |
| 932 | } |
| 933 | |
Thomas Lively | 11a332d0 | 2018-10-19 19:08:06 +0000 | [diff] [blame] | 934 | ; CHECK-LABEL: replace_undef_v4f32: |
| 935 | ; NO-SIMD128-NOT: f32x4 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 936 | ; SIMD128-NEXT: .functype replace_undef_v4f32 (v128, f32) -> (v128){{$}} |
Thomas Lively | 11a332d0 | 2018-10-19 19:08:06 +0000 | [diff] [blame] | 937 | ; SIMD128-NEXT: f32x4.replace_lane $push[[R:[0-9]+]]=, $0, 0, $1{{$}} |
| 938 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
| 939 | define <4 x float> @replace_undef_v4f32(<4 x float> %v, float %x) { |
| 940 | %res = insertelement <4 x float> %v, float %x, i32 undef |
| 941 | ret <4 x float> %res |
| 942 | } |
| 943 | |
Thomas Lively | a0d2581 | 2018-09-07 21:54:46 +0000 | [diff] [blame] | 944 | ; CHECK-LABEL: shuffle_v4f32: |
| 945 | ; NO-SIMD128-NOT: v8x16 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 946 | ; SIMD128-NEXT: .functype shuffle_v4f32 (v128, v128) -> (v128){{$}} |
Thomas Lively | 66f3dc0 | 2018-09-15 01:12:48 +0000 | [diff] [blame] | 947 | ; SIMD128-NEXT: v8x16.shuffle $push[[R:[0-9]+]]=, $0, $1, |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 948 | ; SIMD128-SAME: 0, 1, 2, 3, 20, 21, 22, 23, 8, 9, 10, 11, 28, 29, 30, 31{{$}} |
Thomas Lively | 66f3dc0 | 2018-09-15 01:12:48 +0000 | [diff] [blame] | 949 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
Thomas Lively | a0d2581 | 2018-09-07 21:54:46 +0000 | [diff] [blame] | 950 | define <4 x float> @shuffle_v4f32(<4 x float> %x, <4 x float> %y) { |
| 951 | %res = shufflevector <4 x float> %x, <4 x float> %y, |
| 952 | <4 x i32> <i32 0, i32 5, i32 2, i32 7> |
| 953 | ret <4 x float> %res |
| 954 | } |
| 955 | |
Thomas Lively | 11a332d0 | 2018-10-19 19:08:06 +0000 | [diff] [blame] | 956 | ; CHECK-LABEL: shuffle_undef_v4f32: |
| 957 | ; NO-SIMD128-NOT: v8x16 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 958 | ; SIMD128-NEXT: .functype shuffle_undef_v4f32 (v128, v128) -> (v128){{$}} |
Thomas Lively | 11a332d0 | 2018-10-19 19:08:06 +0000 | [diff] [blame] | 959 | ; SIMD128-NEXT: v8x16.shuffle $push[[R:[0-9]+]]=, $0, $0, |
| 960 | ; SIMD128-SAME: 4, 5, 6, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0{{$}} |
| 961 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
| 962 | define <4 x float> @shuffle_undef_v4f32(<4 x float> %x, <4 x float> %y) { |
| 963 | %res = shufflevector <4 x float> %x, <4 x float> %y, |
| 964 | <4 x i32> <i32 1, i32 undef, i32 undef, i32 undef> |
| 965 | ret <4 x float> %res |
| 966 | } |
| 967 | |
Thomas Lively | 2ee686d | 2018-08-22 23:06:27 +0000 | [diff] [blame] | 968 | ; CHECK-LABEL: build_v4f32: |
| 969 | ; NO-SIMD128-NOT: f32x4 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 970 | ; SIMD128-NEXT: .functype build_v4f32 (f32, f32, f32, f32) -> (v128){{$}} |
Thomas Lively | 66f3dc0 | 2018-09-15 01:12:48 +0000 | [diff] [blame] | 971 | ; SIMD128-NEXT: f32x4.splat $push[[L0:[0-9]+]]=, $0{{$}} |
| 972 | ; SIMD128-NEXT: f32x4.replace_lane $push[[L1:[0-9]+]]=, $pop[[L0]], 1, $1{{$}} |
| 973 | ; SIMD128-NEXT: f32x4.replace_lane $push[[L2:[0-9]+]]=, $pop[[L1]], 2, $2{{$}} |
| 974 | ; SIMD128-NEXT: f32x4.replace_lane $push[[R:[0-9]+]]=, $pop[[L2]], 3, $3{{$}} |
| 975 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
Thomas Lively | 2ee686d | 2018-08-22 23:06:27 +0000 | [diff] [blame] | 976 | define <4 x float> @build_v4f32(float %x0, float %x1, float %x2, float %x3) { |
| 977 | %t0 = insertelement <4 x float> undef, float %x0, i32 0 |
| 978 | %t1 = insertelement <4 x float> %t0, float %x1, i32 1 |
| 979 | %t2 = insertelement <4 x float> %t1, float %x2, i32 2 |
| 980 | %res = insertelement <4 x float> %t2, float %x3, i32 3 |
| 981 | ret <4 x float> %res |
| 982 | } |
| 983 | |
Heejin Ahn | a0fd9c3 | 2018-08-14 18:53:27 +0000 | [diff] [blame] | 984 | ; ============================================================================== |
| 985 | ; 2 x f64 |
| 986 | ; ============================================================================== |
Thomas Lively | 2244292 | 2018-08-21 21:03:18 +0000 | [diff] [blame] | 987 | ; CHECK-LABEL: const_v2f64: |
| 988 | ; NO-SIMD128-NOT: f64x2 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 989 | ; SIMD128-NEXT: .functype const_v2f64 () -> (v128){{$}} |
Thomas Lively | 66f3dc0 | 2018-09-15 01:12:48 +0000 | [diff] [blame] | 990 | ; SIMD128-NEXT: v128.const $push[[R:[0-9]+]]=, 0x1.60504030201p-911, 0x1.e0d0c0b0a0908p-783{{$}} |
| 991 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
Thomas Lively | 2244292 | 2018-08-21 21:03:18 +0000 | [diff] [blame] | 992 | define <2 x double> @const_v2f64() { |
| 993 | ret <2 x double> <double 0x0706050403020100, double 0x0F0E0D0C0B0A0908> |
| 994 | } |
| 995 | |
Derek Schuff | 4ec8bca | 2018-08-15 00:30:27 +0000 | [diff] [blame] | 996 | ; CHECK-LABEL: splat_v2f64: |
| 997 | ; NO-SIMD128-NOT: f64x2 |
| 998 | ; SIMD128-VM-NOT: f64x2 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 999 | ; SIMD128-NEXT: .functype splat_v2f64 (f64) -> (v128){{$}} |
Thomas Lively | 66f3dc0 | 2018-09-15 01:12:48 +0000 | [diff] [blame] | 1000 | ; SIMD128-NEXT: f64x2.splat $push[[R:[0-9]+]]=, $0{{$}} |
| 1001 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
Derek Schuff | 4ec8bca | 2018-08-15 00:30:27 +0000 | [diff] [blame] | 1002 | define <2 x double> @splat_v2f64(double %x) { |
| 1003 | %t1 = insertelement <2 x double> zeroinitializer, double %x, i3 0 |
| 1004 | %res = insertelement <2 x double> %t1, double %x, i32 1 |
| 1005 | ret <2 x double> %res |
| 1006 | } |
| 1007 | |
Thomas Lively | da26b84 | 2018-08-23 19:23:13 +0000 | [diff] [blame] | 1008 | ; CHECK-LABEL: const_splat_v2f64: |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 1009 | ; SIMD128: f64x2.splat |
Thomas Lively | da26b84 | 2018-08-23 19:23:13 +0000 | [diff] [blame] | 1010 | define <2 x double> @const_splat_v2f64() { |
| 1011 | ret <2 x double> <double 42., double 42.> |
| 1012 | } |
| 1013 | |
Heejin Ahn | c15a878 | 2018-08-14 19:10:50 +0000 | [diff] [blame] | 1014 | ; CHECK-LABEL: extract_v2f64: |
Heejin Ahn | a0fd9c3 | 2018-08-14 18:53:27 +0000 | [diff] [blame] | 1015 | ; NO-SIMD128-NOT: f64x2 |
| 1016 | ; SIMD128-VM-NOT: f64x2 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 1017 | ; SIMD128-NEXT: .functype extract_v2f64 (v128) -> (f64){{$}} |
Thomas Lively | 66f3dc0 | 2018-09-15 01:12:48 +0000 | [diff] [blame] | 1018 | ; SIMD128-NEXT: f64x2.extract_lane $push[[R:[0-9]+]]=, $0, 1{{$}} |
| 1019 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
Heejin Ahn | a0fd9c3 | 2018-08-14 18:53:27 +0000 | [diff] [blame] | 1020 | define double @extract_v2f64(<2 x double> %v) { |
| 1021 | %elem = extractelement <2 x double> %v, i32 1 |
| 1022 | ret double %elem |
| 1023 | } |
Derek Schuff | 82812fb | 2018-08-15 16:18:51 +0000 | [diff] [blame] | 1024 | |
Thomas Lively | fb84fd7 | 2018-11-02 00:06:56 +0000 | [diff] [blame] | 1025 | ; CHECK-LABEL: extract_var_v2f64: |
| 1026 | ; NO-SIMD128-NOT: i62x2 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 1027 | ; SIMD128-NEXT: .functype extract_var_v2f64 (v128, i32) -> (f64){{$}} |
Sam Clegg | 275d15e | 2019-02-23 00:07:39 +0000 | [diff] [blame] | 1028 | ; SIMD128-NEXT: global.get $push[[L0:[0-9]+]]=, __stack_pointer{{$}} |
Thomas Lively | fb84fd7 | 2018-11-02 00:06:56 +0000 | [diff] [blame] | 1029 | ; SIMD128-NEXT: i32.const $push[[L1:[0-9]+]]=, 16{{$}} |
| 1030 | ; SIMD128-NEXT: i32.sub $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}} |
Thomas Lively | 6a87dda | 2019-01-08 06:25:55 +0000 | [diff] [blame] | 1031 | ; SIMD128-NEXT: local.tee $push[[L3:[0-9]+]]=, $2=, $pop[[L2]]{{$}} |
Thomas Lively | fb84fd7 | 2018-11-02 00:06:56 +0000 | [diff] [blame] | 1032 | ; SIMD128-NEXT: v128.store 0($pop[[L3]]), $0{{$}} |
| 1033 | ; SIMD128-NEXT: i32.const $push[[L2:[0-9]+]]=, 1{{$}} |
| 1034 | ; SIMD128-NEXT: i32.and $push[[L5:[0-9]+]]=, $1, $pop[[L2]]{{$}} |
| 1035 | ; SIMD128-NEXT: i32.const $push[[L6:[0-9]+]]=, 3{{$}} |
| 1036 | ; SIMD128-NEXT: i32.shl $push[[L7:[0-9]+]]=, $pop[[L5]], $pop[[L6]]{{$}} |
| 1037 | ; SIMD128-NEXT: i32.or $push[[L2:[0-9]+]]=, $2, $pop[[L7]]{{$}} |
| 1038 | ; SIMD128-NEXT: f64.load $push[[R:[0-9]+]]=, 0($pop[[L2]]){{$}} |
| 1039 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
| 1040 | define double @extract_var_v2f64(<2 x double> %v, i32 %i) { |
| 1041 | %elem = extractelement <2 x double> %v, i32 %i |
| 1042 | ret double %elem |
| 1043 | } |
| 1044 | |
Thomas Lively | 11a332d0 | 2018-10-19 19:08:06 +0000 | [diff] [blame] | 1045 | ; CHECK-LABEL: extract_undef_v2f64: |
| 1046 | ; NO-SIMD128-NOT: f64x2 |
| 1047 | ; SIMD128-VM-NOT: f64x2 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 1048 | ; SIMD128-NEXT: .functype extract_undef_v2f64 (v128) -> (f64){{$}} |
Thomas Lively | 11a332d0 | 2018-10-19 19:08:06 +0000 | [diff] [blame] | 1049 | ; SIMD128-NEXT: f64x2.extract_lane $push[[R:[0-9]+]]=, $0, 0{{$}} |
| 1050 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
| 1051 | define double @extract_undef_v2f64(<2 x double> %v) { |
| 1052 | %elem = extractelement <2 x double> %v, i32 undef |
| 1053 | ret double %elem |
| 1054 | } |
| 1055 | |
Derek Schuff | 82812fb | 2018-08-15 16:18:51 +0000 | [diff] [blame] | 1056 | ; CHECK-LABEL: replace_v2f64: |
| 1057 | ; NO-SIMD128-NOT: f64x2 |
| 1058 | ; SIMD128-VM-NOT: f64x2 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 1059 | ; SIMD128-NEXT: .functype replace_v2f64 (v128, f64) -> (v128){{$}} |
Thomas Lively | 66f3dc0 | 2018-09-15 01:12:48 +0000 | [diff] [blame] | 1060 | ; SIMD128-NEXT: f64x2.replace_lane $push[[R:[0-9]+]]=, $0, 0, $1{{$}} |
| 1061 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
Derek Schuff | 82812fb | 2018-08-15 16:18:51 +0000 | [diff] [blame] | 1062 | define <2 x double> @replace_v2f64(<2 x double> %v, double %x) { |
| 1063 | %res = insertelement <2 x double> %v, double %x, i32 0 |
| 1064 | ret <2 x double> %res |
| 1065 | } |
Thomas Lively | 2ee686d | 2018-08-22 23:06:27 +0000 | [diff] [blame] | 1066 | |
Thomas Lively | fb84fd7 | 2018-11-02 00:06:56 +0000 | [diff] [blame] | 1067 | ; CHECK-LABEL: replace_var_v2f64: |
| 1068 | ; NO-SIMD128-NOT: f64x2 |
| 1069 | ; SIMD128-VM-NOT: f64x2 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 1070 | ; SIMD128-NEXT: .functype replace_var_v2f64 (v128, i32, f64) -> (v128){{$}} |
Sam Clegg | 275d15e | 2019-02-23 00:07:39 +0000 | [diff] [blame] | 1071 | ; SIMD128-NEXT: global.get $push[[L0:[0-9]+]]=, __stack_pointer{{$}} |
Thomas Lively | fb84fd7 | 2018-11-02 00:06:56 +0000 | [diff] [blame] | 1072 | ; SIMD128-NEXT: i32.const $push[[L1:[0-9]+]]=, 16{{$}} |
| 1073 | ; SIMD128-NEXT: i32.sub $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}} |
Thomas Lively | 6a87dda | 2019-01-08 06:25:55 +0000 | [diff] [blame] | 1074 | ; SIMD128-NEXT: local.tee $push[[L3:[0-9]+]]=, $3=, $pop[[L2]]{{$}} |
Thomas Lively | fb84fd7 | 2018-11-02 00:06:56 +0000 | [diff] [blame] | 1075 | ; SIMD128-NEXT: v128.store 0($pop[[L3]]), $0{{$}} |
| 1076 | ; SIMD128-NEXT: i32.const $push[[L2:[0-9]+]]=, 1{{$}} |
| 1077 | ; SIMD128-NEXT: i32.and $push[[L5:[0-9]+]]=, $1, $pop[[L2]]{{$}} |
| 1078 | ; SIMD128-NEXT: i32.const $push[[L6:[0-9]+]]=, 3{{$}} |
| 1079 | ; SIMD128-NEXT: i32.shl $push[[L7:[0-9]+]]=, $pop[[L5]], $pop[[L6]]{{$}} |
| 1080 | ; SIMD128-NEXT: i32.or $push[[L2:[0-9]+]]=, $3, $pop[[L7]]{{$}} |
| 1081 | ; SIMD128-NEXT: f64.store 0($pop[[L2]]), $2{{$}} |
| 1082 | ; SIMD128-NEXT: v128.load $push[[R:[0-9]+]]=, 0($3){{$}} |
| 1083 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
| 1084 | define <2 x double> @replace_var_v2f64(<2 x double> %v, i32 %i, double %x) { |
| 1085 | %res = insertelement <2 x double> %v, double %x, i32 %i |
| 1086 | ret <2 x double> %res |
| 1087 | } |
| 1088 | |
Thomas Lively | 11a332d0 | 2018-10-19 19:08:06 +0000 | [diff] [blame] | 1089 | ; CHECK-LABEL: replace_undef_v2f64: |
| 1090 | ; NO-SIMD128-NOT: f64x2 |
| 1091 | ; SIMD128-VM-NOT: f64x2 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 1092 | ; SIMD128-NEXT: .functype replace_undef_v2f64 (v128, f64) -> (v128){{$}} |
Thomas Lively | 11a332d0 | 2018-10-19 19:08:06 +0000 | [diff] [blame] | 1093 | ; SIMD128-NEXT: f64x2.replace_lane $push[[R:[0-9]+]]=, $0, 0, $1{{$}} |
| 1094 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
| 1095 | define <2 x double> @replace_undef_v2f64(<2 x double> %v, double %x) { |
| 1096 | %res = insertelement <2 x double> %v, double %x, i32 undef |
| 1097 | ret <2 x double> %res |
| 1098 | } |
| 1099 | |
Thomas Lively | a0d2581 | 2018-09-07 21:54:46 +0000 | [diff] [blame] | 1100 | ; CHECK-LABEL: shuffle_v2f64: |
| 1101 | ; NO-SIMD128-NOT: v8x16 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 1102 | ; SIMD128-NEXT: .functype shuffle_v2f64 (v128, v128) -> (v128){{$}} |
Thomas Lively | 66f3dc0 | 2018-09-15 01:12:48 +0000 | [diff] [blame] | 1103 | ; SIMD128-NEXT: v8x16.shuffle $push[[R:[0-9]+]]=, $0, $1, |
Thomas Lively | a3937b2 | 2018-09-14 21:21:42 +0000 | [diff] [blame] | 1104 | ; SIMD128-SAME: 0, 1, 2, 3, 4, 5, 6, 7, 24, 25, 26, 27, 28, 29, 30, 31{{$}} |
Thomas Lively | 66f3dc0 | 2018-09-15 01:12:48 +0000 | [diff] [blame] | 1105 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
Thomas Lively | a0d2581 | 2018-09-07 21:54:46 +0000 | [diff] [blame] | 1106 | define <2 x double> @shuffle_v2f64(<2 x double> %x, <2 x double> %y) { |
| 1107 | %res = shufflevector <2 x double> %x, <2 x double> %y, |
| 1108 | <2 x i32> <i32 0, i32 3> |
| 1109 | ret <2 x double> %res |
| 1110 | } |
| 1111 | |
Thomas Lively | 11a332d0 | 2018-10-19 19:08:06 +0000 | [diff] [blame] | 1112 | ; CHECK-LABEL: shuffle_undef_v2f64: |
| 1113 | ; NO-SIMD128-NOT: v8x16 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 1114 | ; SIMD128-NEXT: .functype shuffle_undef_v2f64 (v128, v128) -> (v128){{$}} |
Thomas Lively | 11a332d0 | 2018-10-19 19:08:06 +0000 | [diff] [blame] | 1115 | ; SIMD128-NEXT: v8x16.shuffle $push[[R:[0-9]+]]=, $0, $0, |
| 1116 | ; SIMD128-SAME: 8, 9, 10, 11, 12, 13, 14, 15, 0, 0, 0, 0, 0, 0, 0, 0{{$}} |
| 1117 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
| 1118 | define <2 x double> @shuffle_undef_v2f64(<2 x double> %x, <2 x double> %y) { |
| 1119 | %res = shufflevector <2 x double> %x, <2 x double> %y, |
| 1120 | <2 x i32> <i32 1, i32 undef> |
| 1121 | ret <2 x double> %res |
| 1122 | } |
| 1123 | |
Thomas Lively | 2ee686d | 2018-08-22 23:06:27 +0000 | [diff] [blame] | 1124 | ; CHECK-LABEL: build_v2f64: |
| 1125 | ; NO-SIMD128-NOT: f64x2 |
| 1126 | ; SIMD128-VM-NOT: f64x2 |
Wouter van Oortmerssen | 49482f8 | 2018-11-19 17:10:36 +0000 | [diff] [blame] | 1127 | ; SIMD128-NEXT: .functype build_v2f64 (f64, f64) -> (v128){{$}} |
Thomas Lively | 66f3dc0 | 2018-09-15 01:12:48 +0000 | [diff] [blame] | 1128 | ; SIMD128-NEXT: f64x2.splat $push[[L0:[0-9]+]]=, $0{{$}} |
| 1129 | ; SIMD128-NEXT: f64x2.replace_lane $push[[R:[0-9]+]]=, $pop[[L0]], 1, $1{{$}} |
| 1130 | ; SIMD128-NEXT: return $pop[[R]]{{$}} |
Thomas Lively | 2ee686d | 2018-08-22 23:06:27 +0000 | [diff] [blame] | 1131 | define <2 x double> @build_v2f64(double %x0, double %x1) { |
| 1132 | %t0 = insertelement <2 x double> undef, double %x0, i32 0 |
| 1133 | %res = insertelement <2 x double> %t0, double %x1, i32 1 |
| 1134 | ret <2 x double> %res |
| 1135 | } |