1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple aarch64-none-linux-gnu | FileCheck %s
6 define <8 x i16> @dupsext_v8i8_v8i16(i8 %src, <8 x i8> %b) {
7 ; CHECK-LABEL: dupsext_v8i8_v8i16:
8 ; CHECK: // %bb.0: // %entry
9 ; CHECK-NEXT: dup v1.8b, w0
10 ; CHECK-NEXT: smull v0.8h, v1.8b, v0.8b
13 %in = sext i8 %src to i16
14 %ext.b = sext <8 x i8> %b to <8 x i16>
15 %broadcast.splatinsert = insertelement <8 x i16> undef, i16 %in, i16 0
16 %broadcast.splat = shufflevector <8 x i16> %broadcast.splatinsert, <8 x i16> undef, <8 x i32> zeroinitializer
17 %out = mul nsw <8 x i16> %broadcast.splat, %ext.b
21 define <8 x i16> @dupzext_v8i8_v8i16(i8 %src, <8 x i8> %b) {
22 ; CHECK-LABEL: dupzext_v8i8_v8i16:
23 ; CHECK: // %bb.0: // %entry
24 ; CHECK-NEXT: dup v1.8b, w0
25 ; CHECK-NEXT: umull v0.8h, v1.8b, v0.8b
28 %in = zext i8 %src to i16
29 %ext.b = zext <8 x i8> %b to <8 x i16>
30 %broadcast.splatinsert = insertelement <8 x i16> undef, i16 %in, i16 0
31 %broadcast.splat = shufflevector <8 x i16> %broadcast.splatinsert, <8 x i16> undef, <8 x i32> zeroinitializer
32 %out = mul nuw <8 x i16> %broadcast.splat, %ext.b
36 define <4 x i32> @dupsext_v4i16_v4i32(i16 %src, <4 x i16> %b) {
37 ; CHECK-LABEL: dupsext_v4i16_v4i32:
38 ; CHECK: // %bb.0: // %entry
39 ; CHECK-NEXT: dup v1.4h, w0
40 ; CHECK-NEXT: smull v0.4s, v1.4h, v0.4h
43 %in = sext i16 %src to i32
44 %ext.b = sext <4 x i16> %b to <4 x i32>
45 %broadcast.splatinsert = insertelement <4 x i32> undef, i32 %in, i32 0
46 %broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> undef, <4 x i32> zeroinitializer
47 %out = mul nsw <4 x i32> %broadcast.splat, %ext.b
51 define <4 x i32> @dupzext_v4i16_v4i32(i16 %src, <4 x i16> %b) {
52 ; CHECK-LABEL: dupzext_v4i16_v4i32:
53 ; CHECK: // %bb.0: // %entry
54 ; CHECK-NEXT: dup v1.4h, w0
55 ; CHECK-NEXT: umull v0.4s, v1.4h, v0.4h
58 %in = zext i16 %src to i32
59 %ext.b = zext <4 x i16> %b to <4 x i32>
60 %broadcast.splatinsert = insertelement <4 x i32> undef, i32 %in, i32 0
61 %broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> undef, <4 x i32> zeroinitializer
62 %out = mul nuw <4 x i32> %broadcast.splat, %ext.b
66 define <2 x i64> @dupsext_v2i32_v2i64(i32 %src, <2 x i32> %b) {
67 ; CHECK-LABEL: dupsext_v2i32_v2i64:
68 ; CHECK: // %bb.0: // %entry
69 ; CHECK-NEXT: dup v1.2s, w0
70 ; CHECK-NEXT: smull v0.2d, v1.2s, v0.2s
73 %in = sext i32 %src to i64
74 %ext.b = sext <2 x i32> %b to <2 x i64>
75 %broadcast.splatinsert = insertelement <2 x i64> undef, i64 %in, i64 0
76 %broadcast.splat = shufflevector <2 x i64> %broadcast.splatinsert, <2 x i64> undef, <2 x i32> zeroinitializer
77 %out = mul nsw <2 x i64> %broadcast.splat, %ext.b
81 define <2 x i64> @dupzext_v2i32_v2i64(i32 %src, <2 x i32> %b) {
82 ; CHECK-LABEL: dupzext_v2i32_v2i64:
83 ; CHECK: // %bb.0: // %entry
84 ; CHECK-NEXT: dup v1.2s, w0
85 ; CHECK-NEXT: umull v0.2d, v1.2s, v0.2s
88 %in = zext i32 %src to i64
89 %ext.b = zext <2 x i32> %b to <2 x i64>
90 %broadcast.splatinsert = insertelement <2 x i64> undef, i64 %in, i64 0
91 %broadcast.splat = shufflevector <2 x i64> %broadcast.splatinsert, <2 x i64> undef, <2 x i32> zeroinitializer
92 %out = mul nuw <2 x i64> %broadcast.splat, %ext.b
96 ; Unsupported combines
98 define <2 x i16> @dupsext_v2i8_v2i16(i8 %src, <2 x i8> %b) {
99 ; CHECK-LABEL: dupsext_v2i8_v2i16:
100 ; CHECK: // %bb.0: // %entry
101 ; CHECK-NEXT: sxtb w8, w0
102 ; CHECK-NEXT: shl v0.2s, v0.2s, #24
103 ; CHECK-NEXT: sshr v0.2s, v0.2s, #24
104 ; CHECK-NEXT: dup v1.2s, w8
105 ; CHECK-NEXT: mul v0.2s, v1.2s, v0.2s
108 %in = sext i8 %src to i16
109 %ext.b = sext <2 x i8> %b to <2 x i16>
110 %broadcast.splatinsert = insertelement <2 x i16> undef, i16 %in, i16 0
111 %broadcast.splat = shufflevector <2 x i16> %broadcast.splatinsert, <2 x i16> undef, <2 x i32> zeroinitializer
112 %out = mul nsw <2 x i16> %broadcast.splat, %ext.b
116 define <2 x i64> @dupzext_v2i16_v2i64(i16 %src, <2 x i16> %b) {
117 ; CHECK-LABEL: dupzext_v2i16_v2i64:
118 ; CHECK: // %bb.0: // %entry
119 ; CHECK-NEXT: movi d1, #0x00ffff0000ffff
120 ; CHECK-NEXT: and v0.8b, v0.8b, v1.8b
121 ; CHECK-NEXT: ushll v0.2d, v0.2s, #0
122 ; CHECK-NEXT: // kill: def $w0 killed $w0 def $x0
123 ; CHECK-NEXT: and x8, x0, #0xffff
124 ; CHECK-NEXT: fmov x10, d0
125 ; CHECK-NEXT: mov x9, v0.d[1]
126 ; CHECK-NEXT: mul x10, x8, x10
127 ; CHECK-NEXT: mul x8, x8, x9
128 ; CHECK-NEXT: fmov d0, x10
129 ; CHECK-NEXT: mov v0.d[1], x8
132 %in = zext i16 %src to i64
133 %ext.b = zext <2 x i16> %b to <2 x i64>
134 %broadcast.splatinsert = insertelement <2 x i64> undef, i64 %in, i64 0
135 %broadcast.splat = shufflevector <2 x i64> %broadcast.splatinsert, <2 x i64> undef, <2 x i32> zeroinitializer
136 %out = mul nuw <2 x i64> %broadcast.splat, %ext.b
144 ; dupsext_v2i16_v2i32
145 ; dupsext_v2i16_v2i64
151 ; dupzext_v2i16_v2i32
152 ; dupzext_v2i16_v2i64
156 define <8 x i16> @nonsplat_shuffleinsert(i8 %src, <8 x i8> %b) {
157 ; CHECK-LABEL: nonsplat_shuffleinsert:
158 ; CHECK: // %bb.0: // %entry
159 ; CHECK-NEXT: sxtb w8, w0
160 ; CHECK-NEXT: sshll v0.8h, v0.8b, #0
161 ; CHECK-NEXT: dup v1.8h, w8
162 ; CHECK-NEXT: mul v0.8h, v1.8h, v0.8h
165 %in = sext i8 %src to i16
166 %ext.b = sext <8 x i8> %b to <8 x i16>
167 %broadcast.splatinsert = insertelement <8 x i16> undef, i16 %in, i16 1
168 %broadcast.splat = shufflevector <8 x i16> %broadcast.splatinsert, <8 x i16> undef, <8 x i32> <i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 0, i32 1>
169 %out = mul nsw <8 x i16> %broadcast.splat, %ext.b
173 define <8 x i16> @missing_insert(<8 x i8> %b) {
174 ; CHECK-LABEL: missing_insert:
175 ; CHECK: // %bb.0: // %entry
176 ; CHECK-NEXT: sshll v0.8h, v0.8b, #0
177 ; CHECK-NEXT: ext v1.16b, v0.16b, v0.16b, #4
178 ; CHECK-NEXT: mul v0.8h, v1.8h, v0.8h
181 %ext.b = sext <8 x i8> %b to <8 x i16>
182 %broadcast.splat = shufflevector <8 x i16> %ext.b, <8 x i16> undef, <8 x i32> <i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 0, i32 1>
183 %out = mul nsw <8 x i16> %broadcast.splat, %ext.b