1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s -mtriple=aarch64-linux-gnu | FileCheck %s --check-prefixes=CHECK,CHECK-SLOW
; RUN: llc < %s -mtriple=aarch64-linux-gnu -mattr=+alu-lsl-fast | FileCheck %s --check-prefixes=CHECK,CHECK-FAST
define i32 @testmul3(i32 noundef %x, i32 noundef %y, i32 noundef %z) {
; CHECK-SLOW-LABEL: testmul3:
; CHECK-SLOW: // %bb.0: // %entry
; CHECK-SLOW-NEXT: lsl w8, w0, #3
; CHECK-SLOW-NEXT: add w9, w8, w1
; CHECK-SLOW-NEXT: add w8, w8, w2
; CHECK-SLOW-NEXT: mul w0, w8, w9
; CHECK-SLOW-NEXT: ret
;
; CHECK-FAST-LABEL: testmul3:
; CHECK-FAST: // %bb.0: // %entry
; CHECK-FAST-NEXT: add w8, w1, w0, lsl #3
; CHECK-FAST-NEXT: add w9, w2, w0, lsl #3
; CHECK-FAST-NEXT: mul w0, w9, w8
; CHECK-FAST-NEXT: ret
entry:
%shl = shl i32 %x, 3
%add = add nsw i32 %shl, %y
%add2 = add nsw i32 %shl, %z
%mul = mul nsw i32 %add2, %add
ret i32 %mul
}
define i32 @testvar(i32 noundef %x, i32 noundef %y, i32 noundef %z, i32 %zz) {
; CHECK-LABEL: testvar:
; CHECK: // %bb.0: // %entry
; CHECK-NEXT: lsl w8, w0, w3
; CHECK-NEXT: add w9, w8, w1
; CHECK-NEXT: add w8, w8, w2
; CHECK-NEXT: mul w0, w8, w9
; CHECK-NEXT: ret
entry:
%shl = shl i32 %x, %zz
%add = add nsw i32 %shl, %y
%add2 = add nsw i32 %shl, %z
%mul = mul nsw i32 %add2, %add
ret i32 %mul
}
define i32 @testmul5(i32 noundef %x, i32 noundef %y, i32 noundef %z) {
; CHECK-LABEL: testmul5:
; CHECK: // %bb.0: // %entry
; CHECK-NEXT: lsl w8, w0, #5
; CHECK-NEXT: add w9, w8, w1
; CHECK-NEXT: add w8, w8, w2
; CHECK-NEXT: mul w0, w8, w9
; CHECK-NEXT: ret
entry:
%shl = shl i32 %x, 5
%add = add nsw i32 %shl, %y
%add2 = add nsw i32 %shl, %z
%mul = mul nsw i32 %add2, %add
ret i32 %mul
}
define i64 @testsext3(i32 noundef %x, i64 noundef %y, i64 noundef %z) {
; CHECK-LABEL: testsext3:
; CHECK: // %bb.0: // %entry
; CHECK-NEXT: // kill: def $w0 killed $w0 def $x0
; CHECK-NEXT: sbfiz x8, x0, #3, #32
; CHECK-NEXT: add x9, x8, x1
; CHECK-NEXT: add x8, x8, x2
; CHECK-NEXT: mul x0, x9, x8
; CHECK-NEXT: ret
entry:
%conv = sext i32 %x to i64
%shl = shl nsw i64 %conv, 3
%add = add nsw i64 %shl, %y
%add3 = add nsw i64 %shl, %z
%mul = mul nsw i64 %add, %add3
ret i64 %mul
}
define i64 @testzext3(i32 noundef %x, i64 noundef %y, i64 noundef %z) {
; CHECK-LABEL: testzext3:
; CHECK: // %bb.0: // %entry
; CHECK-NEXT: // kill: def $w0 killed $w0 def $x0
; CHECK-NEXT: ubfiz x8, x0, #3, #32
; CHECK-NEXT: add x9, x8, x1
; CHECK-NEXT: add x8, x8, x2
; CHECK-NEXT: mul x0, x9, x8
; CHECK-NEXT: ret
entry:
%conv = zext i32 %x to i64
%shl = shl nsw i64 %conv, 3
%add = add nsw i64 %shl, %y
%add3 = add nsw i64 %shl, %z
%mul = mul nsw i64 %add, %add3
ret i64 %mul
}
define i64 @test3sext(i32 noundef %x, i64 noundef %y, i64 noundef %z) {
; CHECK-LABEL: test3sext:
; CHECK: // %bb.0: // %entry
; CHECK-NEXT: lsl w8, w0, #3
; CHECK-NEXT: sxtw x8, w8
; CHECK-NEXT: add x9, x8, x1
; CHECK-NEXT: add x8, x8, x2
; CHECK-NEXT: mul x0, x9, x8
; CHECK-NEXT: ret
entry:
%shl = shl i32 %x, 3
%conv = sext i32 %shl to i64
%add = add nsw i64 %conv, %y
%add3 = add nsw i64 %conv, %z
%mul = mul nsw i64 %add, %add3
ret i64 %mul
}
define i64 @test3zext(i32 noundef %x, i64 noundef %y, i64 noundef %z) {
; CHECK-LABEL: test3zext:
; CHECK: // %bb.0: // %entry
; CHECK-NEXT: lsl w8, w0, #3
; CHECK-NEXT: add x9, x8, x1
; CHECK-NEXT: add x8, x8, x2
; CHECK-NEXT: mul x0, x9, x8
; CHECK-NEXT: ret
entry:
%shl = shl i32 %x, 3
%conv = zext i32 %shl to i64
%add = add nsw i64 %conv, %y
%add3 = add nsw i64 %conv, %z
%mul = mul nsw i64 %add, %add3
ret i64 %mul
}
|