1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=aarch64-linux-gnu < %s | FileCheck %s
8 define <vscale x 16 x i8> @smulh_i8(<vscale x 16 x i8> %a, <vscale x 16 x i8> %b) #0 {
9 ; CHECK-LABEL: smulh_i8:
11 ; CHECK-NEXT: ptrue p0.b
12 ; CHECK-NEXT: smulh z0.b, p0/m, z0.b, z1.b
14 %insert = insertelement <vscale x 16 x i16> undef, i16 8, i64 0
15 %splat = shufflevector <vscale x 16 x i16> %insert, <vscale x 16 x i16> undef, <vscale x 16 x i32> zeroinitializer
16 %1 = sext <vscale x 16 x i8> %a to <vscale x 16 x i16>
17 %2 = sext <vscale x 16 x i8> %b to <vscale x 16 x i16>
18 %mul = mul <vscale x 16 x i16> %1, %2
19 %shr = lshr <vscale x 16 x i16> %mul, %splat
20 %tr = trunc <vscale x 16 x i16> %shr to <vscale x 16 x i8>
21 ret <vscale x 16 x i8> %tr
24 define <vscale x 8 x i16> @smulh_i16(<vscale x 8 x i16> %a, <vscale x 8 x i16> %b) #0 {
25 ; CHECK-LABEL: smulh_i16:
27 ; CHECK-NEXT: ptrue p0.h
28 ; CHECK-NEXT: smulh z0.h, p0/m, z0.h, z1.h
30 %insert = insertelement <vscale x 8 x i32> undef, i32 16, i64 0
31 %splat = shufflevector <vscale x 8 x i32> %insert, <vscale x 8 x i32> undef, <vscale x 8 x i32> zeroinitializer
32 %1 = sext <vscale x 8 x i16> %a to <vscale x 8 x i32>
33 %2 = sext <vscale x 8 x i16> %b to <vscale x 8 x i32>
34 %mul = mul <vscale x 8 x i32> %1, %2
35 %shr = lshr <vscale x 8 x i32> %mul, %splat
36 %tr = trunc <vscale x 8 x i32> %shr to <vscale x 8 x i16>
37 ret <vscale x 8 x i16> %tr
40 define <vscale x 4 x i32> @smulh_i32(<vscale x 4 x i32> %a, <vscale x 4 x i32> %b) #0 {
41 ; CHECK-LABEL: smulh_i32:
43 ; CHECK-NEXT: ptrue p0.s
44 ; CHECK-NEXT: smulh z0.s, p0/m, z0.s, z1.s
46 %insert = insertelement <vscale x 4 x i64> undef, i64 32, i64 0
47 %splat = shufflevector <vscale x 4 x i64> %insert, <vscale x 4 x i64> undef, <vscale x 4 x i32> zeroinitializer
48 %1 = sext <vscale x 4 x i32> %a to <vscale x 4 x i64>
49 %2 = sext <vscale x 4 x i32> %b to <vscale x 4 x i64>
50 %mul = mul <vscale x 4 x i64> %1, %2
51 %shr = lshr <vscale x 4 x i64> %mul, %splat
52 %tr = trunc <vscale x 4 x i64> %shr to <vscale x 4 x i32>
53 ret <vscale x 4 x i32> %tr
56 define <vscale x 2 x i64> @smulh_i64(<vscale x 2 x i64> %a, <vscale x 2 x i64> %b) #0 {
57 ; CHECK-LABEL: smulh_i64:
59 ; CHECK-NEXT: ptrue p0.d
60 ; CHECK-NEXT: smulh z0.d, p0/m, z0.d, z1.d
62 %insert = insertelement <vscale x 2 x i128> undef, i128 64, i64 0
63 %splat = shufflevector <vscale x 2 x i128> %insert, <vscale x 2 x i128> undef, <vscale x 2 x i32> zeroinitializer
64 %1 = sext <vscale x 2 x i64> %a to <vscale x 2 x i128>
65 %2 = sext <vscale x 2 x i64> %b to <vscale x 2 x i128>
66 %mul = mul <vscale x 2 x i128> %1, %2
67 %shr = lshr <vscale x 2 x i128> %mul, %splat
68 %tr = trunc <vscale x 2 x i128> %shr to <vscale x 2 x i64>
69 ret <vscale x 2 x i64> %tr
76 define <vscale x 16 x i8> @umulh_i8(<vscale x 16 x i8> %a, <vscale x 16 x i8> %b) #0 {
77 ; CHECK-LABEL: umulh_i8:
79 ; CHECK-NEXT: ptrue p0.b
80 ; CHECK-NEXT: umulh z0.b, p0/m, z0.b, z1.b
82 %insert = insertelement <vscale x 16 x i16> undef, i16 8, i64 0
83 %splat = shufflevector <vscale x 16 x i16> %insert, <vscale x 16 x i16> undef, <vscale x 16 x i32> zeroinitializer
84 %1 = zext <vscale x 16 x i8> %a to <vscale x 16 x i16>
85 %2 = zext <vscale x 16 x i8> %b to <vscale x 16 x i16>
86 %mul = mul <vscale x 16 x i16> %1, %2
87 %shr = lshr <vscale x 16 x i16> %mul, %splat
88 %tr = trunc <vscale x 16 x i16> %shr to <vscale x 16 x i8>
89 ret <vscale x 16 x i8> %tr
92 define <vscale x 8 x i16> @umulh_i16(<vscale x 8 x i16> %a, <vscale x 8 x i16> %b) #0 {
93 ; CHECK-LABEL: umulh_i16:
95 ; CHECK-NEXT: ptrue p0.h
96 ; CHECK-NEXT: umulh z0.h, p0/m, z0.h, z1.h
98 %insert = insertelement <vscale x 8 x i32> undef, i32 16, i64 0
99 %splat = shufflevector <vscale x 8 x i32> %insert, <vscale x 8 x i32> undef, <vscale x 8 x i32> zeroinitializer
100 %1 = zext <vscale x 8 x i16> %a to <vscale x 8 x i32>
101 %2 = zext <vscale x 8 x i16> %b to <vscale x 8 x i32>
102 %mul = mul <vscale x 8 x i32> %1, %2
103 %shr = lshr <vscale x 8 x i32> %mul, %splat
104 %tr = trunc <vscale x 8 x i32> %shr to <vscale x 8 x i16>
105 ret <vscale x 8 x i16> %tr
108 define <vscale x 4 x i32> @umulh_i32(<vscale x 4 x i32> %a, <vscale x 4 x i32> %b) #0 {
109 ; CHECK-LABEL: umulh_i32:
111 ; CHECK-NEXT: ptrue p0.s
112 ; CHECK-NEXT: umulh z0.s, p0/m, z0.s, z1.s
114 %insert = insertelement <vscale x 4 x i64> undef, i64 32, i64 0
115 %splat = shufflevector <vscale x 4 x i64> %insert, <vscale x 4 x i64> undef, <vscale x 4 x i32> zeroinitializer
116 %1 = zext <vscale x 4 x i32> %a to <vscale x 4 x i64>
117 %2 = zext <vscale x 4 x i32> %b to <vscale x 4 x i64>
118 %mul = mul <vscale x 4 x i64> %1, %2
119 %shr = lshr <vscale x 4 x i64> %mul, %splat
120 %tr = trunc <vscale x 4 x i64> %shr to <vscale x 4 x i32>
121 ret <vscale x 4 x i32> %tr
124 define <vscale x 2 x i64> @umulh_i64(<vscale x 2 x i64> %a, <vscale x 2 x i64> %b) #0 {
125 ; CHECK-LABEL: umulh_i64:
127 ; CHECK-NEXT: ptrue p0.d
128 ; CHECK-NEXT: umulh z0.d, p0/m, z0.d, z1.d
130 %insert = insertelement <vscale x 2 x i128> undef, i128 64, i64 0
131 %splat = shufflevector <vscale x 2 x i128> %insert, <vscale x 2 x i128> undef, <vscale x 2 x i32> zeroinitializer
132 %1 = zext <vscale x 2 x i64> %a to <vscale x 2 x i128>
133 %2 = zext <vscale x 2 x i64> %b to <vscale x 2 x i128>
134 %mul = mul <vscale x 2 x i128> %1, %2
135 %shr = lshr <vscale x 2 x i128> %mul, %splat
136 %tr = trunc <vscale x 2 x i128> %shr to <vscale x 2 x i64>
137 ret <vscale x 2 x i64> %tr
140 attributes #0 = { "target-features"="+sve" }