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: smulh z0.b, z0.b, z1.b
13 %insert = insertelement <vscale x 16 x i16> undef, i16 8, i64 0
14 %splat = shufflevector <vscale x 16 x i16> %insert, <vscale x 16 x i16> undef, <vscale x 16 x i32> zeroinitializer
15 %1 = sext <vscale x 16 x i8> %a to <vscale x 16 x i16>
16 %2 = sext <vscale x 16 x i8> %b to <vscale x 16 x i16>
17 %mul = mul <vscale x 16 x i16> %1, %2
18 %shr = lshr <vscale x 16 x i16> %mul, %splat
19 %tr = trunc <vscale x 16 x i16> %shr to <vscale x 16 x i8>
20 ret <vscale x 16 x i8> %tr
23 define <vscale x 8 x i16> @smulh_i16(<vscale x 8 x i16> %a, <vscale x 8 x i16> %b) #0 {
24 ; CHECK-LABEL: smulh_i16:
26 ; CHECK-NEXT: smulh z0.h, z0.h, z1.h
28 %insert = insertelement <vscale x 8 x i32> undef, i32 16, i64 0
29 %splat = shufflevector <vscale x 8 x i32> %insert, <vscale x 8 x i32> undef, <vscale x 8 x i32> zeroinitializer
30 %1 = sext <vscale x 8 x i16> %a to <vscale x 8 x i32>
31 %2 = sext <vscale x 8 x i16> %b to <vscale x 8 x i32>
32 %mul = mul <vscale x 8 x i32> %1, %2
33 %shr = lshr <vscale x 8 x i32> %mul, %splat
34 %tr = trunc <vscale x 8 x i32> %shr to <vscale x 8 x i16>
35 ret <vscale x 8 x i16> %tr
38 define <vscale x 4 x i32> @smulh_i32(<vscale x 4 x i32> %a, <vscale x 4 x i32> %b) #0 {
39 ; CHECK-LABEL: smulh_i32:
41 ; CHECK-NEXT: smulh z0.s, z0.s, z1.s
43 %insert = insertelement <vscale x 4 x i64> undef, i64 32, i64 0
44 %splat = shufflevector <vscale x 4 x i64> %insert, <vscale x 4 x i64> undef, <vscale x 4 x i32> zeroinitializer
45 %1 = sext <vscale x 4 x i32> %a to <vscale x 4 x i64>
46 %2 = sext <vscale x 4 x i32> %b to <vscale x 4 x i64>
47 %mul = mul <vscale x 4 x i64> %1, %2
48 %shr = lshr <vscale x 4 x i64> %mul, %splat
49 %tr = trunc <vscale x 4 x i64> %shr to <vscale x 4 x i32>
50 ret <vscale x 4 x i32> %tr
53 define <vscale x 2 x i64> @smulh_i64(<vscale x 2 x i64> %a, <vscale x 2 x i64> %b) #0 {
54 ; CHECK-LABEL: smulh_i64:
56 ; CHECK-NEXT: smulh z0.d, z0.d, z1.d
58 %insert = insertelement <vscale x 2 x i128> undef, i128 64, i64 0
59 %splat = shufflevector <vscale x 2 x i128> %insert, <vscale x 2 x i128> undef, <vscale x 2 x i32> zeroinitializer
60 %1 = sext <vscale x 2 x i64> %a to <vscale x 2 x i128>
61 %2 = sext <vscale x 2 x i64> %b to <vscale x 2 x i128>
62 %mul = mul <vscale x 2 x i128> %1, %2
63 %shr = lshr <vscale x 2 x i128> %mul, %splat
64 %tr = trunc <vscale x 2 x i128> %shr to <vscale x 2 x i64>
65 ret <vscale x 2 x i64> %tr
72 define <vscale x 16 x i8> @umulh_i8(<vscale x 16 x i8> %a, <vscale x 16 x i8> %b) #0 {
73 ; CHECK-LABEL: umulh_i8:
75 ; CHECK-NEXT: umulh z0.b, z0.b, z1.b
77 %insert = insertelement <vscale x 16 x i16> undef, i16 8, i64 0
78 %splat = shufflevector <vscale x 16 x i16> %insert, <vscale x 16 x i16> undef, <vscale x 16 x i32> zeroinitializer
79 %1 = zext <vscale x 16 x i8> %a to <vscale x 16 x i16>
80 %2 = zext <vscale x 16 x i8> %b to <vscale x 16 x i16>
81 %mul = mul <vscale x 16 x i16> %1, %2
82 %shr = lshr <vscale x 16 x i16> %mul, %splat
83 %tr = trunc <vscale x 16 x i16> %shr to <vscale x 16 x i8>
84 ret <vscale x 16 x i8> %tr
87 define <vscale x 8 x i16> @umulh_i16(<vscale x 8 x i16> %a, <vscale x 8 x i16> %b) #0 {
88 ; CHECK-LABEL: umulh_i16:
90 ; CHECK-NEXT: umulh z0.h, z0.h, z1.h
92 %insert = insertelement <vscale x 8 x i32> undef, i32 16, i64 0
93 %splat = shufflevector <vscale x 8 x i32> %insert, <vscale x 8 x i32> undef, <vscale x 8 x i32> zeroinitializer
94 %1 = zext <vscale x 8 x i16> %a to <vscale x 8 x i32>
95 %2 = zext <vscale x 8 x i16> %b to <vscale x 8 x i32>
96 %mul = mul <vscale x 8 x i32> %1, %2
97 %shr = lshr <vscale x 8 x i32> %mul, %splat
98 %tr = trunc <vscale x 8 x i32> %shr to <vscale x 8 x i16>
99 ret <vscale x 8 x i16> %tr
102 define <vscale x 4 x i32> @umulh_i32(<vscale x 4 x i32> %a, <vscale x 4 x i32> %b) #0 {
103 ; CHECK-LABEL: umulh_i32:
105 ; CHECK-NEXT: umulh z0.s, z0.s, z1.s
107 %insert = insertelement <vscale x 4 x i64> undef, i64 32, i64 0
108 %splat = shufflevector <vscale x 4 x i64> %insert, <vscale x 4 x i64> undef, <vscale x 4 x i32> zeroinitializer
109 %1 = zext <vscale x 4 x i32> %a to <vscale x 4 x i64>
110 %2 = zext <vscale x 4 x i32> %b to <vscale x 4 x i64>
111 %mul = mul <vscale x 4 x i64> %1, %2
112 %shr = lshr <vscale x 4 x i64> %mul, %splat
113 %tr = trunc <vscale x 4 x i64> %shr to <vscale x 4 x i32>
114 ret <vscale x 4 x i32> %tr
117 define <vscale x 2 x i64> @umulh_i64(<vscale x 2 x i64> %a, <vscale x 2 x i64> %b) #0 {
118 ; CHECK-LABEL: umulh_i64:
120 ; CHECK-NEXT: umulh z0.d, z0.d, z1.d
122 %insert = insertelement <vscale x 2 x i128> undef, i128 64, i64 0
123 %splat = shufflevector <vscale x 2 x i128> %insert, <vscale x 2 x i128> undef, <vscale x 2 x i32> zeroinitializer
124 %1 = zext <vscale x 2 x i64> %a to <vscale x 2 x i128>
125 %2 = zext <vscale x 2 x i64> %b to <vscale x 2 x i128>
126 %mul = mul <vscale x 2 x i128> %1, %2
127 %shr = lshr <vscale x 2 x i128> %mul, %splat
128 %tr = trunc <vscale x 2 x i128> %shr to <vscale x 2 x i64>
129 ret <vscale x 2 x i64> %tr
132 attributes #0 = { "target-features"="+sve2" }