blob: acbb1f9d5c483b71bcdcfd524ad9faed34011640 [file] [log] [blame]
Thomas Lively64a39a12019-01-10 22:32:11 +00001; RUN: llc < %s -asm-verbose=false -verify-machineinstrs -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -wasm-keep-registers -mattr=+unimplemented-simd128 | FileCheck %s --check-prefixes CHECK,SIMD128,SIMD128-SLOW
2; RUN: llc < %s -asm-verbose=false -verify-machineinstrs -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -wasm-keep-registers -mattr=+unimplemented-simd128 -fast-isel | FileCheck %s --check-prefixes CHECK,SIMD128,SIMD128-FAST
Thomas Livelyb6dac892018-12-21 06:58:15 +00003; RUN: llc < %s -asm-verbose=false -verify-machineinstrs -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 -verify-machineinstrs -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -wasm-keep-registers -mattr=+simd128 -fast-isel | FileCheck %s --check-prefixes CHECK,SIMD128-VM
Thomas Lively64a39a12019-01-10 22:32:11 +00005; 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
6; RUN: llc < %s -asm-verbose=false -verify-machineinstrs -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -wasm-keep-registers -fast-isel | FileCheck %s --check-prefixes CHECK,NO-SIMD128
Derek Schuff39bf39f2016-08-02 23:16:09 +00007
Thomas Lively409f5842018-10-09 23:33:16 +00008; check that a non-test run (including explicit locals pass) at least finishes
Thomas Lively64a39a12019-01-10 22:32:11 +00009; RUN: llc < %s -O0 -mattr=+unimplemented-simd128
10; RUN: llc < %s -O2 -mattr=+unimplemented-simd128
Thomas Lively409f5842018-10-09 23:33:16 +000011
Derek Schuff39bf39f2016-08-02 23:16:09 +000012; Test that basic SIMD128 arithmetic operations assemble as expected.
13
14target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
Sam Clegga5908002018-05-10 17:49:11 +000015target triple = "wasm32-unknown-unknown"
Derek Schuff39bf39f2016-08-02 23:16:09 +000016
Derek Schuff39bf39f2016-08-02 23:16:09 +000017; ==============================================================================
18; 16 x i8
19; ==============================================================================
Thomas Livelya3937b22018-09-14 21:21:42 +000020; CHECK-LABEL: add_v16i8:
Derek Schuff39bf39f2016-08-02 23:16:09 +000021; NO-SIMD128-NOT: i8x16
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +000022; SIMD128-NEXT: .functype add_v16i8 (v128, v128) -> (v128){{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +000023; SIMD128-NEXT: i8x16.add $push[[R:[0-9]+]]=, $0, $1{{$}}
24; SIMD128-NEXT: return $pop[[R]]{{$}}
Derek Schuff39bf39f2016-08-02 23:16:09 +000025define <16 x i8> @add_v16i8(<16 x i8> %x, <16 x i8> %y) {
26 %a = add <16 x i8> %x, %y
27 ret <16 x i8> %a
28}
29
Thomas Livelya3937b22018-09-14 21:21:42 +000030; CHECK-LABEL: sub_v16i8:
Derek Schuff39bf39f2016-08-02 23:16:09 +000031; NO-SIMD128-NOT: i8x16
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +000032; SIMD128-NEXT: .functype sub_v16i8 (v128, v128) -> (v128){{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +000033; SIMD128-NEXT: i8x16.sub $push[[R:[0-9]+]]=, $0, $1{{$}}
34; SIMD128-NEXT: return $pop[[R]]{{$}}
Derek Schuff39bf39f2016-08-02 23:16:09 +000035define <16 x i8> @sub_v16i8(<16 x i8> %x, <16 x i8> %y) {
36 %a = sub <16 x i8> %x, %y
37 ret <16 x i8> %a
38}
39
Thomas Livelya3937b22018-09-14 21:21:42 +000040; CHECK-LABEL: mul_v16i8:
Derek Schuff39bf39f2016-08-02 23:16:09 +000041; NO-SIMD128-NOT: i8x16
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +000042; SIMD128-NEXT: .functype mul_v16i8 (v128, v128) -> (v128){{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +000043; SIMD128-NEXT: i8x16.mul $push[[R:[0-9]+]]=, $0, $1{{$}}
44; SIMD128-NEXT: return $pop[[R]]{{$}}
Derek Schuff39bf39f2016-08-02 23:16:09 +000045define <16 x i8> @mul_v16i8(<16 x i8> %x, <16 x i8> %y) {
46 %a = mul <16 x i8> %x, %y
47 ret <16 x i8> %a
48}
49
Thomas Lively88b74432018-09-14 22:35:12 +000050; CHECK-LABEL: neg_v16i8:
51; NO-SIMD128-NOT: i8x16
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +000052; SIMD128-NEXT: .functype neg_v16i8 (v128) -> (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
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +000064; SIMD128-NEXT: .functype shl_v16i8 (v128, i32) -> (v128){{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +000065; SIMD128-NEXT: i8x16.shl $push[[R:[0-9]+]]=, $0, $1{{$}}
66; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Livelyf2550e02018-09-15 00:45:31 +000067define <16 x i8> @shl_v16i8(<16 x i8> %v, i8 %x) {
68 %t = insertelement <16 x i8> undef, i8 %x, i32 0
69 %s = shufflevector <16 x i8> %t, <16 x i8> undef,
70 <16 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0,
71 i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
72 %a = shl <16 x i8> %v, %s
73 ret <16 x i8> %a
74}
75
76; CHECK-LABEL: shl_const_v16i8:
77; NO-SIMD128-NOT: i8x16
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +000078; SIMD128-NEXT: .functype shl_const_v16i8 (v128) -> (v128){{$}}
Thomas Livelyf2550e02018-09-15 00:45:31 +000079; SIMD128-NEXT: i32.const $push[[L0:[0-9]+]]=, 5
80; SIMD128-NEXT: i8x16.shl $push[[R:[0-9]+]]=, $0, $pop[[L0]]{{$}}
81; SIMD128-NEXT: return $pop[[R]]{{$}}
82define <16 x i8> @shl_const_v16i8(<16 x i8> %v) {
83 %a = shl <16 x i8> %v,
84 <i8 5, i8 5, i8 5, i8 5, i8 5, i8 5, i8 5, i8 5,
85 i8 5, i8 5, i8 5, i8 5, i8 5, i8 5, i8 5, i8 5>
86 ret <16 x i8> %a
87}
88
Thomas Livelyb2382c82018-11-02 00:39:57 +000089; CHECK-LABEL: shl_vec_v16i8:
90; NO-SIMD128-NOT: i8x16
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +000091; SIMD128-NEXT: .functype shl_vec_v16i8 (v128, v128) -> (v128){{$}}
Thomas Lively8dbf29af2018-12-20 02:10:22 +000092; SIMD128-NEXT: i8x16.extract_lane_s $push[[L0:[0-9]+]]=, $0, 0{{$}}
Thomas Lively6bf2b402019-01-15 02:16:03 +000093; SIMD128-NEXT: i32.const $push[[M0:[0-9]+]]=, 7{{$}}
Hans Wennborg5390d252019-08-13 09:33:25 +000094; SIMD128-NEXT: i8x16.splat $push[[M1:[0-9]+]]=, $pop[[M0]]{{$}}
95; SIMD128-NEXT: v128.and $push[[M2:[0-9]+]]=, $1, $pop[[M1]]{{$}}
96; SIMD128-NEXT: local.tee $push[[M:[0-9]+]]=, $1=, $pop[[M2]]{{$}}
97; SIMD128-NEXT: i8x16.extract_lane_u $push[[L1:[0-9]+]]=, $pop[[M]], 0{{$}}
98; SIMD128-NEXT: i32.shl $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}}
99; SIMD128-NEXT: i8x16.splat $push[[L3:[0-9]+]]=, $pop[[L2]]{{$}}
Thomas Livelyb2382c82018-11-02 00:39:57 +0000100; Skip 14 lanes
Thomas Lively8dbf29af2018-12-20 02:10:22 +0000101; SIMD128: i8x16.extract_lane_s $push[[L4:[0-9]+]]=, $0, 15{{$}}
Hans Wennborg5390d252019-08-13 09:33:25 +0000102; SIMD128-NEXT: i8x16.extract_lane_u $push[[L5:[0-9]+]]=, $1, 15{{$}}
103; SIMD128-NEXT: i32.shl $push[[L6:[0-9]+]]=, $pop[[L4]], $pop[[L5]]{{$}}
104; SIMD128-NEXT: i8x16.replace_lane $push[[R:[0-9]+]]=, $pop[[L7:[0-9]+]], 15, $pop[[L6]]{{$}}
Thomas Livelyb2382c82018-11-02 00:39:57 +0000105; SIMD128-NEXT: return $pop[[R]]{{$}}
106define <16 x i8> @shl_vec_v16i8(<16 x i8> %v, <16 x i8> %x) {
107 %a = shl <16 x i8> %v, %x
108 ret <16 x i8> %a
109}
110
Thomas Livelyf2550e02018-09-15 00:45:31 +0000111; CHECK-LABEL: shr_s_v16i8:
112; NO-SIMD128-NOT: i8x16
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000113; SIMD128-NEXT: .functype shr_s_v16i8 (v128, i32) -> (v128){{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000114; SIMD128-NEXT: i8x16.shr_s $push[[R:[0-9]+]]=, $0, $1{{$}}
115; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Livelyf2550e02018-09-15 00:45:31 +0000116define <16 x i8> @shr_s_v16i8(<16 x i8> %v, i8 %x) {
117 %t = insertelement <16 x i8> undef, i8 %x, i32 0
118 %s = shufflevector <16 x i8> %t, <16 x i8> undef,
119 <16 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0,
120 i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
121 %a = ashr <16 x i8> %v, %s
122 ret <16 x i8> %a
123}
124
Thomas Livelyb2382c82018-11-02 00:39:57 +0000125; CHECK-LABEL: shr_s_vec_v16i8:
126; NO-SIMD128-NOT: i8x16
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000127; SIMD128-NEXT: .functype shr_s_vec_v16i8 (v128, v128) -> (v128){{$}}
Thomas Lively8dbf29af2018-12-20 02:10:22 +0000128; SIMD128-NEXT: i8x16.extract_lane_s $push[[L0:[0-9]+]]=, $0, 0{{$}}
Thomas Lively6bf2b402019-01-15 02:16:03 +0000129; SIMD128-NEXT: i32.const $push[[M0:[0-9]+]]=, 7{{$}}
Hans Wennborg5390d252019-08-13 09:33:25 +0000130; SIMD128-NEXT: i8x16.splat $push[[M1:[0-9]+]]=, $pop[[M0]]{{$}}
131; SIMD128-NEXT: v128.and $push[[M2:[0-9]+]]=, $1, $pop[[M1]]{{$}}
132; SIMD128-NEXT: local.tee $push[[M:[0-9]+]]=, $1=, $pop[[M2]]{{$}}
133; SIMD128-NEXT: i8x16.extract_lane_u $push[[L1:[0-9]+]]=, $pop[[M]], 0{{$}}
134; SIMD128-NEXT: i32.shr_s $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}}
135; SIMD128-NEXT: i8x16.splat $push[[L3:[0-9]+]]=, $pop[[L2]]{{$}}
Thomas Livelyb2382c82018-11-02 00:39:57 +0000136; Skip 14 lanes
Hans Wennborg5390d252019-08-13 09:33:25 +0000137; SIMD128: i8x16.extract_lane_s $push[[L0:[0-9]+]]=, $0, 15{{$}}
138; SIMD128-NEXT: i8x16.extract_lane_u $push[[L1:[0-9]+]]=, $1, 15{{$}}
139; SIMD128-NEXT: i32.shr_s $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}}
140; SIMD128-NEXT: i8x16.replace_lane $push[[R:[0-9]+]]=, $pop{{[0-9]+}}, 15, $pop[[L2]]{{$}}
Thomas Livelyb2382c82018-11-02 00:39:57 +0000141; SIMD128-NEXT: return $pop[[R]]{{$}}
142define <16 x i8> @shr_s_vec_v16i8(<16 x i8> %v, <16 x i8> %x) {
143 %a = ashr <16 x i8> %v, %x
144 ret <16 x i8> %a
145}
146
Thomas Livelyf2550e02018-09-15 00:45:31 +0000147; CHECK-LABEL: shr_u_v16i8:
148; NO-SIMD128-NOT: i8x16
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000149; SIMD128-NEXT: .functype shr_u_v16i8 (v128, i32) -> (v128){{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000150; SIMD128-NEXT: i8x16.shr_u $push[[R:[0-9]+]]=, $0, $1{{$}}
151; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Livelyf2550e02018-09-15 00:45:31 +0000152define <16 x i8> @shr_u_v16i8(<16 x i8> %v, i8 %x) {
153 %t = insertelement <16 x i8> undef, i8 %x, i32 0
154 %s = shufflevector <16 x i8> %t, <16 x i8> undef,
155 <16 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0,
156 i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
157 %a = lshr <16 x i8> %v, %s
158 ret <16 x i8> %a
159}
160
Thomas Livelyb2382c82018-11-02 00:39:57 +0000161; CHECK-LABEL: shr_u_vec_v16i8:
162; NO-SIMD128-NOT: i8x16
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000163; SIMD128-NEXT: .functype shr_u_vec_v16i8 (v128, v128) -> (v128){{$}}
Thomas Livelyb2382c82018-11-02 00:39:57 +0000164; SIMD128-NEXT: i8x16.extract_lane_u $push[[L0:[0-9]+]]=, $0, 0{{$}}
Thomas Lively6bf2b402019-01-15 02:16:03 +0000165; SIMD128-NEXT: i32.const $push[[M0:[0-9]+]]=, 7{{$}}
Hans Wennborg5390d252019-08-13 09:33:25 +0000166; SIMD128-NEXT: i8x16.splat $push[[M1:[0-9]+]]=, $pop[[M0]]{{$}}
167; SIMD128-NEXT: v128.and $push[[M2:[0-9]+]]=, $1, $pop[[M1]]{{$}}
168; SIMD128-NEXT: local.tee $push[[M:[0-9]+]]=, $1=, $pop[[M2]]{{$}}
169; SIMD128-NEXT: i8x16.extract_lane_u $push[[L1:[0-9]+]]=, $pop[[M]], 0{{$}}
170; SIMD128-NEXT: i32.shr_u $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}}
171; SIMD128-NEXT: i8x16.splat $push[[L3:[0-9]+]]=, $pop[[L2]]{{$}}
Thomas Livelyb2382c82018-11-02 00:39:57 +0000172; Skip 14 lanes
173; SIMD128: i8x16.extract_lane_u $push[[L4:[0-9]+]]=, $0, 15{{$}}
Hans Wennborg5390d252019-08-13 09:33:25 +0000174; SIMD128-NEXT: i8x16.extract_lane_u $push[[L5:[0-9]+]]=, $1, 15{{$}}
175; SIMD128-NEXT: i32.shr_u $push[[L6:[0-9]+]]=, $pop[[L4]], $pop[[L5]]{{$}}
176; SIMD128-NEXT: i8x16.replace_lane $push[[R:[0-9]+]]=, $pop[[L7:[0-9]+]], 15, $pop[[L6]]{{$}}
Thomas Livelyb2382c82018-11-02 00:39:57 +0000177; SIMD128-NEXT: return $pop[[R]]{{$}}
178define <16 x i8> @shr_u_vec_v16i8(<16 x i8> %v, <16 x i8> %x) {
179 %a = lshr <16 x i8> %v, %x
180 ret <16 x i8> %a
181}
182
Thomas Livelya3937b22018-09-14 21:21:42 +0000183; CHECK-LABEL: and_v16i8:
Thomas Livelyec71e012018-08-28 18:33:31 +0000184; NO-SIMD128-NOT: v128
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000185; SIMD128-NEXT: .functype and_v16i8 (v128, v128) -> (v128){{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000186; SIMD128-NEXT: v128.and $push[[R:[0-9]+]]=, $0, $1{{$}}
187; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Livelyc1742572018-08-23 00:48:37 +0000188define <16 x i8> @and_v16i8(<16 x i8> %x, <16 x i8> %y) {
189 %a = and <16 x i8> %x, %y
190 ret <16 x i8> %a
191}
192
Thomas Livelya3937b22018-09-14 21:21:42 +0000193; CHECK-LABEL: or_v16i8:
Thomas Livelyec71e012018-08-28 18:33:31 +0000194; NO-SIMD128-NOT: v128
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000195; SIMD128-NEXT: .functype or_v16i8 (v128, v128) -> (v128){{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000196; SIMD128-NEXT: v128.or $push[[R:[0-9]+]]=, $0, $1{{$}}
197; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Livelyc1742572018-08-23 00:48:37 +0000198define <16 x i8> @or_v16i8(<16 x i8> %x, <16 x i8> %y) {
199 %a = or <16 x i8> %x, %y
200 ret <16 x i8> %a
201}
202
Thomas Livelya3937b22018-09-14 21:21:42 +0000203; CHECK-LABEL: xor_v16i8:
Thomas Livelyec71e012018-08-28 18:33:31 +0000204; NO-SIMD128-NOT: v128
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000205; SIMD128-NEXT: .functype xor_v16i8 (v128, v128) -> (v128){{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000206; SIMD128-NEXT: v128.xor $push[[R:[0-9]+]]=, $0, $1{{$}}
207; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Livelyc1742572018-08-23 00:48:37 +0000208define <16 x i8> @xor_v16i8(<16 x i8> %x, <16 x i8> %y) {
209 %a = xor <16 x i8> %x, %y
210 ret <16 x i8> %a
211}
212
Thomas Livelya3937b22018-09-14 21:21:42 +0000213; CHECK-LABEL: not_v16i8:
Thomas Lively995ad612018-08-28 18:31:15 +0000214; NO-SIMD128-NOT: v128
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000215; SIMD128-NEXT: .functype not_v16i8 (v128) -> (v128){{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000216; SIMD128-NEXT: v128.not $push[[R:[0-9]+]]=, $0{{$}}
217; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Lively995ad612018-08-28 18:31:15 +0000218define <16 x i8> @not_v16i8(<16 x i8> %x) {
219 %a = xor <16 x i8> %x, <i8 -1, i8 -1, i8 -1, i8 -1,
220 i8 -1, i8 -1, i8 -1, i8 -1,
221 i8 -1, i8 -1, i8 -1, i8 -1,
222 i8 -1, i8 -1, i8 -1, i8 -1>
223 ret <16 x i8> %a
224}
225
Thomas Lively3fcdd252019-09-27 02:11:40 +0000226; CHECK-LABEL: andnot_v16i8:
227; NO-SIMD128-NOT: v128
228; SIMD128-VM-NOT: v128.andnot
229; SIMD128-NEXT: .functype andnot_v16i8 (v128, v128) -> (v128){{$}}
230; SIMD128-SLOW-NEXT: v128.andnot $push[[R:[0-9]+]]=, $0, $1{{$}}
231; SIMD128-SLOW-NEXT: return $pop[[R]]{{$}}
232; SIMD128-FAST-NEXT: v128.not
233; SIMD128-FAST-NEXT: v128.and
234; SIMD128-FAST-NEXT: return
235define <16 x i8> @andnot_v16i8(<16 x i8> %x, <16 x i8> %y) {
236 %inv_y = xor <16 x i8> %y,
237 <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1,
238 i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1>
239 %a = and <16 x i8> %x, %inv_y
240 ret <16 x i8> %a
241}
242
Thomas Lively5d461c92018-10-03 23:02:23 +0000243; CHECK-LABEL: bitselect_v16i8:
244; NO-SIMD128-NOT: v128
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000245; SIMD128-NEXT: .functype bitselect_v16i8 (v128, v128, v128) -> (v128){{$}}
Thomas Lively5d461c92018-10-03 23:02:23 +0000246; SIMD128-SLOW-NEXT: v128.bitselect $push[[R:[0-9]+]]=, $1, $2, $0{{$}}
247; SIMD128-SLOW-NEXT: return $pop[[R]]{{$}}
248; SIMD128-FAST-NEXT: v128.and
249; SIMD128-FAST-NEXT: v128.not
250; SIMD128-FAST-NEXT: v128.and
251; SIMD128-FAST-NEXT: v128.or
252; SIMD128-FAST-NEXT: return
253define <16 x i8> @bitselect_v16i8(<16 x i8> %c, <16 x i8> %v1, <16 x i8> %v2) {
254 %masked_v1 = and <16 x i8> %c, %v1
255 %inv_mask = xor <16 x i8> %c,
256 <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1,
257 i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1>
258 %masked_v2 = and <16 x i8> %inv_mask, %v2
259 %a = or <16 x i8> %masked_v1, %masked_v2
260 ret <16 x i8> %a
261}
262
Derek Schuff39bf39f2016-08-02 23:16:09 +0000263; ==============================================================================
264; 8 x i16
265; ==============================================================================
Thomas Livelya3937b22018-09-14 21:21:42 +0000266; CHECK-LABEL: add_v8i16:
Derek Schuff39bf39f2016-08-02 23:16:09 +0000267; NO-SIMD128-NOT: i16x8
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000268; SIMD128-NEXT: .functype add_v8i16 (v128, v128) -> (v128){{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000269; SIMD128-NEXT: i16x8.add $push[[R:[0-9]+]]=, $0, $1{{$}}
270; SIMD128-NEXT: return $pop[[R]]{{$}}
Derek Schuff39bf39f2016-08-02 23:16:09 +0000271define <8 x i16> @add_v8i16(<8 x i16> %x, <8 x i16> %y) {
272 %a = add <8 x i16> %x, %y
273 ret <8 x i16> %a
274}
275
Thomas Livelya3937b22018-09-14 21:21:42 +0000276; CHECK-LABEL: sub_v8i16:
Derek Schuff39bf39f2016-08-02 23:16:09 +0000277; NO-SIMD128-NOT: i16x8
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000278; SIMD128-NEXT: .functype sub_v8i16 (v128, v128) -> (v128){{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000279; SIMD128-NEXT: i16x8.sub $push[[R:[0-9]+]]=, $0, $1{{$}}
280; SIMD128-NEXT: return $pop[[R]]{{$}}
Derek Schuff39bf39f2016-08-02 23:16:09 +0000281define <8 x i16> @sub_v8i16(<8 x i16> %x, <8 x i16> %y) {
282 %a = sub <8 x i16> %x, %y
283 ret <8 x i16> %a
284}
285
Thomas Livelya3937b22018-09-14 21:21:42 +0000286; CHECK-LABEL: mul_v8i16:
Derek Schuff39bf39f2016-08-02 23:16:09 +0000287; NO-SIMD128-NOT: i16x8
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000288; SIMD128-NEXT: .functype mul_v8i16 (v128, v128) -> (v128){{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000289; SIMD128-NEXT: i16x8.mul $push[[R:[0-9]+]]=, $0, $1{{$}}
290; SIMD128-NEXT: return $pop[[R]]{{$}}
Derek Schuff39bf39f2016-08-02 23:16:09 +0000291define <8 x i16> @mul_v8i16(<8 x i16> %x, <8 x i16> %y) {
292 %a = mul <8 x i16> %x, %y
293 ret <8 x i16> %a
294}
295
Thomas Lively88b74432018-09-14 22:35:12 +0000296; CHECK-LABEL: neg_v8i16:
297; NO-SIMD128-NOT: i16x8
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000298; SIMD128-NEXT: .functype neg_v8i16 (v128) -> (v128){{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000299; SIMD128-NEXT: i16x8.neg $push[[R:[0-9]+]]=, $0{{$}}
300; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Lively88b74432018-09-14 22:35:12 +0000301define <8 x i16> @neg_v8i16(<8 x i16> %x) {
302 %a = sub <8 x i16> <i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0>,
303 %x
304 ret <8 x i16> %a
305}
306
Thomas Livelyf2550e02018-09-15 00:45:31 +0000307; CHECK-LABEL: shl_v8i16:
308; NO-SIMD128-NOT: i16x8
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000309; SIMD128-NEXT: .functype shl_v8i16 (v128, i32) -> (v128){{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000310; SIMD128-NEXT: i16x8.shl $push[[R:[0-9]+]]=, $0, $1{{$}}
311; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Livelyf2550e02018-09-15 00:45:31 +0000312define <8 x i16> @shl_v8i16(<8 x i16> %v, i16 %x) {
313 %t = insertelement <8 x i16> undef, i16 %x, i32 0
314 %s = shufflevector <8 x i16> %t, <8 x i16> undef,
315 <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
316 %a = shl <8 x i16> %v, %s
317 ret <8 x i16> %a
318}
319
320; CHECK-LABEL: shl_const_v8i16:
321; NO-SIMD128-NOT: i16x8
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000322; SIMD128-NEXT: .functype shl_const_v8i16 (v128) -> (v128){{$}}
Thomas Livelyf2550e02018-09-15 00:45:31 +0000323; SIMD128-NEXT: i32.const $push[[L0:[0-9]+]]=, 5
324; SIMD128-NEXT: i16x8.shl $push[[R:[0-9]+]]=, $0, $pop[[L0]]{{$}}
325; SIMD128-NEXT: return $pop[[R]]{{$}}
326define <8 x i16> @shl_const_v8i16(<8 x i16> %v) {
327 %a = shl <8 x i16> %v,
328 <i16 5, i16 5, i16 5, i16 5, i16 5, i16 5, i16 5, i16 5>
329 ret <8 x i16> %a
330}
331
Thomas Livelyb2382c82018-11-02 00:39:57 +0000332; CHECK-LABEL: shl_vec_v8i16:
333; NO-SIMD128-NOT: i16x8
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000334; SIMD128-NEXT: .functype shl_vec_v8i16 (v128, v128) -> (v128){{$}}
Thomas Lively8dbf29af2018-12-20 02:10:22 +0000335; SIMD128-NEXT: i16x8.extract_lane_s $push[[L0:[0-9]+]]=, $0, 0{{$}}
Thomas Lively6bf2b402019-01-15 02:16:03 +0000336; SIMD128-NEXT: i32.const $push[[M0:[0-9]+]]=, 15{{$}}
Hans Wennborg5390d252019-08-13 09:33:25 +0000337; SIMD128-NEXT: i16x8.splat $push[[M1:[0-9]+]]=, $pop[[M0]]{{$}}
338; SIMD128-NEXT: v128.and $push[[M2:[0-9]+]]=, $1, $pop[[M1]]{{$}}
339; SIMD128-NEXT: local.tee $push[[M:[0-9]+]]=, $1=, $pop[[M2]]{{$}}
340; SIMD128-NEXT: i16x8.extract_lane_u $push[[L1:[0-9]+]]=, $pop[[M]], 0{{$}}
341; SIMD128-NEXT: i32.shl $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}}
342; SIMD128-NEXT: i16x8.splat $push[[L3:[0-9]+]]=, $pop[[L2]]{{$}}
Thomas Livelyb2382c82018-11-02 00:39:57 +0000343; Skip 6 lanes
Thomas Lively8dbf29af2018-12-20 02:10:22 +0000344; SIMD128: i16x8.extract_lane_s $push[[L4:[0-9]+]]=, $0, 7{{$}}
Hans Wennborg5390d252019-08-13 09:33:25 +0000345; SIMD128-NEXT: i16x8.extract_lane_u $push[[L5:[0-9]+]]=, $1, 7{{$}}
346; SIMD128-NEXT: i32.shl $push[[L6:[0-9]+]]=, $pop[[L4]], $pop[[L5]]{{$}}
347; SIMD128-NEXT: i16x8.replace_lane $push[[R:[0-9]+]]=, $pop[[L7:[0-9]+]], 7, $pop[[L6]]{{$}}
Thomas Livelyb2382c82018-11-02 00:39:57 +0000348; SIMD128-NEXT: return $pop[[R]]{{$}}
349define <8 x i16> @shl_vec_v8i16(<8 x i16> %v, <8 x i16> %x) {
350 %a = shl <8 x i16> %v, %x
351 ret <8 x i16> %a
352}
353
Thomas Livelyf2550e02018-09-15 00:45:31 +0000354; CHECK-LABEL: shr_s_v8i16:
355; NO-SIMD128-NOT: i16x8
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000356; SIMD128-NEXT: .functype shr_s_v8i16 (v128, i32) -> (v128){{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000357; SIMD128-NEXT: i16x8.shr_s $push[[R:[0-9]+]]=, $0, $1{{$}}
358; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Livelyf2550e02018-09-15 00:45:31 +0000359define <8 x i16> @shr_s_v8i16(<8 x i16> %v, i16 %x) {
360 %t = insertelement <8 x i16> undef, i16 %x, i32 0
361 %s = shufflevector <8 x i16> %t, <8 x i16> undef,
362 <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
363 %a = ashr <8 x i16> %v, %s
364 ret <8 x i16> %a
365}
366
Thomas Livelyb2382c82018-11-02 00:39:57 +0000367; CHECK-LABEL: shr_s_vec_v8i16:
368; NO-SIMD128-NOT: i16x8
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000369; SIMD128-NEXT: .functype shr_s_vec_v8i16 (v128, v128) -> (v128){{$}}
Thomas Lively8dbf29af2018-12-20 02:10:22 +0000370; SIMD128-NEXT: i16x8.extract_lane_s $push[[L0:[0-9]+]]=, $0, 0{{$}}
Thomas Lively6bf2b402019-01-15 02:16:03 +0000371; SIMD128-NEXT: i32.const $push[[M0:[0-9]+]]=, 15{{$}}
Hans Wennborg5390d252019-08-13 09:33:25 +0000372; SIMD128-NEXT: i16x8.splat $push[[M1:[0-9]+]]=, $pop[[M0]]{{$}}
373; SIMD128-NEXT: v128.and $push[[M2:[0-9]+]]=, $1, $pop[[M1]]{{$}}
374; SIMD128-NEXT: local.tee $push[[M:[0-9]+]]=, $1=, $pop[[M2]]{{$}}
375; SIMD128-NEXT: i16x8.extract_lane_u $push[[L1:[0-9]+]]=, $pop[[M]], 0{{$}}
376; SIMD128-NEXT: i32.shr_s $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}}
377; SIMD128-NEXT: i16x8.splat $push[[L3:[0-9]+]]=, $pop[[L2]]{{$}}
Thomas Livelyb2382c82018-11-02 00:39:57 +0000378; Skip 6 lanes
Hans Wennborg5390d252019-08-13 09:33:25 +0000379; SIMD128: i16x8.extract_lane_s $push[[L0:[0-9]+]]=, $0, 7{{$}}
380; SIMD128-NEXT: i16x8.extract_lane_u $push[[L1:[0-9]+]]=, $1, 7{{$}}
381; SIMD128-NEXT: i32.shr_s $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}}
382; SIMD128-NEXT: i16x8.replace_lane $push[[R:[0-9]+]]=, $pop{{[0-9]+}}, 7, $pop[[L2]]{{$}}
Thomas Livelyb2382c82018-11-02 00:39:57 +0000383; SIMD128-NEXT: return $pop[[R]]{{$}}
384define <8 x i16> @shr_s_vec_v8i16(<8 x i16> %v, <8 x i16> %x) {
385 %a = ashr <8 x i16> %v, %x
386 ret <8 x i16> %a
387}
388
Thomas Livelyf2550e02018-09-15 00:45:31 +0000389; CHECK-LABEL: shr_u_v8i16:
390; NO-SIMD128-NOT: i16x8
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000391; SIMD128-NEXT: .functype shr_u_v8i16 (v128, i32) -> (v128){{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000392; SIMD128-NEXT: i16x8.shr_u $push[[R:[0-9]+]]=, $0, $1{{$}}
393; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Livelyf2550e02018-09-15 00:45:31 +0000394define <8 x i16> @shr_u_v8i16(<8 x i16> %v, i16 %x) {
395 %t = insertelement <8 x i16> undef, i16 %x, i32 0
396 %s = shufflevector <8 x i16> %t, <8 x i16> undef,
397 <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
398 %a = lshr <8 x i16> %v, %s
399 ret <8 x i16> %a
400}
401
Thomas Livelyb2382c82018-11-02 00:39:57 +0000402; CHECK-LABEL: shr_u_vec_v8i16:
403; NO-SIMD128-NOT: i16x8
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000404; SIMD128-NEXT: .functype shr_u_vec_v8i16 (v128, v128) -> (v128){{$}}
Thomas Livelyb2382c82018-11-02 00:39:57 +0000405; SIMD128-NEXT: i16x8.extract_lane_u $push[[L0:[0-9]+]]=, $0, 0{{$}}
Thomas Lively6bf2b402019-01-15 02:16:03 +0000406; SIMD128-NEXT: i32.const $push[[M0:[0-9]+]]=, 15{{$}}
Hans Wennborg5390d252019-08-13 09:33:25 +0000407; SIMD128-NEXT: i16x8.splat $push[[M1:[0-9]+]]=, $pop[[M0]]{{$}}
408; SIMD128-NEXT: v128.and $push[[M2:[0-9]+]]=, $1, $pop[[M1]]{{$}}
409; SIMD128-NEXT: local.tee $push[[M:[0-9]+]]=, $1=, $pop[[M2]]{{$}}
410; SIMD128-NEXT: i16x8.extract_lane_u $push[[L1:[0-9]+]]=, $pop[[M]], 0{{$}}
411; SIMD128-NEXT: i32.shr_u $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}}
412; SIMD128-NEXT: i16x8.splat $push[[L3:[0-9]+]]=, $pop[[L2]]{{$}}
Thomas Livelyb2382c82018-11-02 00:39:57 +0000413; Skip 6 lanes
414; SIMD128: i16x8.extract_lane_u $push[[L4:[0-9]+]]=, $0, 7{{$}}
Hans Wennborg5390d252019-08-13 09:33:25 +0000415; SIMD128-NEXT: i16x8.extract_lane_u $push[[L5:[0-9]+]]=, $1, 7{{$}}
416; SIMD128-NEXT: i32.shr_u $push[[L6:[0-9]+]]=, $pop[[L4]], $pop[[L5]]{{$}}
417; SIMD128-NEXT: i16x8.replace_lane $push[[R:[0-9]+]]=, $pop[[L7:[0-9]+]], 7, $pop[[L6]]{{$}}
Thomas Livelyb2382c82018-11-02 00:39:57 +0000418; SIMD128-NEXT: return $pop[[R]]{{$}}
419define <8 x i16> @shr_u_vec_v8i16(<8 x i16> %v, <8 x i16> %x) {
420 %a = lshr <8 x i16> %v, %x
421 ret <8 x i16> %a
422}
423
Thomas Livelya3937b22018-09-14 21:21:42 +0000424; CHECK-LABEL: and_v8i16:
Thomas Livelyec71e012018-08-28 18:33:31 +0000425; NO-SIMD128-NOT: v128
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000426; SIMD128-NEXT: .functype and_v8i16 (v128, v128) -> (v128){{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000427; SIMD128-NEXT: v128.and $push[[R:[0-9]+]]=, $0, $1{{$}}
428; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Livelyc1742572018-08-23 00:48:37 +0000429define <8 x i16> @and_v8i16(<8 x i16> %x, <8 x i16> %y) {
430 %a = and <8 x i16> %x, %y
431 ret <8 x i16> %a
432}
433
Thomas Livelya3937b22018-09-14 21:21:42 +0000434; CHECK-LABEL: or_v8i16:
Thomas Livelyec71e012018-08-28 18:33:31 +0000435; NO-SIMD128-NOT: v128
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000436; SIMD128-NEXT: .functype or_v8i16 (v128, v128) -> (v128){{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000437; SIMD128-NEXT: v128.or $push[[R:[0-9]+]]=, $0, $1{{$}}
438; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Livelyc1742572018-08-23 00:48:37 +0000439define <8 x i16> @or_v8i16(<8 x i16> %x, <8 x i16> %y) {
440 %a = or <8 x i16> %x, %y
441 ret <8 x i16> %a
442}
443
Thomas Livelya3937b22018-09-14 21:21:42 +0000444; CHECK-LABEL: xor_v8i16:
Thomas Livelyec71e012018-08-28 18:33:31 +0000445; NO-SIMD128-NOT: v128
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000446; SIMD128-NEXT: .functype xor_v8i16 (v128, v128) -> (v128){{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000447; SIMD128-NEXT: v128.xor $push[[R:[0-9]+]]=, $0, $1{{$}}
448; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Livelyc1742572018-08-23 00:48:37 +0000449define <8 x i16> @xor_v8i16(<8 x i16> %x, <8 x i16> %y) {
450 %a = xor <8 x i16> %x, %y
451 ret <8 x i16> %a
452}
453
Thomas Livelya3937b22018-09-14 21:21:42 +0000454; CHECK-LABEL: not_v8i16:
Thomas Lively995ad612018-08-28 18:31:15 +0000455; NO-SIMD128-NOT: v128
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000456; SIMD128-NEXT: .functype not_v8i16 (v128) -> (v128){{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000457; SIMD128-NEXT: v128.not $push[[R:[0-9]+]]=, $0{{$}}
458; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Lively995ad612018-08-28 18:31:15 +0000459define <8 x i16> @not_v8i16(<8 x i16> %x) {
460 %a = xor <8 x i16> %x, <i16 -1, i16 -1, i16 -1, i16 -1,
461 i16 -1, i16 -1, i16 -1, i16 -1>
462 ret <8 x i16> %a
463}
464
Thomas Lively3fcdd252019-09-27 02:11:40 +0000465; CHECK-LABEL: andnot_v8i16:
466; SIMD128-VM-NOT: v128.andnot
467; NO-SIMD128-NOT: v128
468; SIMD128-NEXT: .functype andnot_v8i16 (v128, v128) -> (v128){{$}}
469; SIMD128-SLOW-NEXT: v128.andnot $push[[R:[0-9]+]]=, $0, $1{{$}}
470; SIMD128-SLOW-NEXT: return $pop[[R]]{{$}}
471; SIMD128-FAST-NEXT: v128.not
472; SIMD128-FAST-NEXT: v128.and
473; SIMD128-FAST-NEXT: return
474define <8 x i16> @andnot_v8i16(<8 x i16> %x, <8 x i16> %y) {
475 %inv_y = xor <8 x i16> %y,
476 <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1>
477 %a = and <8 x i16> %x, %inv_y
478 ret <8 x i16> %a
479}
480
Thomas Lively5d461c92018-10-03 23:02:23 +0000481; CHECK-LABEL: bitselect_v8i16:
482; NO-SIMD128-NOT: v128
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000483; SIMD128-NEXT: .functype bitselect_v8i16 (v128, v128, v128) -> (v128){{$}}
Thomas Lively5d461c92018-10-03 23:02:23 +0000484; SIMD128-SLOW-NEXT: v128.bitselect $push[[R:[0-9]+]]=, $1, $2, $0{{$}}
485; SIMD128-SLOW-NEXT: return $pop[[R]]{{$}}
486; SIMD128-FAST-NEXT: v128.and
487; SIMD128-FAST-NEXT: v128.not
488; SIMD128-FAST-NEXT: v128.and
489; SIMD128-FAST-NEXT: v128.or
490; SIMD128-FAST-NEXT: return
491define <8 x i16> @bitselect_v8i16(<8 x i16> %c, <8 x i16> %v1, <8 x i16> %v2) {
492 %masked_v1 = and <8 x i16> %v1, %c
493 %inv_mask = xor <8 x i16>
494 <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1>,
495 %c
496 %masked_v2 = and <8 x i16> %v2, %inv_mask
497 %a = or <8 x i16> %masked_v1, %masked_v2
498 ret <8 x i16> %a
499}
500
Derek Schuff39bf39f2016-08-02 23:16:09 +0000501; ==============================================================================
502; 4 x i32
503; ==============================================================================
Thomas Livelya3937b22018-09-14 21:21:42 +0000504; CHECK-LABEL: add_v4i32:
Derek Schuff39bf39f2016-08-02 23:16:09 +0000505; NO-SIMD128-NOT: i32x4
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000506; SIMD128-NEXT: .functype add_v4i32 (v128, v128) -> (v128){{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000507; SIMD128-NEXT: i32x4.add $push[[R:[0-9]+]]=, $0, $1{{$}}
508; SIMD128-NEXT: return $pop[[R]]{{$}}
Derek Schuff39bf39f2016-08-02 23:16:09 +0000509define <4 x i32> @add_v4i32(<4 x i32> %x, <4 x i32> %y) {
510 %a = add <4 x i32> %x, %y
511 ret <4 x i32> %a
512}
513
Thomas Livelya3937b22018-09-14 21:21:42 +0000514; CHECK-LABEL: sub_v4i32:
Derek Schuff39bf39f2016-08-02 23:16:09 +0000515; NO-SIMD128-NOT: i32x4
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000516; SIMD128-NEXT: .functype sub_v4i32 (v128, v128) -> (v128){{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000517; SIMD128-NEXT: i32x4.sub $push[[R:[0-9]+]]=, $0, $1{{$}}
518; SIMD128-NEXT: return $pop[[R]]{{$}}
Derek Schuff39bf39f2016-08-02 23:16:09 +0000519define <4 x i32> @sub_v4i32(<4 x i32> %x, <4 x i32> %y) {
520 %a = sub <4 x i32> %x, %y
521 ret <4 x i32> %a
522}
523
Thomas Livelya3937b22018-09-14 21:21:42 +0000524; CHECK-LABEL: mul_v4i32:
Derek Schuff39bf39f2016-08-02 23:16:09 +0000525; NO-SIMD128-NOT: i32x4
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000526; SIMD128-NEXT: .functype mul_v4i32 (v128, v128) -> (v128){{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000527; SIMD128-NEXT: i32x4.mul $push[[R:[0-9]+]]=, $0, $1{{$}}
528; SIMD128-NEXT: return $pop[[R]]{{$}}
Derek Schuff39bf39f2016-08-02 23:16:09 +0000529define <4 x i32> @mul_v4i32(<4 x i32> %x, <4 x i32> %y) {
530 %a = mul <4 x i32> %x, %y
531 ret <4 x i32> %a
532}
533
Thomas Lively88b74432018-09-14 22:35:12 +0000534; CHECK-LABEL: neg_v4i32:
535; NO-SIMD128-NOT: i32x4
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000536; SIMD128-NEXT: .functype neg_v4i32 (v128) -> (v128){{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000537; SIMD128-NEXT: i32x4.neg $push[[R:[0-9]+]]=, $0{{$}}
538; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Lively88b74432018-09-14 22:35:12 +0000539define <4 x i32> @neg_v4i32(<4 x i32> %x) {
540 %a = sub <4 x i32> <i32 0, i32 0, i32 0, i32 0>, %x
541 ret <4 x i32> %a
542}
543
Thomas Livelyf2550e02018-09-15 00:45:31 +0000544; CHECK-LABEL: shl_v4i32:
545; NO-SIMD128-NOT: i32x4
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000546; SIMD128-NEXT: .functype shl_v4i32 (v128, i32) -> (v128){{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000547; SIMD128-NEXT: i32x4.shl $push[[R:[0-9]+]]=, $0, $1{{$}}
548; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Livelyf2550e02018-09-15 00:45:31 +0000549define <4 x i32> @shl_v4i32(<4 x i32> %v, i32 %x) {
550 %t = insertelement <4 x i32> undef, i32 %x, i32 0
551 %s = shufflevector <4 x i32> %t, <4 x i32> undef,
552 <4 x i32> <i32 0, i32 0, i32 0, i32 0>
553 %a = shl <4 x i32> %v, %s
554 ret <4 x i32> %a
555}
556
557; CHECK-LABEL: shl_const_v4i32:
558; NO-SIMD128-NOT: i32x4
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000559; SIMD128-NEXT: .functype shl_const_v4i32 (v128) -> (v128){{$}}
Thomas Livelyf2550e02018-09-15 00:45:31 +0000560; SIMD128-NEXT: i32.const $push[[L0:[0-9]+]]=, 5
561; SIMD128-NEXT: i32x4.shl $push[[R:[0-9]+]]=, $0, $pop[[L0]]{{$}}
562; SIMD128-NEXT: return $pop[[R]]{{$}}
563define <4 x i32> @shl_const_v4i32(<4 x i32> %v) {
564 %a = shl <4 x i32> %v, <i32 5, i32 5, i32 5, i32 5>
565 ret <4 x i32> %a
566}
567
Thomas Livelyb2382c82018-11-02 00:39:57 +0000568; CHECK-LABEL: shl_vec_v4i32:
569; NO-SIMD128-NOT: i32x4
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000570; SIMD128-NEXT: .functype shl_vec_v4i32 (v128, v128) -> (v128){{$}}
Thomas Livelyb2382c82018-11-02 00:39:57 +0000571; SIMD128-NEXT: i32x4.extract_lane $push[[L0:[0-9]+]]=, $0, 0{{$}}
572; SIMD128-NEXT: i32x4.extract_lane $push[[L1:[0-9]+]]=, $1, 0{{$}}
573; SIMD128-NEXT: i32.shl $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}}
574; SIMD128-NEXT: i32x4.splat $push[[L3:[0-9]+]]=, $pop[[L2]]{{$}}
575; Skip 2 lanes
576; SIMD128: i32x4.extract_lane $push[[L4:[0-9]+]]=, $0, 3{{$}}
577; SIMD128-NEXT: i32x4.extract_lane $push[[L5:[0-9]+]]=, $1, 3{{$}}
578; SIMD128-NEXT: i32.shl $push[[L6:[0-9]+]]=, $pop[[L4]], $pop[[L5]]{{$}}
579; SIMD128-NEXT: i32x4.replace_lane $push[[R:[0-9]+]]=, $pop[[L7:[0-9]+]], 3, $pop[[L6]]{{$}}
580; SIMD128-NEXT: return $pop[[R]]{{$}}
581define <4 x i32> @shl_vec_v4i32(<4 x i32> %v, <4 x i32> %x) {
582 %a = shl <4 x i32> %v, %x
583 ret <4 x i32> %a
584}
585
Thomas Livelyf2550e02018-09-15 00:45:31 +0000586; CHECK-LABEL: shr_s_v4i32:
587; NO-SIMD128-NOT: i32x4
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000588; SIMD128-NEXT: .functype shr_s_v4i32 (v128, i32) -> (v128){{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000589; SIMD128-NEXT: i32x4.shr_s $push[[R:[0-9]+]]=, $0, $1{{$}}
590; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Livelyf2550e02018-09-15 00:45:31 +0000591define <4 x i32> @shr_s_v4i32(<4 x i32> %v, i32 %x) {
592 %t = insertelement <4 x i32> undef, i32 %x, i32 0
593 %s = shufflevector <4 x i32> %t, <4 x i32> undef,
594 <4 x i32> <i32 0, i32 0, i32 0, i32 0>
595 %a = ashr <4 x i32> %v, %s
596 ret <4 x i32> %a
597}
598
Thomas Livelyb2382c82018-11-02 00:39:57 +0000599; CHECK-LABEL: shr_s_vec_v4i32:
600; NO-SIMD128-NOT: i32x4
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000601; SIMD128-NEXT: .functype shr_s_vec_v4i32 (v128, v128) -> (v128){{$}}
Thomas Livelyb2382c82018-11-02 00:39:57 +0000602; SIMD128-NEXT: i32x4.extract_lane $push[[L0:[0-9]+]]=, $0, 0{{$}}
603; SIMD128-NEXT: i32x4.extract_lane $push[[L1:[0-9]+]]=, $1, 0{{$}}
604; SIMD128-NEXT: i32.shr_s $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}}
605; SIMD128-NEXT: i32x4.splat $push[[L3:[0-9]+]]=, $pop[[L2]]{{$}}
606; Skip 2 lanes
607; SIMD128: i32x4.extract_lane $push[[L4:[0-9]+]]=, $0, 3{{$}}
608; SIMD128-NEXT: i32x4.extract_lane $push[[L5:[0-9]+]]=, $1, 3{{$}}
609; SIMD128-NEXT: i32.shr_s $push[[L6:[0-9]+]]=, $pop[[L4]], $pop[[L5]]{{$}}
610; SIMD128-NEXT: i32x4.replace_lane $push[[R:[0-9]+]]=, $pop[[L7:[0-9]+]], 3, $pop[[L6]]{{$}}
611; SIMD128-NEXT: return $pop[[R]]{{$}}
612define <4 x i32> @shr_s_vec_v4i32(<4 x i32> %v, <4 x i32> %x) {
613 %a = ashr <4 x i32> %v, %x
614 ret <4 x i32> %a
615}
616
Thomas Livelyf2550e02018-09-15 00:45:31 +0000617; CHECK-LABEL: shr_u_v4i32:
618; NO-SIMD128-NOT: i32x4
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000619; SIMD128-NEXT: .functype shr_u_v4i32 (v128, i32) -> (v128){{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000620; SIMD128-NEXT: i32x4.shr_u $push[[R:[0-9]+]]=, $0, $1{{$}}
621; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Livelyf2550e02018-09-15 00:45:31 +0000622define <4 x i32> @shr_u_v4i32(<4 x i32> %v, i32 %x) {
623 %t = insertelement <4 x i32> undef, i32 %x, i32 0
624 %s = shufflevector <4 x i32> %t, <4 x i32> undef,
625 <4 x i32> <i32 0, i32 0, i32 0, i32 0>
626 %a = lshr <4 x i32> %v, %s
627 ret <4 x i32> %a
628}
629
Thomas Livelyb2382c82018-11-02 00:39:57 +0000630; CHECK-LABEL: shr_u_vec_v4i32:
631; NO-SIMD128-NOT: i32x4
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000632; SIMD128-NEXT: .functype shr_u_vec_v4i32 (v128, v128) -> (v128){{$}}
Thomas Livelyb2382c82018-11-02 00:39:57 +0000633; SIMD128-NEXT: i32x4.extract_lane $push[[L0:[0-9]+]]=, $0, 0{{$}}
634; SIMD128-NEXT: i32x4.extract_lane $push[[L1:[0-9]+]]=, $1, 0{{$}}
635; SIMD128-NEXT: i32.shr_u $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}}
636; SIMD128-NEXT: i32x4.splat $push[[L3:[0-9]+]]=, $pop[[L2]]{{$}}
637; Skip 2 lanes
638; SIMD128: i32x4.extract_lane $push[[L4:[0-9]+]]=, $0, 3{{$}}
639; SIMD128-NEXT: i32x4.extract_lane $push[[L5:[0-9]+]]=, $1, 3{{$}}
640; SIMD128-NEXT: i32.shr_u $push[[L6:[0-9]+]]=, $pop[[L4]], $pop[[L5]]{{$}}
641; SIMD128-NEXT: i32x4.replace_lane $push[[R:[0-9]+]]=, $pop[[L7:[0-9]+]], 3, $pop[[L6]]{{$}}
642; SIMD128-NEXT: return $pop[[R]]{{$}}
643define <4 x i32> @shr_u_vec_v4i32(<4 x i32> %v, <4 x i32> %x) {
644 %a = lshr <4 x i32> %v, %x
645 ret <4 x i32> %a
646}
647
Thomas Livelya3937b22018-09-14 21:21:42 +0000648; CHECK-LABEL: and_v4i32:
Thomas Livelyec71e012018-08-28 18:33:31 +0000649; NO-SIMD128-NOT: v128
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000650; SIMD128-NEXT: .functype and_v4i32 (v128, v128) -> (v128){{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000651; SIMD128-NEXT: v128.and $push[[R:[0-9]+]]=, $0, $1{{$}}
652; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Livelyc1742572018-08-23 00:48:37 +0000653define <4 x i32> @and_v4i32(<4 x i32> %x, <4 x i32> %y) {
654 %a = and <4 x i32> %x, %y
655 ret <4 x i32> %a
656}
657
Thomas Livelya3937b22018-09-14 21:21:42 +0000658; CHECK-LABEL: or_v4i32:
Thomas Livelyec71e012018-08-28 18:33:31 +0000659; NO-SIMD128-NOT: v128
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000660; SIMD128-NEXT: .functype or_v4i32 (v128, v128) -> (v128){{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000661; SIMD128-NEXT: v128.or $push[[R:[0-9]+]]=, $0, $1{{$}}
662; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Livelyc1742572018-08-23 00:48:37 +0000663define <4 x i32> @or_v4i32(<4 x i32> %x, <4 x i32> %y) {
664 %a = or <4 x i32> %x, %y
665 ret <4 x i32> %a
666}
667
Thomas Livelya3937b22018-09-14 21:21:42 +0000668; CHECK-LABEL: xor_v4i32:
Thomas Livelyec71e012018-08-28 18:33:31 +0000669; NO-SIMD128-NOT: v128
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000670; SIMD128-NEXT: .functype xor_v4i32 (v128, v128) -> (v128){{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000671; SIMD128-NEXT: v128.xor $push[[R:[0-9]+]]=, $0, $1{{$}}
672; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Livelyc1742572018-08-23 00:48:37 +0000673define <4 x i32> @xor_v4i32(<4 x i32> %x, <4 x i32> %y) {
674 %a = xor <4 x i32> %x, %y
675 ret <4 x i32> %a
676}
677
Thomas Livelya3937b22018-09-14 21:21:42 +0000678; CHECK-LABEL: not_v4i32:
Thomas Lively995ad612018-08-28 18:31:15 +0000679; NO-SIMD128-NOT: v128
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000680; SIMD128-NEXT: .functype not_v4i32 (v128) -> (v128){{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000681; SIMD128-NEXT: v128.not $push[[R:[0-9]+]]=, $0{{$}}
682; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Lively995ad612018-08-28 18:31:15 +0000683define <4 x i32> @not_v4i32(<4 x i32> %x) {
684 %a = xor <4 x i32> %x, <i32 -1, i32 -1, i32 -1, i32 -1>
685 ret <4 x i32> %a
686}
687
Thomas Lively3fcdd252019-09-27 02:11:40 +0000688; CHECK-LABEL: andnot_v4i32:
689; SIMD128-VM-NOT: v128.andnot
690; NO-SIMD128-NOT: v128
691; SIMD128-NEXT: .functype andnot_v4i32 (v128, v128) -> (v128){{$}}
692; SIMD128-SLOW-NEXT: v128.andnot $push[[R:[0-9]+]]=, $0, $1{{$}}
693; SIMD128-SLOW-NEXT: return $pop[[R]]{{$}}
694; SIMD128-FAST-NEXT: v128.not
695; SIMD128-FAST-NEXT: v128.and
696; SIMD128-FAST-NEXT: return
697define <4 x i32> @andnot_v4i32(<4 x i32> %x, <4 x i32> %y) {
698 %inv_y = xor <4 x i32> %y, <i32 -1, i32 -1, i32 -1, i32 -1>
699 %a = and <4 x i32> %x, %inv_y
700 ret <4 x i32> %a
701}
702
Thomas Lively5d461c92018-10-03 23:02:23 +0000703; CHECK-LABEL: bitselect_v4i32:
704; NO-SIMD128-NOT: v128
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000705; SIMD128-NEXT: .functype bitselect_v4i32 (v128, v128, v128) -> (v128){{$}}
Thomas Lively5d461c92018-10-03 23:02:23 +0000706; SIMD128-SLOW-NEXT: v128.bitselect $push[[R:[0-9]+]]=, $1, $2, $0{{$}}
707; SIMD128-SLOW-NEXT: return $pop[[R]]{{$}}
708; SIMD128-FAST-NEXT: v128.not
709; SIMD128-FAST-NEXT: v128.and
710; SIMD128-FAST-NEXT: v128.and
711; SIMD128-FAST-NEXT: v128.or
712; SIMD128-FAST-NEXT: return
713define <4 x i32> @bitselect_v4i32(<4 x i32> %c, <4 x i32> %v1, <4 x i32> %v2) {
714 %masked_v1 = and <4 x i32> %c, %v1
715 %inv_mask = xor <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>, %c
716 %masked_v2 = and <4 x i32> %inv_mask, %v2
717 %a = or <4 x i32> %masked_v2, %masked_v1
718 ret <4 x i32> %a
719}
720
Derek Schuff39bf39f2016-08-02 23:16:09 +0000721; ==============================================================================
Derek Schuff51ed1312018-08-07 21:24:01 +0000722; 2 x i64
723; ==============================================================================
Thomas Livelya3937b22018-09-14 21:21:42 +0000724; CHECK-LABEL: add_v2i64:
Derek Schuff51ed1312018-08-07 21:24:01 +0000725; NO-SIMD128-NOT: i64x2
Heejin Ahn5831e9c2018-08-09 23:58:51 +0000726; SIMD128-VM-NOT: i64x2
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000727; SIMD128-NEXT: .functype add_v2i64 (v128, v128) -> (v128){{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000728; SIMD128-NEXT: i64x2.add $push[[R:[0-9]+]]=, $0, $1{{$}}
729; SIMD128-NEXT: return $pop[[R]]{{$}}
Derek Schuff51ed1312018-08-07 21:24:01 +0000730define <2 x i64> @add_v2i64(<2 x i64> %x, <2 x i64> %y) {
731 %a = add <2 x i64> %x, %y
732 ret <2 x i64> %a
733}
734
Thomas Livelya3937b22018-09-14 21:21:42 +0000735; CHECK-LABEL: sub_v2i64:
Derek Schuff51ed1312018-08-07 21:24:01 +0000736; NO-SIMD128-NOT: i64x2
Heejin Ahn5831e9c2018-08-09 23:58:51 +0000737; SIMD128-VM-NOT: i64x2
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000738; SIMD128-NEXT: .functype sub_v2i64 (v128, v128) -> (v128){{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000739; SIMD128-NEXT: i64x2.sub $push[[R:[0-9]+]]=, $0, $1{{$}}
740; SIMD128-NEXT: return $pop[[R]]{{$}}
Derek Schuff51ed1312018-08-07 21:24:01 +0000741define <2 x i64> @sub_v2i64(<2 x i64> %x, <2 x i64> %y) {
742 %a = sub <2 x i64> %x, %y
743 ret <2 x i64> %a
744}
745
Thomas Lively2ee686d2018-08-22 23:06:27 +0000746; v2i64.mul is not in spec
Thomas Livelya3937b22018-09-14 21:21:42 +0000747; CHECK-LABEL: mul_v2i64:
Derek Schuff51ed1312018-08-07 21:24:01 +0000748; NO-SIMD128-NOT: i64x2
Heejin Ahn5831e9c2018-08-09 23:58:51 +0000749; SIMD128-VM-NOT: i64x2
Thomas Lively2ee686d2018-08-22 23:06:27 +0000750; SIMD128-NOT: i64x2.mul
751; SIMD128: i64x2.extract_lane
752; SIMD128: i64.mul
Derek Schuff51ed1312018-08-07 21:24:01 +0000753define <2 x i64> @mul_v2i64(<2 x i64> %x, <2 x i64> %y) {
754 %a = mul <2 x i64> %x, %y
755 ret <2 x i64> %a
756}
757
Thomas Lively88b74432018-09-14 22:35:12 +0000758; CHECK-LABEL: neg_v2i64:
759; NO-SIMD128-NOT: i64x2
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000760; SIMD128-NEXT: .functype neg_v2i64 (v128) -> (v128){{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000761; SIMD128-NEXT: i64x2.neg $push[[R:[0-9]+]]=, $0{{$}}
762; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Lively88b74432018-09-14 22:35:12 +0000763define <2 x i64> @neg_v2i64(<2 x i64> %x) {
764 %a = sub <2 x i64> <i64 0, i64 0>, %x
765 ret <2 x i64> %a
766}
767
Thomas Livelyf2550e02018-09-15 00:45:31 +0000768; CHECK-LABEL: shl_v2i64:
769; NO-SIMD128-NOT: i64x2
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000770; SIMD128-NEXT: .functype shl_v2i64 (v128, i32) -> (v128){{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000771; SIMD128-NEXT: i64x2.shl $push[[R:[0-9]+]]=, $0, $1{{$}}
772; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Livelyf2550e02018-09-15 00:45:31 +0000773define <2 x i64> @shl_v2i64(<2 x i64> %v, i32 %x) {
774 %x2 = zext i32 %x to i64
775 %t = insertelement <2 x i64> undef, i64 %x2, i32 0
776 %s = shufflevector <2 x i64> %t, <2 x i64> undef, <2 x i32> <i32 0, i32 0>
777 %a = shl <2 x i64> %v, %s
778 ret <2 x i64> %a
779}
780
Thomas Lively7663e0c2019-06-26 16:19:59 +0000781; CHECK-LABEL: shl_sext_v2i64:
Thomas Livelyf2550e02018-09-15 00:45:31 +0000782; NO-SIMD128-NOT: i64x2
Thomas Lively7663e0c2019-06-26 16:19:59 +0000783; SIMD128-NEXT: .functype shl_sext_v2i64 (v128, i32) -> (v128){{$}}
784; SIMD128-NEXT: i64x2.shl $push[[R:[0-9]+]]=, $0, $1{{$}}
785; SIMD128-NEXT: return $pop[[R]]{{$}}
786define <2 x i64> @shl_sext_v2i64(<2 x i64> %v, i32 %x) {
787 %x2 = sext i32 %x to i64
788 %t = insertelement <2 x i64> undef, i64 %x2, i32 0
789 %s = shufflevector <2 x i64> %t, <2 x i64> undef, <2 x i32> <i32 0, i32 0>
790 %a = shl <2 x i64> %v, %s
791 ret <2 x i64> %a
792}
793
794; CHECK-LABEL: shl_noext_v2i64:
795; NO-SIMD128-NOT: i64x2
796; SIMD128-NEXT: .functype shl_noext_v2i64 (v128, i64) -> (v128){{$}}
Thomas Lively6a87dda2019-01-08 06:25:55 +0000797; SIMD128-NEXT: i32.wrap_i64 $push[[L0:[0-9]+]]=, $1{{$}}
Thomas Livelyf2550e02018-09-15 00:45:31 +0000798; SIMD128-NEXT: i64x2.shl $push[[R:[0-9]+]]=, $0, $pop[[L0]]{{$}}
799; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Lively7663e0c2019-06-26 16:19:59 +0000800define <2 x i64> @shl_noext_v2i64(<2 x i64> %v, i64 %x) {
Thomas Livelyf2550e02018-09-15 00:45:31 +0000801 %t = insertelement <2 x i64> undef, i64 %x, i32 0
802 %s = shufflevector <2 x i64> %t, <2 x i64> undef, <2 x i32> <i32 0, i32 0>
803 %a = shl <2 x i64> %v, %s
804 ret <2 x i64> %a
805}
806
807; CHECK-LABEL: shl_const_v2i64:
808; NO-SIMD128-NOT: i64x2
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000809; SIMD128-NEXT: .functype shl_const_v2i64 (v128) -> (v128){{$}}
Thomas Lively55735d52018-10-20 01:31:18 +0000810; SIMD128-NEXT: i32.const $push[[L0:[0-9]+]]=, 5{{$}}
811; SIMD128-NEXT: i64x2.shl $push[[R:[0-9]+]]=, $0, $pop[[L0]]{{$}}
Thomas Livelyf2550e02018-09-15 00:45:31 +0000812; SIMD128-NEXT: return $pop[[R]]{{$}}
813define <2 x i64> @shl_const_v2i64(<2 x i64> %v) {
814 %a = shl <2 x i64> %v, <i64 5, i64 5>
815 ret <2 x i64> %a
816}
817
Thomas Livelyb2382c82018-11-02 00:39:57 +0000818; CHECK-LABEL: shl_vec_v2i64:
819; NO-SIMD128-NOT: i64x2
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000820; SIMD128-NEXT: .functype shl_vec_v2i64 (v128, v128) -> (v128){{$}}
Thomas Livelyb2382c82018-11-02 00:39:57 +0000821; SIMD128-NEXT: i64x2.extract_lane $push[[L0:[0-9]+]]=, $0, 0{{$}}
822; SIMD128-NEXT: i64x2.extract_lane $push[[L1:[0-9]+]]=, $1, 0{{$}}
823; SIMD128-NEXT: i64.shl $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}}
824; SIMD128-NEXT: i64x2.splat $push[[L3:[0-9]+]]=, $pop[[L2]]{{$}}
825; SIMD128-NEXT: i64x2.extract_lane $push[[L4:[0-9]+]]=, $0, 1{{$}}
826; SIMD128-NEXT: i64x2.extract_lane $push[[L5:[0-9]+]]=, $1, 1{{$}}
827; SIMD128-NEXT: i64.shl $push[[L6:[0-9]+]]=, $pop[[L4]], $pop[[L5]]{{$}}
828; SIMD128-NEXT: i64x2.replace_lane $push[[R:[0-9]+]]=, $pop[[L3]], 1, $pop[[L6]]{{$}}
829; SIMD128-NEXT: return $pop[[R]]{{$}}
830define <2 x i64> @shl_vec_v2i64(<2 x i64> %v, <2 x i64> %x) {
831 %a = shl <2 x i64> %v, %x
832 ret <2 x i64> %a
833}
834
Thomas Livelyf2550e02018-09-15 00:45:31 +0000835; CHECK-LABEL: shr_s_v2i64:
836; NO-SIMD128-NOT: i64x2
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000837; SIMD128-NEXT: .functype shr_s_v2i64 (v128, i32) -> (v128){{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000838; SIMD128-NEXT: i64x2.shr_s $push[[R:[0-9]+]]=, $0, $1{{$}}
839; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Livelyf2550e02018-09-15 00:45:31 +0000840define <2 x i64> @shr_s_v2i64(<2 x i64> %v, i32 %x) {
841 %x2 = zext i32 %x to i64
842 %t = insertelement <2 x i64> undef, i64 %x2, i32 0
843 %s = shufflevector <2 x i64> %t, <2 x i64> undef, <2 x i32> <i32 0, i32 0>
844 %a = ashr <2 x i64> %v, %s
845 ret <2 x i64> %a
846}
847
Thomas Lively7663e0c2019-06-26 16:19:59 +0000848; CHECK-LABEL: shr_s_sext_v2i64:
Thomas Livelyf2550e02018-09-15 00:45:31 +0000849; NO-SIMD128-NOT: i64x2
Thomas Lively7663e0c2019-06-26 16:19:59 +0000850; SIMD128-NEXT: .functype shr_s_sext_v2i64 (v128, i32) -> (v128){{$}}
851; SIMD128-NEXT: i64x2.shr_s $push[[R:[0-9]+]]=, $0, $1{{$}}
852; SIMD128-NEXT: return $pop[[R]]{{$}}
853define <2 x i64> @shr_s_sext_v2i64(<2 x i64> %v, i32 %x) {
854 %x2 = sext i32 %x to i64
855 %t = insertelement <2 x i64> undef, i64 %x2, i32 0
856 %s = shufflevector <2 x i64> %t, <2 x i64> undef, <2 x i32> <i32 0, i32 0>
857 %a = ashr <2 x i64> %v, %s
858 ret <2 x i64> %a
859}
860
861; CHECK-LABEL: shr_s_noext_v2i64:
862; NO-SIMD128-NOT: i64x2
863; SIMD128-NEXT: .functype shr_s_noext_v2i64 (v128, i64) -> (v128){{$}}
Thomas Lively6a87dda2019-01-08 06:25:55 +0000864; SIMD128-NEXT: i32.wrap_i64 $push[[L0:[0-9]+]]=, $1{{$}}
Thomas Livelyf2550e02018-09-15 00:45:31 +0000865; SIMD128-NEXT: i64x2.shr_s $push[[R:[0-9]+]]=, $0, $pop[[L0]]{{$}}
866; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Lively7663e0c2019-06-26 16:19:59 +0000867define <2 x i64> @shr_s_noext_v2i64(<2 x i64> %v, i64 %x) {
Thomas Livelyf2550e02018-09-15 00:45:31 +0000868 %t = insertelement <2 x i64> undef, i64 %x, i32 0
869 %s = shufflevector <2 x i64> %t, <2 x i64> undef, <2 x i32> <i32 0, i32 0>
870 %a = ashr <2 x i64> %v, %s
871 ret <2 x i64> %a
872}
873
Thomas Lively55735d52018-10-20 01:31:18 +0000874; CHECK-LABEL: shr_s_const_v2i64:
875; NO-SIMD128-NOT: i64x2
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000876; SIMD128-NEXT: .functype shr_s_const_v2i64 (v128) -> (v128){{$}}
Thomas Lively55735d52018-10-20 01:31:18 +0000877; SIMD128-NEXT: i32.const $push[[L0:[0-9]+]]=, 5{{$}}
878; SIMD128-NEXT: i64x2.shr_s $push[[R:[0-9]+]]=, $0, $pop[[L0]]{{$}}
879; SIMD128-NEXT: return $pop[[R]]{{$}}
880define <2 x i64> @shr_s_const_v2i64(<2 x i64> %v) {
881 %a = ashr <2 x i64> %v, <i64 5, i64 5>
882 ret <2 x i64> %a
883}
884
Thomas Livelyb2382c82018-11-02 00:39:57 +0000885; CHECK-LABEL: shr_s_vec_v2i64:
886; NO-SIMD128-NOT: i64x2
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000887; SIMD128-NEXT: .functype shr_s_vec_v2i64 (v128, v128) -> (v128){{$}}
Thomas Livelyb2382c82018-11-02 00:39:57 +0000888; SIMD128-NEXT: i64x2.extract_lane $push[[L0:[0-9]+]]=, $0, 0{{$}}
889; SIMD128-NEXT: i64x2.extract_lane $push[[L1:[0-9]+]]=, $1, 0{{$}}
890; SIMD128-NEXT: i64.shr_s $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}}
891; SIMD128-NEXT: i64x2.splat $push[[L3:[0-9]+]]=, $pop[[L2]]{{$}}
892; SIMD128-NEXT: i64x2.extract_lane $push[[L4:[0-9]+]]=, $0, 1{{$}}
893; SIMD128-NEXT: i64x2.extract_lane $push[[L5:[0-9]+]]=, $1, 1{{$}}
894; SIMD128-NEXT: i64.shr_s $push[[L6:[0-9]+]]=, $pop[[L4]], $pop[[L5]]{{$}}
895; SIMD128-NEXT: i64x2.replace_lane $push[[R:[0-9]+]]=, $pop[[L3]], 1, $pop[[L6]]{{$}}
896; SIMD128-NEXT: return $pop[[R]]{{$}}
897define <2 x i64> @shr_s_vec_v2i64(<2 x i64> %v, <2 x i64> %x) {
898 %a = ashr <2 x i64> %v, %x
899 ret <2 x i64> %a
900}
901
Thomas Livelyf2550e02018-09-15 00:45:31 +0000902; CHECK-LABEL: shr_u_v2i64:
903; NO-SIMD128-NOT: i64x2
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000904; SIMD128-NEXT: .functype shr_u_v2i64 (v128, i32) -> (v128){{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000905; SIMD128-NEXT: i64x2.shr_u $push[[R:[0-9]+]]=, $0, $1{{$}}
906; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Livelyf2550e02018-09-15 00:45:31 +0000907define <2 x i64> @shr_u_v2i64(<2 x i64> %v, i32 %x) {
908 %x2 = zext i32 %x to i64
909 %t = insertelement <2 x i64> undef, i64 %x2, i32 0
910 %s = shufflevector <2 x i64> %t, <2 x i64> undef, <2 x i32> <i32 0, i32 0>
911 %a = lshr <2 x i64> %v, %s
912 ret <2 x i64> %a
913}
914
Thomas Lively7663e0c2019-06-26 16:19:59 +0000915; CHECK-LABEL: shr_u_sext_v2i64:
Thomas Livelyf2550e02018-09-15 00:45:31 +0000916; NO-SIMD128-NOT: i64x2
Thomas Lively7663e0c2019-06-26 16:19:59 +0000917; SIMD128-NEXT: .functype shr_u_sext_v2i64 (v128, i32) -> (v128){{$}}
918; SIMD128-NEXT: i64x2.shr_u $push[[R:[0-9]+]]=, $0, $1{{$}}
919; SIMD128-NEXT: return $pop[[R]]{{$}}
920define <2 x i64> @shr_u_sext_v2i64(<2 x i64> %v, i32 %x) {
921 %x2 = sext i32 %x to i64
922 %t = insertelement <2 x i64> undef, i64 %x2, i32 0
923 %s = shufflevector <2 x i64> %t, <2 x i64> undef, <2 x i32> <i32 0, i32 0>
924 %a = lshr <2 x i64> %v, %s
925 ret <2 x i64> %a
926}
927
928; CHECK-LABEL: shr_u_noext_v2i64:
929; NO-SIMD128-NOT: i64x2
930; SIMD128-NEXT: .functype shr_u_noext_v2i64 (v128, i64) -> (v128){{$}}
Thomas Lively6a87dda2019-01-08 06:25:55 +0000931; SIMD128-NEXT: i32.wrap_i64 $push[[L0:[0-9]+]]=, $1{{$}}
Thomas Livelyf2550e02018-09-15 00:45:31 +0000932; SIMD128-NEXT: i64x2.shr_u $push[[R:[0-9]+]]=, $0, $pop[[L0]]{{$}}
933; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Lively7663e0c2019-06-26 16:19:59 +0000934define <2 x i64> @shr_u_noext_v2i64(<2 x i64> %v, i64 %x) {
Thomas Livelyf2550e02018-09-15 00:45:31 +0000935 %t = insertelement <2 x i64> undef, i64 %x, i32 0
936 %s = shufflevector <2 x i64> %t, <2 x i64> undef, <2 x i32> <i32 0, i32 0>
937 %a = lshr <2 x i64> %v, %s
938 ret <2 x i64> %a
939}
940
Thomas Lively55735d52018-10-20 01:31:18 +0000941; CHECK-LABEL: shr_u_const_v2i64:
942; NO-SIMD128-NOT: i64x2
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000943; SIMD128-NEXT: .functype shr_u_const_v2i64 (v128) -> (v128){{$}}
Thomas Lively55735d52018-10-20 01:31:18 +0000944; SIMD128-NEXT: i32.const $push[[L0:[0-9]+]]=, 5{{$}}
945; SIMD128-NEXT: i64x2.shr_u $push[[R:[0-9]+]]=, $0, $pop[[L0]]{{$}}
946; SIMD128-NEXT: return $pop[[R]]{{$}}
947define <2 x i64> @shr_u_const_v2i64(<2 x i64> %v) {
948 %a = lshr <2 x i64> %v, <i64 5, i64 5>
949 ret <2 x i64> %a
950}
951
Thomas Livelyb2382c82018-11-02 00:39:57 +0000952; CHECK-LABEL: shr_u_vec_v2i64:
953; NO-SIMD128-NOT: i64x2
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000954; SIMD128-NEXT: .functype shr_u_vec_v2i64 (v128, v128) -> (v128){{$}}
Thomas Livelyb2382c82018-11-02 00:39:57 +0000955; SIMD128-NEXT: i64x2.extract_lane $push[[L0:[0-9]+]]=, $0, 0{{$}}
956; SIMD128-NEXT: i64x2.extract_lane $push[[L1:[0-9]+]]=, $1, 0{{$}}
957; SIMD128-NEXT: i64.shr_u $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}}
958; SIMD128-NEXT: i64x2.splat $push[[L3:[0-9]+]]=, $pop[[L2]]{{$}}
959; SIMD128-NEXT: i64x2.extract_lane $push[[L4:[0-9]+]]=, $0, 1{{$}}
960; SIMD128-NEXT: i64x2.extract_lane $push[[L5:[0-9]+]]=, $1, 1{{$}}
961; SIMD128-NEXT: i64.shr_u $push[[L6:[0-9]+]]=, $pop[[L4]], $pop[[L5]]{{$}}
962; SIMD128-NEXT: i64x2.replace_lane $push[[R:[0-9]+]]=, $pop[[L3]], 1, $pop[[L6]]{{$}}
963; SIMD128-NEXT: return $pop[[R]]{{$}}
964define <2 x i64> @shr_u_vec_v2i64(<2 x i64> %v, <2 x i64> %x) {
965 %a = lshr <2 x i64> %v, %x
966 ret <2 x i64> %a
967}
968
Thomas Livelya3937b22018-09-14 21:21:42 +0000969; CHECK-LABEL: and_v2i64:
Thomas Livelyec71e012018-08-28 18:33:31 +0000970; NO-SIMD128-NOT: v128
971; SIMD128-VM-NOT: v128
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000972; SIMD128-NEXT: .functype and_v2i64 (v128, v128) -> (v128){{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000973; SIMD128-NEXT: v128.and $push[[R:[0-9]+]]=, $0, $1{{$}}
974; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Livelyc1742572018-08-23 00:48:37 +0000975define <2 x i64> @and_v2i64(<2 x i64> %x, <2 x i64> %y) {
976 %a = and <2 x i64> %x, %y
977 ret <2 x i64> %a
978}
979
Thomas Livelya3937b22018-09-14 21:21:42 +0000980; CHECK-LABEL: or_v2i64:
Thomas Livelyec71e012018-08-28 18:33:31 +0000981; NO-SIMD128-NOT: v128
982; SIMD128-VM-NOT: v128
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000983; SIMD128-NEXT: .functype or_v2i64 (v128, v128) -> (v128){{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000984; SIMD128-NEXT: v128.or $push[[R:[0-9]+]]=, $0, $1{{$}}
985; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Livelyc1742572018-08-23 00:48:37 +0000986define <2 x i64> @or_v2i64(<2 x i64> %x, <2 x i64> %y) {
987 %a = or <2 x i64> %x, %y
988 ret <2 x i64> %a
989}
990
Thomas Livelya3937b22018-09-14 21:21:42 +0000991; CHECK-LABEL: xor_v2i64:
Thomas Livelyec71e012018-08-28 18:33:31 +0000992; NO-SIMD128-NOT: v128
993; SIMD128-VM-NOT: v128
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +0000994; SIMD128-NEXT: .functype xor_v2i64 (v128, v128) -> (v128){{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +0000995; SIMD128-NEXT: v128.xor $push[[R:[0-9]+]]=, $0, $1{{$}}
996; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Livelyc1742572018-08-23 00:48:37 +0000997define <2 x i64> @xor_v2i64(<2 x i64> %x, <2 x i64> %y) {
998 %a = xor <2 x i64> %x, %y
999 ret <2 x i64> %a
1000}
1001
Thomas Livelya3937b22018-09-14 21:21:42 +00001002; CHECK-LABEL: not_v2i64:
Thomas Lively995ad612018-08-28 18:31:15 +00001003; NO-SIMD128-NOT: v128
1004; SIMD128-VM-NOT: v128
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +00001005; SIMD128-NEXT: .functype not_v2i64 (v128) -> (v128){{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +00001006; SIMD128-NEXT: v128.not $push[[R:[0-9]+]]=, $0{{$}}
1007; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Lively995ad612018-08-28 18:31:15 +00001008define <2 x i64> @not_v2i64(<2 x i64> %x) {
1009 %a = xor <2 x i64> %x, <i64 -1, i64 -1>
1010 ret <2 x i64> %a
1011}
1012
Thomas Lively3fcdd252019-09-27 02:11:40 +00001013; CHECK-LABEL: andnot_v2i64:
1014; SIMD128-VM-NOT: v128.andnot
1015; NO-SIMD128-NOT: v128
1016; SIMD128-NEXT: .functype andnot_v2i64 (v128, v128) -> (v128){{$}}
1017; SIMD128-SLOW-NEXT: v128.andnot $push[[R:[0-9]+]]=, $0, $1{{$}}
1018; SIMD128-SLOW-NEXT: return $pop[[R]]{{$}}
1019; SIMD128-FAST-NEXT: v128.not
1020; SIMD128-FAST-NEXT: v128.and
1021; SIMD128-FAST-NEXT: return
1022define <2 x i64> @andnot_v2i64(<2 x i64> %x, <2 x i64> %y) {
1023 %inv_y = xor <2 x i64> %y, <i64 -1, i64 -1>
1024 %a = and <2 x i64> %x, %inv_y
1025 ret <2 x i64> %a
1026}
1027
Thomas Lively5d461c92018-10-03 23:02:23 +00001028; CHECK-LABEL: bitselect_v2i64:
1029; NO-SIMD128-NOT: v128
1030; SIMD128-VM-NOT: v128
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +00001031; SIMD128-NEXT: .functype bitselect_v2i64 (v128, v128, v128) -> (v128){{$}}
Thomas Lively5d461c92018-10-03 23:02:23 +00001032; SIMD128-SLOW-NEXT: v128.bitselect $push[[R:[0-9]+]]=, $1, $2, $0{{$}}
1033; SIMD128-SLOW-NEXT: return $pop[[R]]{{$}}
1034; SIMD128-FAST-NEXT: v128.not
1035; SIMD128-FAST-NEXT: v128.and
1036; SIMD128-FAST-NEXT: v128.and
1037; SIMD128-FAST-NEXT: v128.or
1038; SIMD128-FAST-NEXT: return
1039define <2 x i64> @bitselect_v2i64(<2 x i64> %c, <2 x i64> %v1, <2 x i64> %v2) {
1040 %masked_v1 = and <2 x i64> %v1, %c
1041 %inv_mask = xor <2 x i64> <i64 -1, i64 -1>, %c
1042 %masked_v2 = and <2 x i64> %v2, %inv_mask
1043 %a = or <2 x i64> %masked_v2, %masked_v1
1044 ret <2 x i64> %a
1045}
1046
Derek Schuff51ed1312018-08-07 21:24:01 +00001047; ==============================================================================
Derek Schuff39bf39f2016-08-02 23:16:09 +00001048; 4 x float
1049; ==============================================================================
Thomas Lively88b74432018-09-14 22:35:12 +00001050; CHECK-LABEL: neg_v4f32:
1051; NO-SIMD128-NOT: f32x4
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +00001052; SIMD128-NEXT: .functype neg_v4f32 (v128) -> (v128){{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +00001053; SIMD128-NEXT: f32x4.neg $push[[R:[0-9]+]]=, $0{{$}}
1054; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Lively88b74432018-09-14 22:35:12 +00001055define <4 x float> @neg_v4f32(<4 x float> %x) {
Thomas Lively108e98e2018-10-10 01:09:09 +00001056 ; nsz makes this semantically equivalent to flipping sign bit
1057 %a = fsub nsz <4 x float> <float 0.0, float 0.0, float 0.0, float 0.0>, %x
Thomas Lively88b74432018-09-14 22:35:12 +00001058 ret <4 x float> %a
1059}
1060
Thomas Livelyaaf4e2c2018-09-18 21:45:12 +00001061; CHECK-LABEL: abs_v4f32:
1062; NO-SIMD128-NOT: f32x4
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +00001063; SIMD128-NEXT: .functype abs_v4f32 (v128) -> (v128){{$}}
Thomas Lively58615362018-09-24 23:42:07 +00001064; SIMD128-NEXT: f32x4.abs $push[[R:[0-9]+]]=, $0{{$}}
1065; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Livelyaaf4e2c2018-09-18 21:45:12 +00001066declare <4 x float> @llvm.fabs.v4f32(<4 x float>) nounwind readnone
1067define <4 x float> @abs_v4f32(<4 x float> %x) {
1068 %a = call <4 x float> @llvm.fabs.v4f32(<4 x float> %x)
1069 ret <4 x float> %a
1070}
1071
Thomas Lively3afc3462018-10-13 07:26:10 +00001072; CHECK-LABEL: min_unordered_v4f32:
1073; NO-SIMD128-NOT: f32x4
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +00001074; SIMD128-NEXT: .functype min_unordered_v4f32 (v128) -> (v128){{$}}
Thomas Lively3afc3462018-10-13 07:26:10 +00001075; SIMD128-NEXT: f32.const $push[[L0:[0-9]+]]=, 0x1.4p2
1076; SIMD128-NEXT: f32x4.splat $push[[L1:[0-9]+]]=, $pop[[L0]]
1077; SIMD128-NEXT: f32x4.min $push[[R:[0-9]+]]=, $0, $pop[[L1]]{{$}}
1078; SIMD128-NEXT: return $pop[[R]]{{$}}
1079define <4 x float> @min_unordered_v4f32(<4 x float> %x) {
1080 %cmps = fcmp ule <4 x float> %x, <float 5., float 5., float 5., float 5.>
1081 %a = select <4 x i1> %cmps, <4 x float> %x,
1082 <4 x float> <float 5., float 5., float 5., float 5.>
1083 ret <4 x float> %a
1084}
1085
1086; CHECK-LABEL: max_unordered_v4f32:
1087; NO-SIMD128-NOT: f32x4
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +00001088; SIMD128-NEXT: .functype max_unordered_v4f32 (v128) -> (v128){{$}}
Thomas Lively3afc3462018-10-13 07:26:10 +00001089; SIMD128-NEXT: f32.const $push[[L0:[0-9]+]]=, 0x1.4p2
1090; SIMD128-NEXT: f32x4.splat $push[[L1:[0-9]+]]=, $pop[[L0]]
1091; SIMD128-NEXT: f32x4.max $push[[R:[0-9]+]]=, $0, $pop[[L1]]{{$}}
1092; SIMD128-NEXT: return $pop[[R]]{{$}}
1093define <4 x float> @max_unordered_v4f32(<4 x float> %x) {
1094 %cmps = fcmp uge <4 x float> %x, <float 5., float 5., float 5., float 5.>
1095 %a = select <4 x i1> %cmps, <4 x float> %x,
1096 <4 x float> <float 5., float 5., float 5., float 5.>
1097 ret <4 x float> %a
1098}
1099
1100; CHECK-LABEL: min_ordered_v4f32:
1101; NO-SIMD128-NOT: f32x4
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +00001102; SIMD128-NEXT: .functype min_ordered_v4f32 (v128) -> (v128){{$}}
Thomas Lively3afc3462018-10-13 07:26:10 +00001103; SIMD128-NEXT: f32.const $push[[L0:[0-9]+]]=, 0x1.4p2
1104; SIMD128-NEXT: f32x4.splat $push[[L1:[0-9]+]]=, $pop[[L0]]
Thomas Lively43bc4622018-10-24 22:18:54 +00001105; SIMD128-NEXT: f32x4.min $push[[R:[0-9]+]]=, $0, $pop[[L1]]{{$}}
Thomas Lively3afc3462018-10-13 07:26:10 +00001106; SIMD128-NEXT: return $pop[[R]]{{$}}
1107define <4 x float> @min_ordered_v4f32(<4 x float> %x) {
1108 %cmps = fcmp ole <4 x float> <float 5., float 5., float 5., float 5.>, %x
1109 %a = select <4 x i1> %cmps,
1110 <4 x float> <float 5., float 5., float 5., float 5.>, <4 x float> %x
1111 ret <4 x float> %a
1112}
1113
1114; CHECK-LABEL: max_ordered_v4f32:
1115; NO-SIMD128-NOT: f32x4
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +00001116; SIMD128-NEXT: .functype max_ordered_v4f32 (v128) -> (v128){{$}}
Thomas Lively3afc3462018-10-13 07:26:10 +00001117; SIMD128-NEXT: f32.const $push[[L0:[0-9]+]]=, 0x1.4p2
1118; SIMD128-NEXT: f32x4.splat $push[[L1:[0-9]+]]=, $pop[[L0]]
Thomas Lively43bc4622018-10-24 22:18:54 +00001119; SIMD128-NEXT: f32x4.max $push[[R:[0-9]+]]=, $0, $pop[[L1]]{{$}}
Thomas Lively3afc3462018-10-13 07:26:10 +00001120; SIMD128-NEXT: return $pop[[R]]{{$}}
1121define <4 x float> @max_ordered_v4f32(<4 x float> %x) {
1122 %cmps = fcmp oge <4 x float> <float 5., float 5., float 5., float 5.>, %x
1123 %a = select <4 x i1> %cmps,
1124 <4 x float> <float 5., float 5., float 5., float 5.>, <4 x float> %x
1125 ret <4 x float> %a
1126}
1127
1128; CHECK-LABEL: min_intrinsic_v4f32:
1129; NO-SIMD128-NOT: f32x4
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +00001130; SIMD128-NEXT: .functype min_intrinsic_v4f32 (v128, v128) -> (v128){{$}}
Thomas Lively3afc3462018-10-13 07:26:10 +00001131; SIMD128-NEXT: f32x4.min $push[[R:[0-9]+]]=, $0, $1{{$}}
1132; SIMD128-NEXT: return $pop[[R]]{{$}}
1133declare <4 x float> @llvm.minimum.v4f32(<4 x float>, <4 x float>)
1134define <4 x float> @min_intrinsic_v4f32(<4 x float> %x, <4 x float> %y) {
1135 %a = call <4 x float> @llvm.minimum.v4f32(<4 x float> %x, <4 x float> %y)
1136 ret <4 x float> %a
1137}
1138
Benjamin Kramered13fef2019-07-01 11:00:23 +00001139; CHECK-LABEL: minnum_intrinsic_v4f32:
1140; NO-SIMD128-NOT: f32x4
1141; SIMD128-NEXT: .functype minnum_intrinsic_v4f32 (v128, v128) -> (v128){{$}}
1142; SIMD128-NEXT: f32x4.min $push[[R:[0-9]+]]=, $0, $1{{$}}
1143; SIMD128-NEXT: return $pop[[R]]{{$}}
1144declare <4 x float> @llvm.minnum.v4f32(<4 x float>, <4 x float>)
1145define <4 x float> @minnum_intrinsic_v4f32(<4 x float> %x, <4 x float> %y) {
1146 %a = call nnan <4 x float> @llvm.minnum.v4f32(<4 x float> %x, <4 x float> %y)
1147 ret <4 x float> %a
1148}
1149
Thomas Lively3afc3462018-10-13 07:26:10 +00001150; CHECK-LABEL: max_intrinsic_v4f32:
1151; NO-SIMD128-NOT: f32x4
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +00001152; SIMD128-NEXT: .functype max_intrinsic_v4f32 (v128, v128) -> (v128){{$}}
Thomas Lively3afc3462018-10-13 07:26:10 +00001153; SIMD128-NEXT: f32x4.max $push[[R:[0-9]+]]=, $0, $1{{$}}
1154; SIMD128-NEXT: return $pop[[R]]{{$}}
1155declare <4 x float> @llvm.maximum.v4f32(<4 x float>, <4 x float>)
1156define <4 x float> @max_intrinsic_v4f32(<4 x float> %x, <4 x float> %y) {
1157 %a = call <4 x float> @llvm.maximum.v4f32(<4 x float> %x, <4 x float> %y)
1158 ret <4 x float> %a
1159}
1160
Benjamin Kramered13fef2019-07-01 11:00:23 +00001161; CHECK-LABEL: maxnum_intrinsic_v4f32:
1162; NO-SIMD128-NOT: f32x4
1163; SIMD128-NEXT: .functype maxnum_intrinsic_v4f32 (v128, v128) -> (v128){{$}}
1164; SIMD128-NEXT: f32x4.max $push[[R:[0-9]+]]=, $0, $1{{$}}
1165; SIMD128-NEXT: return $pop[[R]]{{$}}
1166declare <4 x float> @llvm.maxnum.v4f32(<4 x float>, <4 x float>)
1167define <4 x float> @maxnum_intrinsic_v4f32(<4 x float> %x, <4 x float> %y) {
1168 %a = call nnan <4 x float> @llvm.maxnum.v4f32(<4 x float> %x, <4 x float> %y)
1169 ret <4 x float> %a
1170}
1171
Thomas Lively43bc4622018-10-24 22:18:54 +00001172; CHECK-LABEL: min_const_intrinsic_v4f32:
1173; NO-SIMD128-NOT: f32x4
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +00001174; SIMD128-NEXT: .functype min_const_intrinsic_v4f32 () -> (v128){{$}}
Thomas Lively43bc4622018-10-24 22:18:54 +00001175; SIMD128-NEXT: f32.const $push[[L:[0-9]+]]=, 0x1.4p2{{$}}
1176; SIMD128-NEXT: f32x4.splat $push[[R:[0-9]+]]=, $pop[[L]]{{$}}
1177; SIMD128-NEXT: return $pop[[R]]{{$}}
1178define <4 x float> @min_const_intrinsic_v4f32() {
1179 %a = call <4 x float> @llvm.minimum.v4f32(
1180 <4 x float> <float 42., float 42., float 42., float 42.>,
1181 <4 x float> <float 5., float 5., float 5., float 5.>
1182 )
1183 ret <4 x float> %a
1184}
1185
1186; CHECK-LABEL: max_const_intrinsic_v4f32:
1187; NO-SIMD128-NOT: f32x4
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +00001188; SIMD128-NEXT: .functype max_const_intrinsic_v4f32 () -> (v128){{$}}
Thomas Lively43bc4622018-10-24 22:18:54 +00001189; SIMD128-NEXT: f32.const $push[[L:[0-9]+]]=, 0x1.5p5{{$}}
1190; SIMD128-NEXT: f32x4.splat $push[[R:[0-9]+]]=, $pop[[L]]{{$}}
1191; SIMD128-NEXT: return $pop[[R]]{{$}}
1192define <4 x float> @max_const_intrinsic_v4f32() {
1193 %a = call <4 x float> @llvm.maximum.v4f32(
1194 <4 x float> <float 42., float 42., float 42., float 42.>,
1195 <4 x float> <float 5., float 5., float 5., float 5.>
1196 )
1197 ret <4 x float> %a
1198}
1199
Thomas Livelya3937b22018-09-14 21:21:42 +00001200; CHECK-LABEL: add_v4f32:
Derek Schuff39bf39f2016-08-02 23:16:09 +00001201; NO-SIMD128-NOT: f32x4
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +00001202; SIMD128-NEXT: .functype add_v4f32 (v128, v128) -> (v128){{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +00001203; SIMD128-NEXT: f32x4.add $push[[R:[0-9]+]]=, $0, $1{{$}}
1204; SIMD128-NEXT: return $pop[[R]]{{$}}
Derek Schuff39bf39f2016-08-02 23:16:09 +00001205define <4 x float> @add_v4f32(<4 x float> %x, <4 x float> %y) {
1206 %a = fadd <4 x float> %x, %y
1207 ret <4 x float> %a
1208}
1209
Thomas Livelya3937b22018-09-14 21:21:42 +00001210; CHECK-LABEL: sub_v4f32:
Derek Schuff39bf39f2016-08-02 23:16:09 +00001211; NO-SIMD128-NOT: f32x4
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +00001212; SIMD128-NEXT: .functype sub_v4f32 (v128, v128) -> (v128){{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +00001213; SIMD128-NEXT: f32x4.sub $push[[R:[0-9]+]]=, $0, $1{{$}}
1214; SIMD128-NEXT: return $pop[[R]]{{$}}
Derek Schuff39bf39f2016-08-02 23:16:09 +00001215define <4 x float> @sub_v4f32(<4 x float> %x, <4 x float> %y) {
1216 %a = fsub <4 x float> %x, %y
1217 ret <4 x float> %a
1218}
1219
Thomas Livelya3937b22018-09-14 21:21:42 +00001220; CHECK-LABEL: div_v4f32:
Derek Schuff51ed1312018-08-07 21:24:01 +00001221; NO-SIMD128-NOT: f32x4
Thomas Lively8dbf29af2018-12-20 02:10:22 +00001222; SIMD128-VM-NOT: f32x4.div
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +00001223; SIMD128-NEXT: .functype div_v4f32 (v128, v128) -> (v128){{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +00001224; SIMD128-NEXT: f32x4.div $push[[R:[0-9]+]]=, $0, $1{{$}}
1225; SIMD128-NEXT: return $pop[[R]]{{$}}
Derek Schuff51ed1312018-08-07 21:24:01 +00001226define <4 x float> @div_v4f32(<4 x float> %x, <4 x float> %y) {
1227 %a = fdiv <4 x float> %x, %y
1228 ret <4 x float> %a
1229}
1230
Thomas Livelya3937b22018-09-14 21:21:42 +00001231; CHECK-LABEL: mul_v4f32:
Derek Schuff39bf39f2016-08-02 23:16:09 +00001232; NO-SIMD128-NOT: f32x4
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +00001233; SIMD128-NEXT: .functype mul_v4f32 (v128, v128) -> (v128){{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +00001234; SIMD128-NEXT: f32x4.mul $push[[R:[0-9]+]]=, $0, $1{{$}}
1235; SIMD128-NEXT: return $pop[[R]]{{$}}
Derek Schuff39bf39f2016-08-02 23:16:09 +00001236define <4 x float> @mul_v4f32(<4 x float> %x, <4 x float> %y) {
1237 %a = fmul <4 x float> %x, %y
1238 ret <4 x float> %a
1239}
1240
Thomas Lively12da0f92018-09-25 03:39:28 +00001241; CHECK-LABEL: sqrt_v4f32:
1242; NO-SIMD128-NOT: f32x4
Thomas Lively8dbf29af2018-12-20 02:10:22 +00001243; SIMD128-VM-NOT: f32x4.sqrt
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +00001244; SIMD128-NEXT: .functype sqrt_v4f32 (v128) -> (v128){{$}}
Thomas Lively12da0f92018-09-25 03:39:28 +00001245; SIMD128-NEXT: f32x4.sqrt $push[[R:[0-9]+]]=, $0{{$}}
1246; SIMD128-NEXT: return $pop[[R]]{{$}}
1247declare <4 x float> @llvm.sqrt.v4f32(<4 x float> %x)
1248define <4 x float> @sqrt_v4f32(<4 x float> %x) {
1249 %a = call <4 x float> @llvm.sqrt.v4f32(<4 x float> %x)
1250 ret <4 x float> %a
1251}
1252
Derek Schuff51ed1312018-08-07 21:24:01 +00001253; ==============================================================================
1254; 2 x double
1255; ==============================================================================
Thomas Lively88b74432018-09-14 22:35:12 +00001256; CHECK-LABEL: neg_v2f64:
1257; NO-SIMD128-NOT: f64x2
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +00001258; SIMD128-NEXT: .functype neg_v2f64 (v128) -> (v128){{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +00001259; SIMD128-NEXT: f64x2.neg $push[[R:[0-9]+]]=, $0{{$}}
1260; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Lively88b74432018-09-14 22:35:12 +00001261define <2 x double> @neg_v2f64(<2 x double> %x) {
Thomas Lively108e98e2018-10-10 01:09:09 +00001262 ; nsz makes this semantically equivalent to flipping sign bit
1263 %a = fsub nsz <2 x double> <double 0., double 0.>, %x
Thomas Lively88b74432018-09-14 22:35:12 +00001264 ret <2 x double> %a
1265}
1266
Thomas Livelyaaf4e2c2018-09-18 21:45:12 +00001267; CHECK-LABEL: abs_v2f64:
1268; NO-SIMD128-NOT: f64x2
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +00001269; SIMD128-NEXT: .functype abs_v2f64 (v128) -> (v128){{$}}
Thomas Lively58615362018-09-24 23:42:07 +00001270; SIMD128-NEXT: f64x2.abs $push[[R:[0-9]+]]=, $0{{$}}
1271; SIMD128-NEXT: return $pop[[R]]{{$}}
Thomas Livelyaaf4e2c2018-09-18 21:45:12 +00001272declare <2 x double> @llvm.fabs.v2f64(<2 x double>) nounwind readnone
1273define <2 x double> @abs_v2f64(<2 x double> %x) {
1274 %a = call <2 x double> @llvm.fabs.v2f64(<2 x double> %x)
1275 ret <2 x double> %a
1276}
1277
Thomas Lively3afc3462018-10-13 07:26:10 +00001278; CHECK-LABEL: min_unordered_v2f64:
1279; NO-SIMD128-NOT: f64x2
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +00001280; SIMD128-NEXT: .functype min_unordered_v2f64 (v128) -> (v128){{$}}
Thomas Lively3afc3462018-10-13 07:26:10 +00001281; SIMD128-NEXT: f64.const $push[[L0:[0-9]+]]=, 0x1.4p2
1282; SIMD128-NEXT: f64x2.splat $push[[L1:[0-9]+]]=, $pop[[L0]]
1283; SIMD128-NEXT: f64x2.min $push[[R:[0-9]+]]=, $0, $pop[[L1]]{{$}}
1284; SIMD128-NEXT: return $pop[[R]]{{$}}
1285define <2 x double> @min_unordered_v2f64(<2 x double> %x) {
1286 %cmps = fcmp ule <2 x double> %x, <double 5., double 5.>
1287 %a = select <2 x i1> %cmps, <2 x double> %x,
1288 <2 x double> <double 5., double 5.>
1289 ret <2 x double> %a
1290}
1291
1292; CHECK-LABEL: max_unordered_v2f64:
1293; NO-SIMD128-NOT: f64x2
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +00001294; SIMD128-NEXT: .functype max_unordered_v2f64 (v128) -> (v128){{$}}
Thomas Lively3afc3462018-10-13 07:26:10 +00001295; SIMD128-NEXT: f64.const $push[[L0:[0-9]+]]=, 0x1.4p2
1296; SIMD128-NEXT: f64x2.splat $push[[L1:[0-9]+]]=, $pop[[L0]]
1297; SIMD128-NEXT: f64x2.max $push[[R:[0-9]+]]=, $0, $pop[[L1]]{{$}}
1298; SIMD128-NEXT: return $pop[[R]]{{$}}
1299define <2 x double> @max_unordered_v2f64(<2 x double> %x) {
1300 %cmps = fcmp uge <2 x double> %x, <double 5., double 5.>
1301 %a = select <2 x i1> %cmps, <2 x double> %x,
1302 <2 x double> <double 5., double 5.>
1303 ret <2 x double> %a
1304}
1305
1306; CHECK-LABEL: min_ordered_v2f64:
1307; NO-SIMD128-NOT: f64x2
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +00001308; SIMD128-NEXT: .functype min_ordered_v2f64 (v128) -> (v128){{$}}
Thomas Lively3afc3462018-10-13 07:26:10 +00001309; SIMD128-NEXT: f64.const $push[[L0:[0-9]+]]=, 0x1.4p2
1310; SIMD128-NEXT: f64x2.splat $push[[L1:[0-9]+]]=, $pop[[L0]]
Thomas Lively43bc4622018-10-24 22:18:54 +00001311; SIMD128-NEXT: f64x2.min $push[[R:[0-9]+]]=, $0, $pop[[L1]]{{$}}
Thomas Lively3afc3462018-10-13 07:26:10 +00001312; SIMD128-NEXT: return $pop[[R]]{{$}}
1313define <2 x double> @min_ordered_v2f64(<2 x double> %x) {
1314 %cmps = fcmp ole <2 x double> <double 5., double 5.>, %x
1315 %a = select <2 x i1> %cmps, <2 x double> <double 5., double 5.>,
1316 <2 x double> %x
1317 ret <2 x double> %a
1318}
1319
1320; CHECK-LABEL: max_ordered_v2f64:
1321; NO-SIMD128-NOT: f64x2
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +00001322; SIMD128-NEXT: .functype max_ordered_v2f64 (v128) -> (v128){{$}}
Thomas Lively3afc3462018-10-13 07:26:10 +00001323; SIMD128-NEXT: f64.const $push[[L0:[0-9]+]]=, 0x1.4p2
1324; SIMD128-NEXT: f64x2.splat $push[[L1:[0-9]+]]=, $pop[[L0]]
Thomas Lively43bc4622018-10-24 22:18:54 +00001325; SIMD128-NEXT: f64x2.max $push[[R:[0-9]+]]=, $0, $pop[[L1]]{{$}}
Thomas Lively3afc3462018-10-13 07:26:10 +00001326; SIMD128-NEXT: return $pop[[R]]{{$}}
1327define <2 x double> @max_ordered_v2f64(<2 x double> %x) {
1328 %cmps = fcmp oge <2 x double> <double 5., double 5.>, %x
1329 %a = select <2 x i1> %cmps, <2 x double> <double 5., double 5.>,
1330 <2 x double> %x
1331 ret <2 x double> %a
1332}
1333
1334; CHECK-LABEL: min_intrinsic_v2f64:
1335; NO-SIMD128-NOT: f64x2
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +00001336; SIMD128-NEXT: .functype min_intrinsic_v2f64 (v128, v128) -> (v128){{$}}
Thomas Lively3afc3462018-10-13 07:26:10 +00001337; SIMD128-NEXT: f64x2.min $push[[R:[0-9]+]]=, $0, $1{{$}}
1338; SIMD128-NEXT: return $pop[[R]]{{$}}
1339declare <2 x double> @llvm.minimum.v2f64(<2 x double>, <2 x double>)
1340define <2 x double> @min_intrinsic_v2f64(<2 x double> %x, <2 x double> %y) {
1341 %a = call <2 x double> @llvm.minimum.v2f64(<2 x double> %x, <2 x double> %y)
1342 ret <2 x double> %a
1343}
1344
1345; CHECK-LABEL: max_intrinsic_v2f64:
1346; NO-SIMD128-NOT: f64x2
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +00001347; SIMD128-NEXT: .functype max_intrinsic_v2f64 (v128, v128) -> (v128){{$}}
Thomas Lively3afc3462018-10-13 07:26:10 +00001348; SIMD128-NEXT: f64x2.max $push[[R:[0-9]+]]=, $0, $1{{$}}
1349; SIMD128-NEXT: return $pop[[R]]{{$}}
1350declare <2 x double> @llvm.maximum.v2f64(<2 x double>, <2 x double>)
1351define <2 x double> @max_intrinsic_v2f64(<2 x double> %x, <2 x double> %y) {
1352 %a = call <2 x double> @llvm.maximum.v2f64(<2 x double> %x, <2 x double> %y)
1353 ret <2 x double> %a
1354}
1355
Thomas Lively43bc4622018-10-24 22:18:54 +00001356; CHECK-LABEL: min_const_intrinsic_v2f64:
1357; NO-SIMD128-NOT: f64x2
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +00001358; SIMD128-NEXT: .functype min_const_intrinsic_v2f64 () -> (v128){{$}}
Thomas Lively43bc4622018-10-24 22:18:54 +00001359; SIMD128-NEXT: f64.const $push[[L:[0-9]+]]=, 0x1.4p2{{$}}
1360; SIMD128-NEXT: f64x2.splat $push[[R:[0-9]+]]=, $pop[[L]]{{$}}
1361; SIMD128-NEXT: return $pop[[R]]{{$}}
1362define <2 x double> @min_const_intrinsic_v2f64() {
1363 %a = call <2 x double> @llvm.minimum.v2f64(
1364 <2 x double> <double 42., double 42.>,
1365 <2 x double> <double 5., double 5.>
1366 )
1367 ret <2 x double> %a
1368}
1369
1370; CHECK-LABEL: max_const_intrinsic_v2f64:
1371; NO-SIMD128-NOT: f64x2
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +00001372; SIMD128-NEXT: .functype max_const_intrinsic_v2f64 () -> (v128){{$}}
Thomas Lively43bc4622018-10-24 22:18:54 +00001373; SIMD128-NEXT: f64.const $push[[L:[0-9]+]]=, 0x1.5p5{{$}}
1374; SIMD128-NEXT: f64x2.splat $push[[R:[0-9]+]]=, $pop[[L]]{{$}}
1375; SIMD128-NEXT: return $pop[[R]]{{$}}
1376define <2 x double> @max_const_intrinsic_v2f64() {
1377 %a = call <2 x double> @llvm.maximum.v2f64(
1378 <2 x double> <double 42., double 42.>,
1379 <2 x double> <double 5., double 5.>
1380 )
1381 ret <2 x double> %a
1382}
1383
Thomas Livelya3937b22018-09-14 21:21:42 +00001384; CHECK-LABEL: add_v2f64:
Derek Schuff51ed1312018-08-07 21:24:01 +00001385; NO-SIMD128-NOT: f64x2
Thomas Livelya3937b22018-09-14 21:21:42 +00001386; SIMD128-VM-NOT: f62x2
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +00001387; SIMD128-NEXT: .functype add_v2f64 (v128, v128) -> (v128){{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +00001388; SIMD128-NEXT: f64x2.add $push[[R:[0-9]+]]=, $0, $1{{$}}
1389; SIMD128-NEXT: return $pop[[R]]{{$}}
Derek Schuff51ed1312018-08-07 21:24:01 +00001390define <2 x double> @add_v2f64(<2 x double> %x, <2 x double> %y) {
1391 %a = fadd <2 x double> %x, %y
1392 ret <2 x double> %a
1393}
1394
Thomas Livelya3937b22018-09-14 21:21:42 +00001395; CHECK-LABEL: sub_v2f64:
Derek Schuff51ed1312018-08-07 21:24:01 +00001396; NO-SIMD128-NOT: f64x2
Thomas Livelya3937b22018-09-14 21:21:42 +00001397; SIMD128-VM-NOT: f62x2
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +00001398; SIMD128-NEXT: .functype sub_v2f64 (v128, v128) -> (v128){{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +00001399; SIMD128-NEXT: f64x2.sub $push[[R:[0-9]+]]=, $0, $1{{$}}
1400; SIMD128-NEXT: return $pop[[R]]{{$}}
Derek Schuff51ed1312018-08-07 21:24:01 +00001401define <2 x double> @sub_v2f64(<2 x double> %x, <2 x double> %y) {
1402 %a = fsub <2 x double> %x, %y
1403 ret <2 x double> %a
1404}
1405
Thomas Livelya3937b22018-09-14 21:21:42 +00001406; CHECK-LABEL: div_v2f64:
Derek Schuff51ed1312018-08-07 21:24:01 +00001407; NO-SIMD128-NOT: f64x2
Thomas Livelya3937b22018-09-14 21:21:42 +00001408; SIMD128-VM-NOT: f62x2
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +00001409; SIMD128-NEXT: .functype div_v2f64 (v128, v128) -> (v128){{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +00001410; SIMD128-NEXT: f64x2.div $push[[R:[0-9]+]]=, $0, $1{{$}}
1411; SIMD128-NEXT: return $pop[[R]]{{$}}
Derek Schuff51ed1312018-08-07 21:24:01 +00001412define <2 x double> @div_v2f64(<2 x double> %x, <2 x double> %y) {
1413 %a = fdiv <2 x double> %x, %y
1414 ret <2 x double> %a
1415}
1416
Thomas Livelya3937b22018-09-14 21:21:42 +00001417; CHECK-LABEL: mul_v2f64:
Derek Schuff51ed1312018-08-07 21:24:01 +00001418; NO-SIMD128-NOT: f64x2
Thomas Livelya3937b22018-09-14 21:21:42 +00001419; SIMD128-VM-NOT: f62x2
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +00001420; SIMD128-NEXT: .functype mul_v2f64 (v128, v128) -> (v128){{$}}
Thomas Lively66f3dc02018-09-15 01:12:48 +00001421; SIMD128-NEXT: f64x2.mul $push[[R:[0-9]+]]=, $0, $1{{$}}
1422; SIMD128-NEXT: return $pop[[R]]{{$}}
Derek Schuff51ed1312018-08-07 21:24:01 +00001423define <2 x double> @mul_v2f64(<2 x double> %x, <2 x double> %y) {
1424 %a = fmul <2 x double> %x, %y
1425 ret <2 x double> %a
1426}
Thomas Lively12da0f92018-09-25 03:39:28 +00001427
1428; CHECK-LABEL: sqrt_v2f64:
1429; NO-SIMD128-NOT: f64x2
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +00001430; SIMD128-NEXT: .functype sqrt_v2f64 (v128) -> (v128){{$}}
Thomas Lively12da0f92018-09-25 03:39:28 +00001431; SIMD128-NEXT: f64x2.sqrt $push[[R:[0-9]+]]=, $0{{$}}
1432; SIMD128-NEXT: return $pop[[R]]{{$}}
1433declare <2 x double> @llvm.sqrt.v2f64(<2 x double> %x)
1434define <2 x double> @sqrt_v2f64(<2 x double> %x) {
1435 %a = call <2 x double> @llvm.sqrt.v2f64(<2 x double> %x)
1436 ret <2 x double> %a
1437}