1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=aarch64-linux-gnu | FileCheck %s
4 define i32 @func(i32 %x, i32 %y) nounwind {
7 ; CHECK-NEXT: smull x8, w0, w1
8 ; CHECK-NEXT: lsr x9, x8, #32
9 ; CHECK-NEXT: extr w0, w9, w8, #2
11 %tmp = call i32 @llvm.smul.fix.i32(i32 %x, i32 %y, i32 2)
15 define i64 @func2(i64 %x, i64 %y) {
18 ; CHECK-NEXT: mul x8, x0, x1
19 ; CHECK-NEXT: smulh x9, x0, x1
20 ; CHECK-NEXT: extr x0, x9, x8, #2
22 %tmp = call i64 @llvm.smul.fix.i64(i64 %x, i64 %y, i32 2)
26 define i4 @func3(i4 %x, i4 %y) nounwind {
29 ; CHECK-NEXT: sbfx w8, w1, #0, #4
30 ; CHECK-NEXT: sbfx w9, w0, #0, #4
31 ; CHECK-NEXT: smull x8, w9, w8
32 ; CHECK-NEXT: lsr x9, x8, #32
33 ; CHECK-NEXT: extr w0, w9, w8, #2
35 %tmp = call i4 @llvm.smul.fix.i4(i4 %x, i4 %y, i32 2)
39 ;; These result in regular integer multiplication
40 define i32 @func4(i32 %x, i32 %y) nounwind {
43 ; CHECK-NEXT: mul w0, w0, w1
45 %tmp = call i32 @llvm.smul.fix.i32(i32 %x, i32 %y, i32 0)
49 define i64 @func5(i64 %x, i64 %y) {
52 ; CHECK-NEXT: mul x0, x0, x1
54 %tmp = call i64 @llvm.smul.fix.i64(i64 %x, i64 %y, i32 0)
58 define i4 @func6(i4 %x, i4 %y) nounwind {
61 ; CHECK-NEXT: sbfx w8, w1, #0, #4
62 ; CHECK-NEXT: sbfx w9, w0, #0, #4
63 ; CHECK-NEXT: mul w0, w9, w8
65 %tmp = call i4 @llvm.smul.fix.i4(i4 %x, i4 %y, i32 0)
69 define i64 @func7(i64 %x, i64 %y) nounwind {
72 ; CHECK-NEXT: mul x8, x0, x1
73 ; CHECK-NEXT: smulh x9, x0, x1
74 ; CHECK-NEXT: extr x0, x9, x8, #32
76 %tmp = call i64 @llvm.smul.fix.i64(i64 %x, i64 %y, i32 32)
80 define i64 @func8(i64 %x, i64 %y) nounwind {
83 ; CHECK-NEXT: mul x8, x0, x1
84 ; CHECK-NEXT: smulh x9, x0, x1
85 ; CHECK-NEXT: extr x0, x9, x8, #63
87 %tmp = call i64 @llvm.smul.fix.i64(i64 %x, i64 %y, i32 63)
91 define <2 x i32> @vec(<2 x i32> %x, <2 x i32> %y) nounwind {
94 ; CHECK-NEXT: mul v0.2s, v0.2s, v1.2s
96 %tmp = call <2 x i32> @llvm.smul.fix.v2i32(<2 x i32> %x, <2 x i32> %y, i32 0)
100 define <4 x i32> @vec2(<4 x i32> %x, <4 x i32> %y) nounwind {
103 ; CHECK-NEXT: mul v0.4s, v0.4s, v1.4s
105 %tmp = call <4 x i32> @llvm.smul.fix.v4i32(<4 x i32> %x, <4 x i32> %y, i32 0)
109 define <4 x i64> @vec3(<4 x i64> %x, <4 x i64> %y) nounwind {
112 ; CHECK-NEXT: mov x8, v2.d[1]
113 ; CHECK-NEXT: mov x9, v0.d[1]
114 ; CHECK-NEXT: fmov x10, d2
115 ; CHECK-NEXT: fmov x11, d0
116 ; CHECK-NEXT: mov x14, v3.d[1]
117 ; CHECK-NEXT: mov x15, v1.d[1]
118 ; CHECK-NEXT: mul x12, x11, x10
119 ; CHECK-NEXT: mul x13, x9, x8
120 ; CHECK-NEXT: smulh x8, x9, x8
121 ; CHECK-NEXT: smulh x9, x11, x10
122 ; CHECK-NEXT: fmov x10, d3
123 ; CHECK-NEXT: fmov x11, d1
124 ; CHECK-NEXT: mul x16, x11, x10
125 ; CHECK-NEXT: extr x8, x8, x13, #32
126 ; CHECK-NEXT: smulh x10, x11, x10
127 ; CHECK-NEXT: extr x9, x9, x12, #32
128 ; CHECK-NEXT: mul x11, x15, x14
129 ; CHECK-NEXT: fmov d0, x9
130 ; CHECK-NEXT: smulh x14, x15, x14
131 ; CHECK-NEXT: extr x10, x10, x16, #32
132 ; CHECK-NEXT: mov v0.d[1], x8
133 ; CHECK-NEXT: fmov d1, x10
134 ; CHECK-NEXT: extr x11, x14, x11, #32
135 ; CHECK-NEXT: mov v1.d[1], x11
137 %tmp = call <4 x i64> @llvm.smul.fix.v4i64(<4 x i64> %x, <4 x i64> %y, i32 32)
141 define <4 x i16> @widemul(<4 x i16> %x, <4 x i16> %y) nounwind {
142 ; CHECK-LABEL: widemul:
144 ; CHECK-NEXT: smull v0.4s, v0.4h, v1.4h
145 ; CHECK-NEXT: shrn v1.4h, v0.4s, #16
146 ; CHECK-NEXT: xtn v2.4h, v0.4s
147 ; CHECK-NEXT: add v1.4h, v1.4h, v1.4h
148 ; CHECK-NEXT: shl v0.4h, v1.4h, #13
149 ; CHECK-NEXT: usra v0.4h, v2.4h, #2
151 %tmp = call <4 x i16> @llvm.smul.fix.v4i16(<4 x i16> %x, <4 x i16> %y, i32 2)