xref: /llvm-project/llvm/test/Transforms/InstCombine/AArch64/sve-intrinsic-opts-unpkhi-unpklo.ll (revision acdc419c897f8a9414c7a00c8908ac32312afee2)
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt -S -passes=instcombine < %s | FileCheck %s
3
4target triple = "aarch64"
5
6define <vscale x 4 x i32> @uunpkhi_splat(i16 %a) #0 {
7; CHECK-LABEL: @uunpkhi_splat(
8; CHECK-NEXT:    [[TMP1:%.*]] = zext i16 [[A:%.*]] to i32
9; CHECK-NEXT:    [[DOTSPLATINSERT:%.*]] = insertelement <vscale x 4 x i32> poison, i32 [[TMP1]], i64 0
10; CHECK-NEXT:    [[UNPACK:%.*]] = shufflevector <vscale x 4 x i32> [[DOTSPLATINSERT]], <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
11; CHECK-NEXT:    ret <vscale x 4 x i32> [[UNPACK]]
12;
13  %splat_insert = insertelement <vscale x 8 x i16> poison, i16 %a, i32 0
14  %splat = shufflevector <vscale x 8 x i16> %splat_insert, <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
15  %unpack = tail call <vscale x 4 x i32> @llvm.aarch64.sve.uunpkhi.nxv4i32(<vscale x 8 x i16> %splat)
16  ret <vscale x 4 x i32> %unpack
17}
18
19define <vscale x 4 x i32> @uunpklo_splat(i16 %a) #0 {
20; CHECK-LABEL: @uunpklo_splat(
21; CHECK-NEXT:    [[TMP1:%.*]] = zext i16 [[A:%.*]] to i32
22; CHECK-NEXT:    [[DOTSPLATINSERT:%.*]] = insertelement <vscale x 4 x i32> poison, i32 [[TMP1]], i64 0
23; CHECK-NEXT:    [[UNPACK:%.*]] = shufflevector <vscale x 4 x i32> [[DOTSPLATINSERT]], <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
24; CHECK-NEXT:    ret <vscale x 4 x i32> [[UNPACK]]
25;
26  %splat_insert = insertelement <vscale x 8 x i16> poison, i16 %a, i32 0
27  %splat = shufflevector <vscale x 8 x i16> %splat_insert, <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
28  %unpack = tail call <vscale x 4 x i32> @llvm.aarch64.sve.uunpklo.nxv4i32(<vscale x 8 x i16> %splat)
29  ret <vscale x 4 x i32> %unpack
30}
31
32define <vscale x 4 x i32> @sunpkhi_splat(i16 %a) #0 {
33; CHECK-LABEL: @sunpkhi_splat(
34; CHECK-NEXT:    [[TMP1:%.*]] = sext i16 [[A:%.*]] to i32
35; CHECK-NEXT:    [[DOTSPLATINSERT:%.*]] = insertelement <vscale x 4 x i32> poison, i32 [[TMP1]], i64 0
36; CHECK-NEXT:    [[UNPACK:%.*]] = shufflevector <vscale x 4 x i32> [[DOTSPLATINSERT]], <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
37; CHECK-NEXT:    ret <vscale x 4 x i32> [[UNPACK]]
38;
39  %splat_insert = insertelement <vscale x 8 x i16> poison, i16 %a, i32 0
40  %splat = shufflevector <vscale x 8 x i16> %splat_insert, <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
41  %unpack = tail call <vscale x 4 x i32> @llvm.aarch64.sve.sunpkhi.nxv4i32(<vscale x 8 x i16> %splat)
42  ret <vscale x 4 x i32> %unpack
43}
44
45define <vscale x 4 x i32> @sunpklo_splat(i16 %a) #0 {
46; CHECK-LABEL: @sunpklo_splat(
47; CHECK-NEXT:    [[TMP1:%.*]] = sext i16 [[A:%.*]] to i32
48; CHECK-NEXT:    [[DOTSPLATINSERT:%.*]] = insertelement <vscale x 4 x i32> poison, i32 [[TMP1]], i64 0
49; CHECK-NEXT:    [[UNPACK:%.*]] = shufflevector <vscale x 4 x i32> [[DOTSPLATINSERT]], <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
50; CHECK-NEXT:    ret <vscale x 4 x i32> [[UNPACK]]
51;
52  %splat_insert = insertelement <vscale x 8 x i16> poison, i16 %a, i32 0
53  %splat = shufflevector <vscale x 8 x i16> %splat_insert, <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
54  %unpack = tail call <vscale x 4 x i32> @llvm.aarch64.sve.sunpklo.nxv4i32(<vscale x 8 x i16> %splat)
55  ret <vscale x 4 x i32> %unpack
56}
57
58declare <vscale x 4 x i32> @llvm.aarch64.sve.uunpkhi.nxv4i32(<vscale x 8 x i16>)
59declare <vscale x 4 x i32> @llvm.aarch64.sve.uunpklo.nxv4i32(<vscale x 8 x i16>)
60declare <vscale x 4 x i32> @llvm.aarch64.sve.sunpkhi.nxv4i32(<vscale x 8 x i16>)
61declare <vscale x 4 x i32> @llvm.aarch64.sve.sunpklo.nxv4i32(<vscale x 8 x i16>)
62
63attributes #0 = { "target-features"="+sve" }
64