1 ; RUN: opt --mtriple=aarch64-unknown-linux -S -instcombine < %s | FileCheck %s
2 ; ARM64 neon intrinsic variants - <rdar://problem/12349617>
4 define <4 x i32> @mulByZeroARM64(<4 x i16> %x) nounwind readnone ssp {
6 %a = tail call <4 x i32> @llvm.aarch64.neon.smull.v4i32(<4 x i16> %x, <4 x i16> zeroinitializer) nounwind
9 ; CHECK-NEXT: ret <4 x i32> zeroinitializer
12 define <4 x i32> @mulByOneARM64(<4 x i16> %x) nounwind readnone ssp {
14 %a = tail call <4 x i32> @llvm.aarch64.neon.smull.v4i32(<4 x i16> %x, <4 x i16> <i16 1, i16 1, i16 1, i16 1>) nounwind
17 ; CHECK-NEXT: %a = sext <4 x i16> %x to <4 x i32>
18 ; CHECK-NEXT: ret <4 x i32> %a
21 define <4 x i32> @constantMulARM64() nounwind readnone ssp {
23 %a = tail call <4 x i32> @llvm.aarch64.neon.smull.v4i32(<4 x i16> <i16 3, i16 3, i16 3, i16 3>, <4 x i16> <i16 2, i16 2, i16 2, i16 2>) nounwind
26 ; CHECK-NEXT: ret <4 x i32> <i32 6, i32 6, i32 6, i32 6>
29 define <4 x i32> @constantMulSARM64() nounwind readnone ssp {
31 %b = tail call <4 x i32> @llvm.aarch64.neon.smull.v4i32(<4 x i16> <i16 -1, i16 -1, i16 -1, i16 -1>, <4 x i16> <i16 1, i16 1, i16 1, i16 1>) nounwind
34 ; CHECK-NEXT: ret <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>
37 define <4 x i32> @constantMulUARM64() nounwind readnone ssp {
39 %b = tail call <4 x i32> @llvm.aarch64.neon.umull.v4i32(<4 x i16> <i16 -1, i16 -1, i16 -1, i16 -1>, <4 x i16> <i16 1, i16 1, i16 1, i16 1>) nounwind
42 ; CHECK-NEXT: ret <4 x i32> <i32 65535, i32 65535, i32 65535, i32 65535>
45 define <4 x i32> @complex1ARM64(<4 x i16> %x) nounwind readnone ssp {
47 %a = tail call <4 x i32> @llvm.aarch64.neon.smull.v4i32(<4 x i16> <i16 2, i16 2, i16 2, i16 2>, <4 x i16> %x) nounwind
48 %b = add <4 x i32> zeroinitializer, %a
51 ; CHECK-NEXT: %a = tail call <4 x i32> @llvm.aarch64.neon.smull.v4i32(<4 x i16> <i16 2, i16 2, i16 2, i16 2>, <4 x i16> %x) [[NUW:#[0-9]+]]
52 ; CHECK-NEXT: ret <4 x i32> %a
55 define <4 x i32> @complex2ARM64(<4 x i32> %x) nounwind readnone ssp {
57 %a = tail call <4 x i32> @llvm.aarch64.neon.smull.v4i32(<4 x i16> <i16 3, i16 3, i16 3, i16 3>, <4 x i16> <i16 2, i16 2, i16 2, i16 2>) nounwind
58 %b = add <4 x i32> %x, %a
61 ; CHECK-NEXT: %b = add <4 x i32> %x, <i32 6, i32 6, i32 6, i32 6>
62 ; CHECK-NEXT: ret <4 x i32> %b
65 declare <4 x i32> @llvm.aarch64.neon.smull.v4i32(<4 x i16>, <4 x i16>) nounwind readnone
66 declare <4 x i32> @llvm.aarch64.neon.umull.v4i32(<4 x i16>, <4 x i16>) nounwind readnone
68 ; CHECK: attributes #0 = { nounwind readnone ssp }
69 ; CHECK: attributes #1 = { nofree nosync nounwind readnone willreturn }
70 ; CHECK: attributes [[NUW]] = { nounwind }