blob: 6c11672b6bb2eee23e08bf78e45fd669325fb8a9 [file] [log] [blame]
Thomas Livelya3937b22018-09-14 21:21:42 +00001; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -wasm-keep-registers -wasm-enable-unimplemented-simd -mattr=+simd128 | FileCheck %s --check-prefixes CHECK,SIMD128
2; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -wasm-keep-registers -wasm-enable-unimplemented-simd -mattr=+simd128 -fast-isel | FileCheck %s --check-prefixes CHECK,SIMD128
3; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -wasm-keep-registers -mattr=+simd128 | FileCheck %s --check-prefixes CHECK,SIMD128-VM
4; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -wasm-keep-registers -mattr=+simd128 -fast-isel | FileCheck %s --check-prefixes CHECK,SIMD128-VM
5; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -wasm-keep-registers -mattr=-simd128 | FileCheck %s --check-prefixes CHECK,NO-SIMD128
6; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -wasm-keep-registers -mattr=-simd128 -fast-isel | FileCheck %s --check-prefixes CHECK,NO-SIMD128
Derek Schuff39bf39f2016-08-02 23:16:09 +00007
8; Test that basic SIMD128 arithmetic operations assemble as expected.
9
10target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
Sam Clegga5908002018-05-10 17:49:11 +000011target triple = "wasm32-unknown-unknown"
Derek Schuff39bf39f2016-08-02 23:16:09 +000012
Derek Schuff39bf39f2016-08-02 23:16:09 +000013; ==============================================================================
14; 16 x i8
15; ==============================================================================
Thomas Livelya3937b22018-09-14 21:21:42 +000016; CHECK-LABEL: add_v16i8:
Derek Schuff39bf39f2016-08-02 23:16:09 +000017; NO-SIMD128-NOT: i8x16
Thomas Livelya3937b22018-09-14 21:21:42 +000018; SIMD128-NEXT: .param v128, v128{{$}}
19; SIMD128-NEXT: .result v128{{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +000020; SIMD128-NEXT: i8x16.add $push[[R:[0-9]+]]=, $0, $1{{$}}
21; SIMD128-NEXT: return $pop[[R]]{{$}}
Derek Schuff39bf39f2016-08-02 23:16:09 +000022define <16 x i8> @add_v16i8(<16 x i8> %x, <16 x i8> %y) {
23 %a = add <16 x i8> %x, %y
24 ret <16 x i8> %a
25}
26
Thomas Livelya3937b22018-09-14 21:21:42 +000027; CHECK-LABEL: sub_v16i8:
Derek Schuff39bf39f2016-08-02 23:16:09 +000028; NO-SIMD128-NOT: i8x16
Thomas Livelya3937b22018-09-14 21:21:42 +000029; SIMD128-NEXT: .param v128, v128{{$}}
30; SIMD128-NEXT: .result v128{{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +000031; SIMD128-NEXT: i8x16.sub $push[[R:[0-9]+]]=, $0, $1{{$}}
32; SIMD128-NEXT: return $pop[[R]]{{$}}
Derek Schuff39bf39f2016-08-02 23:16:09 +000033define <16 x i8> @sub_v16i8(<16 x i8> %x, <16 x i8> %y) {
34 %a = sub <16 x i8> %x, %y
35 ret <16 x i8> %a
36}
37
Thomas Livelya3937b22018-09-14 21:21:42 +000038; CHECK-LABEL: mul_v16i8:
Derek Schuff39bf39f2016-08-02 23:16:09 +000039; NO-SIMD128-NOT: i8x16
Thomas Livelya3937b22018-09-14 21:21:42 +000040; SIMD128-NEXT: .param v128, v128{{$}}
41; SIMD128-NEXT: .result v128{{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +000042; SIMD128-NEXT: i8x16.mul $push[[R:[0-9]+]]=, $0, $1{{$}}
43; SIMD128-NEXT: return $pop[[R]]{{$}}
Derek Schuff39bf39f2016-08-02 23:16:09 +000044define <16 x i8> @mul_v16i8(<16 x i8> %x, <16 x i8> %y) {
45 %a = mul <16 x i8> %x, %y
46 ret <16 x i8> %a
47}
48
Thomas Lively88b74432018-09-14 22:35:12 +000049; CHECK-LABEL: neg_v16i8:
50; NO-SIMD128-NOT: i8x16
51; SIMD128-NEXT: .param v128{{$}}
52; SIMD128-NEXT: .result v128{{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +000053; SIMD128-NEXT: i8x16.neg $push[[R:[0-9]+]]=, $0{{$}}
54; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Lively88b74432018-09-14 22:35:12 +000055define <16 x i8> @neg_v16i8(<16 x i8> %x) {
56 %a = sub <16 x i8> <i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0,
57 i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0>,
58 %x
59 ret <16 x i8> %a
60}
61
Thomas Livelyf2550e02018-09-15 00:45:31 +000062; CHECK-LABEL: shl_v16i8:
63; NO-SIMD128-NOT: i8x16
64; SIMD128-NEXT: .param v128, i32{{$}}
65; SIMD128-NEXT: .result v128{{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +000066; SIMD128-NEXT: i8x16.shl $push[[R:[0-9]+]]=, $0, $1{{$}}
67; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Livelyf2550e02018-09-15 00:45:31 +000068define <16 x i8> @shl_v16i8(<16 x i8> %v, i8 %x) {
69 %t = insertelement <16 x i8> undef, i8 %x, i32 0
70 %s = shufflevector <16 x i8> %t, <16 x i8> undef,
71 <16 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0,
72 i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
73 %a = shl <16 x i8> %v, %s
74 ret <16 x i8> %a
75}
76
77; CHECK-LABEL: shl_const_v16i8:
78; NO-SIMD128-NOT: i8x16
79; SIMD128-NEXT: .param v128{{$}}
80; SIMD128-NEXT: .result v128{{$}}
81; SIMD128-NEXT: i32.const $push[[L0:[0-9]+]]=, 5
82; SIMD128-NEXT: i8x16.shl $push[[R:[0-9]+]]=, $0, $pop[[L0]]{{$}}
83; SIMD128-NEXT: return $pop[[R]]{{$}}
84define <16 x i8> @shl_const_v16i8(<16 x i8> %v) {
85 %a = shl <16 x i8> %v,
86 <i8 5, i8 5, i8 5, i8 5, i8 5, i8 5, i8 5, i8 5,
87 i8 5, i8 5, i8 5, i8 5, i8 5, i8 5, i8 5, i8 5>
88 ret <16 x i8> %a
89}
90
91; CHECK-LABEL: shr_s_v16i8:
92; NO-SIMD128-NOT: i8x16
93; SIMD128-NEXT: .param v128, i32{{$}}
94; SIMD128-NEXT: .result v128{{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +000095; SIMD128-NEXT: i8x16.shr_s $push[[R:[0-9]+]]=, $0, $1{{$}}
96; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Livelyf2550e02018-09-15 00:45:31 +000097define <16 x i8> @shr_s_v16i8(<16 x i8> %v, i8 %x) {
98 %t = insertelement <16 x i8> undef, i8 %x, i32 0
99 %s = shufflevector <16 x i8> %t, <16 x i8> undef,
100 <16 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0,
101 i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
102 %a = ashr <16 x i8> %v, %s
103 ret <16 x i8> %a
104}
105
106; CHECK-LABEL: shr_u_v16i8:
107; NO-SIMD128-NOT: i8x16
108; SIMD128-NEXT: .param v128, i32{{$}}
109; SIMD128-NEXT: .result v128{{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000110; SIMD128-NEXT: i8x16.shr_u $push[[R:[0-9]+]]=, $0, $1{{$}}
111; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Livelyf2550e02018-09-15 00:45:31 +0000112define <16 x i8> @shr_u_v16i8(<16 x i8> %v, i8 %x) {
113 %t = insertelement <16 x i8> undef, i8 %x, i32 0
114 %s = shufflevector <16 x i8> %t, <16 x i8> undef,
115 <16 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0,
116 i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
117 %a = lshr <16 x i8> %v, %s
118 ret <16 x i8> %a
119}
120
Thomas Livelya3937b22018-09-14 21:21:42 +0000121; CHECK-LABEL: and_v16i8:
Thomas Livelyec71e012018-08-28 18:33:31 +0000122; NO-SIMD128-NOT: v128
Thomas Livelya3937b22018-09-14 21:21:42 +0000123; SIMD128-NEXT: .param v128, v128{{$}}
124; SIMD128-NEXT: .result v128{{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000125; SIMD128-NEXT: v128.and $push[[R:[0-9]+]]=, $0, $1{{$}}
126; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Livelyc1742572018-08-23 00:48:37 +0000127define <16 x i8> @and_v16i8(<16 x i8> %x, <16 x i8> %y) {
128 %a = and <16 x i8> %x, %y
129 ret <16 x i8> %a
130}
131
Thomas Livelya3937b22018-09-14 21:21:42 +0000132; CHECK-LABEL: or_v16i8:
Thomas Livelyec71e012018-08-28 18:33:31 +0000133; NO-SIMD128-NOT: v128
Thomas Livelya3937b22018-09-14 21:21:42 +0000134; SIMD128-NEXT: .param v128, v128{{$}}
135; SIMD128-NEXT: .result v128{{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000136; SIMD128-NEXT: v128.or $push[[R:[0-9]+]]=, $0, $1{{$}}
137; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Livelyc1742572018-08-23 00:48:37 +0000138define <16 x i8> @or_v16i8(<16 x i8> %x, <16 x i8> %y) {
139 %a = or <16 x i8> %x, %y
140 ret <16 x i8> %a
141}
142
Thomas Livelya3937b22018-09-14 21:21:42 +0000143; CHECK-LABEL: xor_v16i8:
Thomas Livelyec71e012018-08-28 18:33:31 +0000144; NO-SIMD128-NOT: v128
Thomas Livelya3937b22018-09-14 21:21:42 +0000145; SIMD128-NEXT: .param v128, v128{{$}}
146; SIMD128-NEXT: .result v128{{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000147; SIMD128-NEXT: v128.xor $push[[R:[0-9]+]]=, $0, $1{{$}}
148; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Livelyc1742572018-08-23 00:48:37 +0000149define <16 x i8> @xor_v16i8(<16 x i8> %x, <16 x i8> %y) {
150 %a = xor <16 x i8> %x, %y
151 ret <16 x i8> %a
152}
153
Thomas Livelya3937b22018-09-14 21:21:42 +0000154; CHECK-LABEL: not_v16i8:
Thomas Lively995ad612018-08-28 18:31:15 +0000155; NO-SIMD128-NOT: v128
Thomas Livelya3937b22018-09-14 21:21:42 +0000156; SIMD128-NEXT: .param v128{{$}}
157; SIMD128-NEXT: .result v128{{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000158; SIMD128-NEXT: v128.not $push[[R:[0-9]+]]=, $0{{$}}
159; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Lively995ad612018-08-28 18:31:15 +0000160define <16 x i8> @not_v16i8(<16 x i8> %x) {
161 %a = xor <16 x i8> %x, <i8 -1, i8 -1, i8 -1, i8 -1,
162 i8 -1, i8 -1, i8 -1, i8 -1,
163 i8 -1, i8 -1, i8 -1, i8 -1,
164 i8 -1, i8 -1, i8 -1, i8 -1>
165 ret <16 x i8> %a
166}
167
Derek Schuff39bf39f2016-08-02 23:16:09 +0000168; ==============================================================================
169; 8 x i16
170; ==============================================================================
Thomas Livelya3937b22018-09-14 21:21:42 +0000171; CHECK-LABEL: add_v8i16:
Derek Schuff39bf39f2016-08-02 23:16:09 +0000172; NO-SIMD128-NOT: i16x8
Thomas Livelya3937b22018-09-14 21:21:42 +0000173; SIMD128-NEXT: .param v128, v128{{$}}
174; SIMD128-NEXT: .result v128{{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000175; SIMD128-NEXT: i16x8.add $push[[R:[0-9]+]]=, $0, $1{{$}}
176; SIMD128-NEXT: return $pop[[R]]{{$}}
Derek Schuff39bf39f2016-08-02 23:16:09 +0000177define <8 x i16> @add_v8i16(<8 x i16> %x, <8 x i16> %y) {
178 %a = add <8 x i16> %x, %y
179 ret <8 x i16> %a
180}
181
Thomas Livelya3937b22018-09-14 21:21:42 +0000182; CHECK-LABEL: sub_v8i16:
Derek Schuff39bf39f2016-08-02 23:16:09 +0000183; NO-SIMD128-NOT: i16x8
Thomas Livelya3937b22018-09-14 21:21:42 +0000184; SIMD128-NEXT: .param v128, v128{{$}}
185; SIMD128-NEXT: .result v128{{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000186; SIMD128-NEXT: i16x8.sub $push[[R:[0-9]+]]=, $0, $1{{$}}
187; SIMD128-NEXT: return $pop[[R]]{{$}}
Derek Schuff39bf39f2016-08-02 23:16:09 +0000188define <8 x i16> @sub_v8i16(<8 x i16> %x, <8 x i16> %y) {
189 %a = sub <8 x i16> %x, %y
190 ret <8 x i16> %a
191}
192
Thomas Livelya3937b22018-09-14 21:21:42 +0000193; CHECK-LABEL: mul_v8i16:
Derek Schuff39bf39f2016-08-02 23:16:09 +0000194; NO-SIMD128-NOT: i16x8
Thomas Livelya3937b22018-09-14 21:21:42 +0000195; SIMD128-NEXT: .param v128, v128{{$}}
196; SIMD128-NEXT: .result v128{{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000197; SIMD128-NEXT: i16x8.mul $push[[R:[0-9]+]]=, $0, $1{{$}}
198; SIMD128-NEXT: return $pop[[R]]{{$}}
Derek Schuff39bf39f2016-08-02 23:16:09 +0000199define <8 x i16> @mul_v8i16(<8 x i16> %x, <8 x i16> %y) {
200 %a = mul <8 x i16> %x, %y
201 ret <8 x i16> %a
202}
203
Thomas Lively88b74432018-09-14 22:35:12 +0000204; CHECK-LABEL: neg_v8i16:
205; NO-SIMD128-NOT: i16x8
206; SIMD128-NEXT: .param v128{{$}}
207; SIMD128-NEXT: .result v128{{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000208; SIMD128-NEXT: i16x8.neg $push[[R:[0-9]+]]=, $0{{$}}
209; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Lively88b74432018-09-14 22:35:12 +0000210define <8 x i16> @neg_v8i16(<8 x i16> %x) {
211 %a = sub <8 x i16> <i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0>,
212 %x
213 ret <8 x i16> %a
214}
215
Thomas Livelyf2550e02018-09-15 00:45:31 +0000216; CHECK-LABEL: shl_v8i16:
217; NO-SIMD128-NOT: i16x8
218; SIMD128-NEXT: .param v128, i32{{$}}
219; SIMD128-NEXT: .result v128{{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000220; SIMD128-NEXT: i16x8.shl $push[[R:[0-9]+]]=, $0, $1{{$}}
221; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Livelyf2550e02018-09-15 00:45:31 +0000222define <8 x i16> @shl_v8i16(<8 x i16> %v, i16 %x) {
223 %t = insertelement <8 x i16> undef, i16 %x, i32 0
224 %s = shufflevector <8 x i16> %t, <8 x i16> undef,
225 <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
226 %a = shl <8 x i16> %v, %s
227 ret <8 x i16> %a
228}
229
230; CHECK-LABEL: shl_const_v8i16:
231; NO-SIMD128-NOT: i16x8
232; SIMD128-NEXT: .param v128{{$}}
233; SIMD128-NEXT: .result v128{{$}}
234; SIMD128-NEXT: i32.const $push[[L0:[0-9]+]]=, 5
235; SIMD128-NEXT: i16x8.shl $push[[R:[0-9]+]]=, $0, $pop[[L0]]{{$}}
236; SIMD128-NEXT: return $pop[[R]]{{$}}
237define <8 x i16> @shl_const_v8i16(<8 x i16> %v) {
238 %a = shl <8 x i16> %v,
239 <i16 5, i16 5, i16 5, i16 5, i16 5, i16 5, i16 5, i16 5>
240 ret <8 x i16> %a
241}
242
243; CHECK-LABEL: shr_s_v8i16:
244; NO-SIMD128-NOT: i16x8
245; SIMD128-NEXT: .param v128, i32{{$}}
246; SIMD128-NEXT: .result v128{{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000247; SIMD128-NEXT: i16x8.shr_s $push[[R:[0-9]+]]=, $0, $1{{$}}
248; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Livelyf2550e02018-09-15 00:45:31 +0000249define <8 x i16> @shr_s_v8i16(<8 x i16> %v, i16 %x) {
250 %t = insertelement <8 x i16> undef, i16 %x, i32 0
251 %s = shufflevector <8 x i16> %t, <8 x i16> undef,
252 <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
253 %a = ashr <8 x i16> %v, %s
254 ret <8 x i16> %a
255}
256
257; CHECK-LABEL: shr_u_v8i16:
258; NO-SIMD128-NOT: i16x8
259; SIMD128-NEXT: .param v128, i32{{$}}
260; SIMD128-NEXT: .result v128{{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000261; SIMD128-NEXT: i16x8.shr_u $push[[R:[0-9]+]]=, $0, $1{{$}}
262; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Livelyf2550e02018-09-15 00:45:31 +0000263define <8 x i16> @shr_u_v8i16(<8 x i16> %v, i16 %x) {
264 %t = insertelement <8 x i16> undef, i16 %x, i32 0
265 %s = shufflevector <8 x i16> %t, <8 x i16> undef,
266 <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
267 %a = lshr <8 x i16> %v, %s
268 ret <8 x i16> %a
269}
270
Thomas Livelya3937b22018-09-14 21:21:42 +0000271; CHECK-LABEL: and_v8i16:
Thomas Livelyec71e012018-08-28 18:33:31 +0000272; NO-SIMD128-NOT: v128
Thomas Livelya3937b22018-09-14 21:21:42 +0000273; SIMD128-NEXT: .param v128, v128{{$}}
274; SIMD128-NEXT: .result v128{{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000275; SIMD128-NEXT: v128.and $push[[R:[0-9]+]]=, $0, $1{{$}}
276; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Livelyc1742572018-08-23 00:48:37 +0000277define <8 x i16> @and_v8i16(<8 x i16> %x, <8 x i16> %y) {
278 %a = and <8 x i16> %x, %y
279 ret <8 x i16> %a
280}
281
Thomas Livelya3937b22018-09-14 21:21:42 +0000282; CHECK-LABEL: or_v8i16:
Thomas Livelyec71e012018-08-28 18:33:31 +0000283; NO-SIMD128-NOT: v128
Thomas Livelya3937b22018-09-14 21:21:42 +0000284; SIMD128-NEXT: .param v128, v128{{$}}
285; SIMD128-NEXT: .result v128{{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000286; SIMD128-NEXT: v128.or $push[[R:[0-9]+]]=, $0, $1{{$}}
287; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Livelyc1742572018-08-23 00:48:37 +0000288define <8 x i16> @or_v8i16(<8 x i16> %x, <8 x i16> %y) {
289 %a = or <8 x i16> %x, %y
290 ret <8 x i16> %a
291}
292
Thomas Livelya3937b22018-09-14 21:21:42 +0000293; CHECK-LABEL: xor_v8i16:
Thomas Livelyec71e012018-08-28 18:33:31 +0000294; NO-SIMD128-NOT: v128
Thomas Livelya3937b22018-09-14 21:21:42 +0000295; SIMD128-NEXT: .param v128, v128{{$}}
296; SIMD128-NEXT: .result v128{{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000297; SIMD128-NEXT: v128.xor $push[[R:[0-9]+]]=, $0, $1{{$}}
298; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Livelyc1742572018-08-23 00:48:37 +0000299define <8 x i16> @xor_v8i16(<8 x i16> %x, <8 x i16> %y) {
300 %a = xor <8 x i16> %x, %y
301 ret <8 x i16> %a
302}
303
Thomas Livelya3937b22018-09-14 21:21:42 +0000304; CHECK-LABEL: not_v8i16:
Thomas Lively995ad612018-08-28 18:31:15 +0000305; NO-SIMD128-NOT: v128
Thomas Livelya3937b22018-09-14 21:21:42 +0000306; SIMD128-NEXT: .param v128{{$}}
307; SIMD128-NEXT: .result v128{{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000308; SIMD128-NEXT: v128.not $push[[R:[0-9]+]]=, $0{{$}}
309; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Lively995ad612018-08-28 18:31:15 +0000310define <8 x i16> @not_v8i16(<8 x i16> %x) {
311 %a = xor <8 x i16> %x, <i16 -1, i16 -1, i16 -1, i16 -1,
312 i16 -1, i16 -1, i16 -1, i16 -1>
313 ret <8 x i16> %a
314}
315
Derek Schuff39bf39f2016-08-02 23:16:09 +0000316; ==============================================================================
317; 4 x i32
318; ==============================================================================
Thomas Livelya3937b22018-09-14 21:21:42 +0000319; CHECK-LABEL: add_v4i32:
Derek Schuff39bf39f2016-08-02 23:16:09 +0000320; NO-SIMD128-NOT: i32x4
Thomas Livelya3937b22018-09-14 21:21:42 +0000321; SIMD128-NEXT: .param v128, v128{{$}}
322; SIMD128-NEXT: .result v128{{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000323; SIMD128-NEXT: i32x4.add $push[[R:[0-9]+]]=, $0, $1{{$}}
324; SIMD128-NEXT: return $pop[[R]]{{$}}
Derek Schuff39bf39f2016-08-02 23:16:09 +0000325define <4 x i32> @add_v4i32(<4 x i32> %x, <4 x i32> %y) {
326 %a = add <4 x i32> %x, %y
327 ret <4 x i32> %a
328}
329
Thomas Livelya3937b22018-09-14 21:21:42 +0000330; CHECK-LABEL: sub_v4i32:
Derek Schuff39bf39f2016-08-02 23:16:09 +0000331; NO-SIMD128-NOT: i32x4
Thomas Livelya3937b22018-09-14 21:21:42 +0000332; SIMD128-NEXT: .param v128, v128{{$}}
333; SIMD128-NEXT: .result v128{{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000334; SIMD128-NEXT: i32x4.sub $push[[R:[0-9]+]]=, $0, $1{{$}}
335; SIMD128-NEXT: return $pop[[R]]{{$}}
Derek Schuff39bf39f2016-08-02 23:16:09 +0000336define <4 x i32> @sub_v4i32(<4 x i32> %x, <4 x i32> %y) {
337 %a = sub <4 x i32> %x, %y
338 ret <4 x i32> %a
339}
340
Thomas Livelya3937b22018-09-14 21:21:42 +0000341; CHECK-LABEL: mul_v4i32:
Derek Schuff39bf39f2016-08-02 23:16:09 +0000342; NO-SIMD128-NOT: i32x4
Thomas Livelya3937b22018-09-14 21:21:42 +0000343; SIMD128-NEXT: .param v128, v128{{$}}
344; SIMD128-NEXT: .result v128{{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000345; SIMD128-NEXT: i32x4.mul $push[[R:[0-9]+]]=, $0, $1{{$}}
346; SIMD128-NEXT: return $pop[[R]]{{$}}
Derek Schuff39bf39f2016-08-02 23:16:09 +0000347define <4 x i32> @mul_v4i32(<4 x i32> %x, <4 x i32> %y) {
348 %a = mul <4 x i32> %x, %y
349 ret <4 x i32> %a
350}
351
Thomas Lively88b74432018-09-14 22:35:12 +0000352; CHECK-LABEL: neg_v4i32:
353; NO-SIMD128-NOT: i32x4
354; SIMD128-NEXT: .param v128{{$}}
355; SIMD128-NEXT: .result v128{{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000356; SIMD128-NEXT: i32x4.neg $push[[R:[0-9]+]]=, $0{{$}}
357; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Lively88b74432018-09-14 22:35:12 +0000358define <4 x i32> @neg_v4i32(<4 x i32> %x) {
359 %a = sub <4 x i32> <i32 0, i32 0, i32 0, i32 0>, %x
360 ret <4 x i32> %a
361}
362
Thomas Livelyf2550e02018-09-15 00:45:31 +0000363; CHECK-LABEL: shl_v4i32:
364; NO-SIMD128-NOT: i32x4
365; SIMD128-NEXT: .param v128, i32{{$}}
366; SIMD128-NEXT: .result v128{{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000367; SIMD128-NEXT: i32x4.shl $push[[R:[0-9]+]]=, $0, $1{{$}}
368; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Livelyf2550e02018-09-15 00:45:31 +0000369define <4 x i32> @shl_v4i32(<4 x i32> %v, i32 %x) {
370 %t = insertelement <4 x i32> undef, i32 %x, i32 0
371 %s = shufflevector <4 x i32> %t, <4 x i32> undef,
372 <4 x i32> <i32 0, i32 0, i32 0, i32 0>
373 %a = shl <4 x i32> %v, %s
374 ret <4 x i32> %a
375}
376
377; CHECK-LABEL: shl_const_v4i32:
378; NO-SIMD128-NOT: i32x4
379; SIMD128-NEXT: .param v128{{$}}
380; SIMD128-NEXT: .result v128{{$}}
381; SIMD128-NEXT: i32.const $push[[L0:[0-9]+]]=, 5
382; SIMD128-NEXT: i32x4.shl $push[[R:[0-9]+]]=, $0, $pop[[L0]]{{$}}
383; SIMD128-NEXT: return $pop[[R]]{{$}}
384define <4 x i32> @shl_const_v4i32(<4 x i32> %v) {
385 %a = shl <4 x i32> %v, <i32 5, i32 5, i32 5, i32 5>
386 ret <4 x i32> %a
387}
388
389; CHECK-LABEL: shr_s_v4i32:
390; NO-SIMD128-NOT: i32x4
391; SIMD128-NEXT: .param v128, i32{{$}}
392; SIMD128-NEXT: .result v128{{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000393; SIMD128-NEXT: i32x4.shr_s $push[[R:[0-9]+]]=, $0, $1{{$}}
394; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Livelyf2550e02018-09-15 00:45:31 +0000395define <4 x i32> @shr_s_v4i32(<4 x i32> %v, i32 %x) {
396 %t = insertelement <4 x i32> undef, i32 %x, i32 0
397 %s = shufflevector <4 x i32> %t, <4 x i32> undef,
398 <4 x i32> <i32 0, i32 0, i32 0, i32 0>
399 %a = ashr <4 x i32> %v, %s
400 ret <4 x i32> %a
401}
402
403; CHECK-LABEL: shr_u_v4i32:
404; NO-SIMD128-NOT: i32x4
405; SIMD128-NEXT: .param v128, i32{{$}}
406; SIMD128-NEXT: .result v128{{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000407; SIMD128-NEXT: i32x4.shr_u $push[[R:[0-9]+]]=, $0, $1{{$}}
408; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Livelyf2550e02018-09-15 00:45:31 +0000409define <4 x i32> @shr_u_v4i32(<4 x i32> %v, i32 %x) {
410 %t = insertelement <4 x i32> undef, i32 %x, i32 0
411 %s = shufflevector <4 x i32> %t, <4 x i32> undef,
412 <4 x i32> <i32 0, i32 0, i32 0, i32 0>
413 %a = lshr <4 x i32> %v, %s
414 ret <4 x i32> %a
415}
416
Thomas Livelya3937b22018-09-14 21:21:42 +0000417; CHECK-LABEL: and_v4i32:
Thomas Livelyec71e012018-08-28 18:33:31 +0000418; NO-SIMD128-NOT: v128
Thomas Livelya3937b22018-09-14 21:21:42 +0000419; SIMD128-NEXT: .param v128, v128{{$}}
420; SIMD128-NEXT: .result v128{{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000421; SIMD128-NEXT: v128.and $push[[R:[0-9]+]]=, $0, $1{{$}}
422; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Livelyc1742572018-08-23 00:48:37 +0000423define <4 x i32> @and_v4i32(<4 x i32> %x, <4 x i32> %y) {
424 %a = and <4 x i32> %x, %y
425 ret <4 x i32> %a
426}
427
Thomas Livelya3937b22018-09-14 21:21:42 +0000428; CHECK-LABEL: or_v4i32:
Thomas Livelyec71e012018-08-28 18:33:31 +0000429; NO-SIMD128-NOT: v128
Thomas Livelya3937b22018-09-14 21:21:42 +0000430; SIMD128-NEXT: .param v128, v128{{$}}
431; SIMD128-NEXT: .result v128{{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000432; SIMD128-NEXT: v128.or $push[[R:[0-9]+]]=, $0, $1{{$}}
433; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Livelyc1742572018-08-23 00:48:37 +0000434define <4 x i32> @or_v4i32(<4 x i32> %x, <4 x i32> %y) {
435 %a = or <4 x i32> %x, %y
436 ret <4 x i32> %a
437}
438
Thomas Livelya3937b22018-09-14 21:21:42 +0000439; CHECK-LABEL: xor_v4i32:
Thomas Livelyec71e012018-08-28 18:33:31 +0000440; NO-SIMD128-NOT: v128
Thomas Livelya3937b22018-09-14 21:21:42 +0000441; SIMD128-NEXT: .param v128, v128{{$}}
442; SIMD128-NEXT: .result v128{{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000443; SIMD128-NEXT: v128.xor $push[[R:[0-9]+]]=, $0, $1{{$}}
444; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Livelyc1742572018-08-23 00:48:37 +0000445define <4 x i32> @xor_v4i32(<4 x i32> %x, <4 x i32> %y) {
446 %a = xor <4 x i32> %x, %y
447 ret <4 x i32> %a
448}
449
Thomas Livelya3937b22018-09-14 21:21:42 +0000450; CHECK-LABEL: not_v4i32:
Thomas Lively995ad612018-08-28 18:31:15 +0000451; NO-SIMD128-NOT: v128
Thomas Livelya3937b22018-09-14 21:21:42 +0000452; SIMD128-NEXT: .param v128{{$}}
453; SIMD128-NEXT: .result v128{{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000454; SIMD128-NEXT: v128.not $push[[R:[0-9]+]]=, $0{{$}}
455; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Lively995ad612018-08-28 18:31:15 +0000456define <4 x i32> @not_v4i32(<4 x i32> %x) {
457 %a = xor <4 x i32> %x, <i32 -1, i32 -1, i32 -1, i32 -1>
458 ret <4 x i32> %a
459}
460
Derek Schuff39bf39f2016-08-02 23:16:09 +0000461; ==============================================================================
Derek Schuff51ed1312018-08-07 21:24:01 +0000462; 2 x i64
463; ==============================================================================
Thomas Livelya3937b22018-09-14 21:21:42 +0000464; CHECK-LABEL: add_v2i64:
Derek Schuff51ed1312018-08-07 21:24:01 +0000465; NO-SIMD128-NOT: i64x2
Heejin Ahn5831e9c2018-08-09 23:58:51 +0000466; SIMD128-VM-NOT: i64x2
Thomas Livelya3937b22018-09-14 21:21:42 +0000467; SIMD128-NEXT: .param v128, v128{{$}}
468; SIMD128-NEXT: .result v128{{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000469; SIMD128-NEXT: i64x2.add $push[[R:[0-9]+]]=, $0, $1{{$}}
470; SIMD128-NEXT: return $pop[[R]]{{$}}
Derek Schuff51ed1312018-08-07 21:24:01 +0000471define <2 x i64> @add_v2i64(<2 x i64> %x, <2 x i64> %y) {
472 %a = add <2 x i64> %x, %y
473 ret <2 x i64> %a
474}
475
Thomas Livelya3937b22018-09-14 21:21:42 +0000476; CHECK-LABEL: sub_v2i64:
Derek Schuff51ed1312018-08-07 21:24:01 +0000477; NO-SIMD128-NOT: i64x2
Heejin Ahn5831e9c2018-08-09 23:58:51 +0000478; SIMD128-VM-NOT: i64x2
Thomas Livelya3937b22018-09-14 21:21:42 +0000479; SIMD128-NEXT: .param v128, v128{{$}}
480; SIMD128-NEXT: .result v128{{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000481; SIMD128-NEXT: i64x2.sub $push[[R:[0-9]+]]=, $0, $1{{$}}
482; SIMD128-NEXT: return $pop[[R]]{{$}}
Derek Schuff51ed1312018-08-07 21:24:01 +0000483define <2 x i64> @sub_v2i64(<2 x i64> %x, <2 x i64> %y) {
484 %a = sub <2 x i64> %x, %y
485 ret <2 x i64> %a
486}
487
Thomas Lively2ee686d2018-08-22 23:06:27 +0000488; v2i64.mul is not in spec
Thomas Livelya3937b22018-09-14 21:21:42 +0000489; CHECK-LABEL: mul_v2i64:
Derek Schuff51ed1312018-08-07 21:24:01 +0000490; NO-SIMD128-NOT: i64x2
Heejin Ahn5831e9c2018-08-09 23:58:51 +0000491; SIMD128-VM-NOT: i64x2
Thomas Lively2ee686d2018-08-22 23:06:27 +0000492; SIMD128-NOT: i64x2.mul
493; SIMD128: i64x2.extract_lane
494; SIMD128: i64.mul
Derek Schuff51ed1312018-08-07 21:24:01 +0000495define <2 x i64> @mul_v2i64(<2 x i64> %x, <2 x i64> %y) {
496 %a = mul <2 x i64> %x, %y
497 ret <2 x i64> %a
498}
499
Thomas Lively88b74432018-09-14 22:35:12 +0000500; CHECK-LABEL: neg_v2i64:
501; NO-SIMD128-NOT: i64x2
502; SIMD128-NEXT: .param v128{{$}}
503; SIMD128-NEXT: .result v128{{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000504; SIMD128-NEXT: i64x2.neg $push[[R:[0-9]+]]=, $0{{$}}
505; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Lively88b74432018-09-14 22:35:12 +0000506define <2 x i64> @neg_v2i64(<2 x i64> %x) {
507 %a = sub <2 x i64> <i64 0, i64 0>, %x
508 ret <2 x i64> %a
509}
510
Thomas Livelyf2550e02018-09-15 00:45:31 +0000511; CHECK-LABEL: shl_v2i64:
512; NO-SIMD128-NOT: i64x2
513; SIMD128-NEXT: .param v128, i32{{$}}
514; SIMD128-NEXT: .result v128{{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000515; SIMD128-NEXT: i64x2.shl $push[[R:[0-9]+]]=, $0, $1{{$}}
516; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Livelyf2550e02018-09-15 00:45:31 +0000517define <2 x i64> @shl_v2i64(<2 x i64> %v, i32 %x) {
518 %x2 = zext i32 %x to i64
519 %t = insertelement <2 x i64> undef, i64 %x2, i32 0
520 %s = shufflevector <2 x i64> %t, <2 x i64> undef, <2 x i32> <i32 0, i32 0>
521 %a = shl <2 x i64> %v, %s
522 ret <2 x i64> %a
523}
524
525; CHECK-LABEL: shl_nozext_v2i64:
526; NO-SIMD128-NOT: i64x2
527; SIMD128-NEXT: .param v128, i64{{$}}
528; SIMD128-NEXT: .result v128{{$}}
529; SIMD128-NEXT: i32.wrap/i64 $push[[L0:[0-9]+]]=, $1{{$}}
530; SIMD128-NEXT: i64x2.shl $push[[R:[0-9]+]]=, $0, $pop[[L0]]{{$}}
531; SIMD128-NEXT: return $pop[[R]]{{$}}
532define <2 x i64> @shl_nozext_v2i64(<2 x i64> %v, i64 %x) {
533 %t = insertelement <2 x i64> undef, i64 %x, i32 0
534 %s = shufflevector <2 x i64> %t, <2 x i64> undef, <2 x i32> <i32 0, i32 0>
535 %a = shl <2 x i64> %v, %s
536 ret <2 x i64> %a
537}
538
539; CHECK-LABEL: shl_const_v2i64:
540; NO-SIMD128-NOT: i64x2
541; SIMD128-NEXT: .param v128{{$}}
542; SIMD128-NEXT: .result v128{{$}}
543; SIMD128-NEXT: i64.const $push[[L0:[0-9]+]]=, 5{{$}}
544; SIMD128-NEXT: i32.wrap/i64 $push[[L1:[0-9]+]]=, $pop[[L0]]{{$}}
545; SIMD128-NEXT: i64x2.shl $push[[R:[0-9]+]]=, $0, $pop[[L1]]{{$}}
546; SIMD128-NEXT: return $pop[[R]]{{$}}
547define <2 x i64> @shl_const_v2i64(<2 x i64> %v) {
548 %a = shl <2 x i64> %v, <i64 5, i64 5>
549 ret <2 x i64> %a
550}
551
552; CHECK-LABEL: shr_s_v2i64:
553; NO-SIMD128-NOT: i64x2
554; SIMD128-NEXT: .param v128, i32{{$}}
555; SIMD128-NEXT: .result v128{{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000556; SIMD128-NEXT: i64x2.shr_s $push[[R:[0-9]+]]=, $0, $1{{$}}
557; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Livelyf2550e02018-09-15 00:45:31 +0000558define <2 x i64> @shr_s_v2i64(<2 x i64> %v, i32 %x) {
559 %x2 = zext i32 %x to i64
560 %t = insertelement <2 x i64> undef, i64 %x2, i32 0
561 %s = shufflevector <2 x i64> %t, <2 x i64> undef, <2 x i32> <i32 0, i32 0>
562 %a = ashr <2 x i64> %v, %s
563 ret <2 x i64> %a
564}
565
566; CHECK-LABEL: shr_s_nozext_v2i64:
567; NO-SIMD128-NOT: i64x2
568; SIMD128-NEXT: .param v128, i64{{$}}
569; SIMD128-NEXT: .result v128{{$}}
570; SIMD128-NEXT: i32.wrap/i64 $push[[L0:[0-9]+]]=, $1{{$}}
571; SIMD128-NEXT: i64x2.shr_s $push[[R:[0-9]+]]=, $0, $pop[[L0]]{{$}}
572; SIMD128-NEXT: return $pop[[R]]{{$}}
573define <2 x i64> @shr_s_nozext_v2i64(<2 x i64> %v, i64 %x) {
574 %t = insertelement <2 x i64> undef, i64 %x, i32 0
575 %s = shufflevector <2 x i64> %t, <2 x i64> undef, <2 x i32> <i32 0, i32 0>
576 %a = ashr <2 x i64> %v, %s
577 ret <2 x i64> %a
578}
579
580; CHECK-LABEL: shr_u_v2i64:
581; NO-SIMD128-NOT: i64x2
582; SIMD128-NEXT: .param v128, i32{{$}}
583; SIMD128-NEXT: .result v128{{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000584; SIMD128-NEXT: i64x2.shr_u $push[[R:[0-9]+]]=, $0, $1{{$}}
585; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Livelyf2550e02018-09-15 00:45:31 +0000586define <2 x i64> @shr_u_v2i64(<2 x i64> %v, i32 %x) {
587 %x2 = zext i32 %x to i64
588 %t = insertelement <2 x i64> undef, i64 %x2, i32 0
589 %s = shufflevector <2 x i64> %t, <2 x i64> undef, <2 x i32> <i32 0, i32 0>
590 %a = lshr <2 x i64> %v, %s
591 ret <2 x i64> %a
592}
593
594; CHECK-LABEL: shr_u_nozext_v2i64:
595; NO-SIMD128-NOT: i64x2
596; SIMD128-NEXT: .param v128, i64{{$}}
597; SIMD128-NEXT: .result v128{{$}}
598; SIMD128-NEXT: i32.wrap/i64 $push[[L0:[0-9]+]]=, $1{{$}}
599; SIMD128-NEXT: i64x2.shr_u $push[[R:[0-9]+]]=, $0, $pop[[L0]]{{$}}
600; SIMD128-NEXT: return $pop[[R]]{{$}}
601define <2 x i64> @shr_u_nozext_v2i64(<2 x i64> %v, i64 %x) {
602 %t = insertelement <2 x i64> undef, i64 %x, i32 0
603 %s = shufflevector <2 x i64> %t, <2 x i64> undef, <2 x i32> <i32 0, i32 0>
604 %a = lshr <2 x i64> %v, %s
605 ret <2 x i64> %a
606}
607
Thomas Livelya3937b22018-09-14 21:21:42 +0000608; CHECK-LABEL: and_v2i64:
Thomas Livelyec71e012018-08-28 18:33:31 +0000609; NO-SIMD128-NOT: v128
610; SIMD128-VM-NOT: v128
Thomas Livelya3937b22018-09-14 21:21:42 +0000611; SIMD128-NEXT: .param v128, v128{{$}}
612; SIMD128-NEXT: .result v128{{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000613; SIMD128-NEXT: v128.and $push[[R:[0-9]+]]=, $0, $1{{$}}
614; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Livelyc1742572018-08-23 00:48:37 +0000615define <2 x i64> @and_v2i64(<2 x i64> %x, <2 x i64> %y) {
616 %a = and <2 x i64> %x, %y
617 ret <2 x i64> %a
618}
619
Thomas Livelya3937b22018-09-14 21:21:42 +0000620; CHECK-LABEL: or_v2i64:
Thomas Livelyec71e012018-08-28 18:33:31 +0000621; NO-SIMD128-NOT: v128
622; SIMD128-VM-NOT: v128
Thomas Livelya3937b22018-09-14 21:21:42 +0000623; SIMD128-NEXT: .param v128, v128{{$}}
624; SIMD128-NEXT: .result v128{{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000625; SIMD128-NEXT: v128.or $push[[R:[0-9]+]]=, $0, $1{{$}}
626; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Livelyc1742572018-08-23 00:48:37 +0000627define <2 x i64> @or_v2i64(<2 x i64> %x, <2 x i64> %y) {
628 %a = or <2 x i64> %x, %y
629 ret <2 x i64> %a
630}
631
Thomas Livelya3937b22018-09-14 21:21:42 +0000632; CHECK-LABEL: xor_v2i64:
Thomas Livelyec71e012018-08-28 18:33:31 +0000633; NO-SIMD128-NOT: v128
634; SIMD128-VM-NOT: v128
Thomas Livelya3937b22018-09-14 21:21:42 +0000635; SIMD128-NEXT: .param v128, v128{{$}}
636; SIMD128-NEXT: .result v128{{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000637; SIMD128-NEXT: v128.xor $push[[R:[0-9]+]]=, $0, $1{{$}}
638; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Livelyc1742572018-08-23 00:48:37 +0000639define <2 x i64> @xor_v2i64(<2 x i64> %x, <2 x i64> %y) {
640 %a = xor <2 x i64> %x, %y
641 ret <2 x i64> %a
642}
643
Thomas Livelya3937b22018-09-14 21:21:42 +0000644; CHECK-LABEL: not_v2i64:
Thomas Lively995ad612018-08-28 18:31:15 +0000645; NO-SIMD128-NOT: v128
646; SIMD128-VM-NOT: v128
Thomas Livelya3937b22018-09-14 21:21:42 +0000647; SIMD128-NEXT: .param v128{{$}}
648; SIMD128-NEXT: .result v128{{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000649; SIMD128-NEXT: v128.not $push[[R:[0-9]+]]=, $0{{$}}
650; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Lively995ad612018-08-28 18:31:15 +0000651define <2 x i64> @not_v2i64(<2 x i64> %x) {
652 %a = xor <2 x i64> %x, <i64 -1, i64 -1>
653 ret <2 x i64> %a
654}
655
Derek Schuff51ed1312018-08-07 21:24:01 +0000656; ==============================================================================
Derek Schuff39bf39f2016-08-02 23:16:09 +0000657; 4 x float
658; ==============================================================================
Thomas Lively88b74432018-09-14 22:35:12 +0000659; CHECK-LABEL: neg_v4f32:
660; NO-SIMD128-NOT: f32x4
661; SIMD128-NEXT: .param v128{{$}}
662; SIMD128-NEXT: .result v128{{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000663; SIMD128-NEXT: f32x4.neg $push[[R:[0-9]+]]=, $0{{$}}
664; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Lively88b74432018-09-14 22:35:12 +0000665define <4 x float> @neg_v4f32(<4 x float> %x) {
666 %a = fsub <4 x float> <float 0., float 0., float 0., float 0.>, %x
667 ret <4 x float> %a
668}
669
Thomas Livelya3937b22018-09-14 21:21:42 +0000670; CHECK-LABEL: add_v4f32:
Derek Schuff39bf39f2016-08-02 23:16:09 +0000671; NO-SIMD128-NOT: f32x4
Thomas Livelya3937b22018-09-14 21:21:42 +0000672; SIMD128-NEXT: .param v128, v128{{$}}
673; SIMD128-NEXT: .result v128{{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000674; SIMD128-NEXT: f32x4.add $push[[R:[0-9]+]]=, $0, $1{{$}}
675; SIMD128-NEXT: return $pop[[R]]{{$}}
Derek Schuff39bf39f2016-08-02 23:16:09 +0000676define <4 x float> @add_v4f32(<4 x float> %x, <4 x float> %y) {
677 %a = fadd <4 x float> %x, %y
678 ret <4 x float> %a
679}
680
Thomas Livelya3937b22018-09-14 21:21:42 +0000681; CHECK-LABEL: sub_v4f32:
Derek Schuff39bf39f2016-08-02 23:16:09 +0000682; NO-SIMD128-NOT: f32x4
Thomas Livelya3937b22018-09-14 21:21:42 +0000683; SIMD128-NEXT: .param v128, v128{{$}}
684; SIMD128-NEXT: .result v128{{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000685; SIMD128-NEXT: f32x4.sub $push[[R:[0-9]+]]=, $0, $1{{$}}
686; SIMD128-NEXT: return $pop[[R]]{{$}}
Derek Schuff39bf39f2016-08-02 23:16:09 +0000687define <4 x float> @sub_v4f32(<4 x float> %x, <4 x float> %y) {
688 %a = fsub <4 x float> %x, %y
689 ret <4 x float> %a
690}
691
Thomas Livelya3937b22018-09-14 21:21:42 +0000692; CHECK-LABEL: div_v4f32:
Derek Schuff51ed1312018-08-07 21:24:01 +0000693; NO-SIMD128-NOT: f32x4
Thomas Livelya3937b22018-09-14 21:21:42 +0000694; SIMD128-NEXT: .param v128, v128{{$}}
695; SIMD128-NEXT: .result v128{{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000696; SIMD128-NEXT: f32x4.div $push[[R:[0-9]+]]=, $0, $1{{$}}
697; SIMD128-NEXT: return $pop[[R]]{{$}}
Derek Schuff51ed1312018-08-07 21:24:01 +0000698define <4 x float> @div_v4f32(<4 x float> %x, <4 x float> %y) {
699 %a = fdiv <4 x float> %x, %y
700 ret <4 x float> %a
701}
702
Thomas Livelya3937b22018-09-14 21:21:42 +0000703; CHECK-LABEL: mul_v4f32:
Derek Schuff39bf39f2016-08-02 23:16:09 +0000704; NO-SIMD128-NOT: f32x4
Thomas Livelya3937b22018-09-14 21:21:42 +0000705; SIMD128-NEXT: .param v128, v128{{$}}
706; SIMD128-NEXT: .result v128{{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000707; SIMD128-NEXT: f32x4.mul $push[[R:[0-9]+]]=, $0, $1{{$}}
708; SIMD128-NEXT: return $pop[[R]]{{$}}
Derek Schuff39bf39f2016-08-02 23:16:09 +0000709define <4 x float> @mul_v4f32(<4 x float> %x, <4 x float> %y) {
710 %a = fmul <4 x float> %x, %y
711 ret <4 x float> %a
712}
713
Derek Schuff51ed1312018-08-07 21:24:01 +0000714; ==============================================================================
715; 2 x double
716; ==============================================================================
Thomas Lively88b74432018-09-14 22:35:12 +0000717; CHECK-LABEL: neg_v2f64:
718; NO-SIMD128-NOT: f64x2
719; SIMD128-NEXT: .param v128{{$}}
720; SIMD128-NEXT: .result v128{{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000721; SIMD128-NEXT: f64x2.neg $push[[R:[0-9]+]]=, $0{{$}}
722; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Lively88b74432018-09-14 22:35:12 +0000723define <2 x double> @neg_v2f64(<2 x double> %x) {
724 %a = fsub <2 x double> <double 0., double 0.>, %x
725 ret <2 x double> %a
726}
727
Thomas Livelya3937b22018-09-14 21:21:42 +0000728; CHECK-LABEL: add_v2f64:
Derek Schuff51ed1312018-08-07 21:24:01 +0000729; NO-SIMD128-NOT: f64x2
Thomas Livelya3937b22018-09-14 21:21:42 +0000730; SIMD128-VM-NOT: f62x2
731; SIMD128-NEXT: .param v128, v128{{$}}
732; SIMD128-NEXT: .result v128{{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000733; SIMD128-NEXT: f64x2.add $push[[R:[0-9]+]]=, $0, $1{{$}}
734; SIMD128-NEXT: return $pop[[R]]{{$}}
Derek Schuff51ed1312018-08-07 21:24:01 +0000735define <2 x double> @add_v2f64(<2 x double> %x, <2 x double> %y) {
736 %a = fadd <2 x double> %x, %y
737 ret <2 x double> %a
738}
739
Thomas Livelya3937b22018-09-14 21:21:42 +0000740; CHECK-LABEL: sub_v2f64:
Derek Schuff51ed1312018-08-07 21:24:01 +0000741; NO-SIMD128-NOT: f64x2
Thomas Livelya3937b22018-09-14 21:21:42 +0000742; SIMD128-VM-NOT: f62x2
743; SIMD128-NEXT: .param v128, v128{{$}}
744; SIMD128-NEXT: .result v128{{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000745; SIMD128-NEXT: f64x2.sub $push[[R:[0-9]+]]=, $0, $1{{$}}
746; SIMD128-NEXT: return $pop[[R]]{{$}}
Derek Schuff51ed1312018-08-07 21:24:01 +0000747define <2 x double> @sub_v2f64(<2 x double> %x, <2 x double> %y) {
748 %a = fsub <2 x double> %x, %y
749 ret <2 x double> %a
750}
751
Thomas Livelya3937b22018-09-14 21:21:42 +0000752; CHECK-LABEL: div_v2f64:
Derek Schuff51ed1312018-08-07 21:24:01 +0000753; NO-SIMD128-NOT: f64x2
Thomas Livelya3937b22018-09-14 21:21:42 +0000754; SIMD128-VM-NOT: f62x2
755; SIMD128-NEXT: .param v128, v128{{$}}
756; SIMD128-NEXT: .result v128{{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000757; SIMD128-NEXT: f64x2.div $push[[R:[0-9]+]]=, $0, $1{{$}}
758; SIMD128-NEXT: return $pop[[R]]{{$}}
Derek Schuff51ed1312018-08-07 21:24:01 +0000759define <2 x double> @div_v2f64(<2 x double> %x, <2 x double> %y) {
760 %a = fdiv <2 x double> %x, %y
761 ret <2 x double> %a
762}
763
Thomas Livelya3937b22018-09-14 21:21:42 +0000764; CHECK-LABEL: mul_v2f64:
Derek Schuff51ed1312018-08-07 21:24:01 +0000765; NO-SIMD128-NOT: f64x2
Thomas Livelya3937b22018-09-14 21:21:42 +0000766; SIMD128-VM-NOT: f62x2
767; SIMD128-NEXT: .param v128, v128{{$}}
768; SIMD128-NEXT: .result v128{{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000769; SIMD128-NEXT: f64x2.mul $push[[R:[0-9]+]]=, $0, $1{{$}}
770; SIMD128-NEXT: return $pop[[R]]{{$}}
Derek Schuff51ed1312018-08-07 21:24:01 +0000771define <2 x double> @mul_v2f64(<2 x double> %x, <2 x double> %y) {
772 %a = fmul <2 x double> %x, %y
773 ret <2 x double> %a
774}