1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=powerpc64-unknown-linux-gnu | FileCheck %s --check-prefixes=PPC64
3 ; RUN: llc < %s -mtriple=powerpc-unknown-linux-gnu | FileCheck %s --check-prefixes=PPC32
5 define { i128, i8 } @muloti_test(i128 %l, i128 %r) unnamed_addr #0 {
6 ; PPC64-LABEL muloti_test:
7 ; PPC64-LABEL: muloti_test:
8 ; PPC64: # %bb.0: # %start
9 ; PPC64-NEXT: mulld 8, 5, 4
10 ; PPC64-NEXT: cmpdi 5, 3, 0
11 ; PPC64-NEXT: mulhdu. 9, 3, 6
12 ; PPC64-NEXT: mulld 3, 3, 6
13 ; PPC64-NEXT: mcrf 1, 0
14 ; PPC64-NEXT: add 3, 3, 8
15 ; PPC64-NEXT: cmpdi 5, 0
16 ; PPC64-NEXT: crnor 20, 2, 22
17 ; PPC64-NEXT: cmpldi 3, 0
18 ; PPC64-NEXT: mulhdu 8, 4, 6
19 ; PPC64-NEXT: add 3, 8, 3
20 ; PPC64-NEXT: cmpld 6, 3, 8
21 ; PPC64-NEXT: crandc 21, 24, 2
22 ; PPC64-NEXT: crorc 20, 20, 6
24 ; PPC64-NEXT: mulhdu. 5, 5, 4
25 ; PPC64-NEXT: crorc 20, 20, 2
26 ; PPC64-NEXT: crnor 20, 20, 21
27 ; PPC64-NEXT: mulld 4, 4, 6
28 ; PPC64-NEXT: bc 12, 20, .LBB0_2
29 ; PPC64-NEXT: # %bb.1: # %start
30 ; PPC64-NEXT: ori 5, 7, 0
32 ; PPC64-NEXT: .LBB0_2: # %start
33 ; PPC64-NEXT: addi 5, 0, 0
36 ; PPC32-LABEL: muloti_test:
37 ; PPC32: # %bb.0: # %start
39 ; PPC32-NEXT: stw 0, 4(1)
40 ; PPC32-NEXT: stwu 1, -80(1)
41 ; PPC32-NEXT: stw 26, 56(1) # 4-byte Folded Spill
42 ; PPC32-NEXT: stw 27, 60(1) # 4-byte Folded Spill
43 ; PPC32-NEXT: stw 29, 68(1) # 4-byte Folded Spill
44 ; PPC32-NEXT: stw 30, 72(1) # 4-byte Folded Spill
46 ; PPC32-NEXT: mr 30, 8
47 ; PPC32-NEXT: mr 29, 7
48 ; PPC32-NEXT: mr 27, 4
49 ; PPC32-NEXT: mr 26, 3
54 ; PPC32-NEXT: stw 20, 32(1) # 4-byte Folded Spill
55 ; PPC32-NEXT: stw 21, 36(1) # 4-byte Folded Spill
56 ; PPC32-NEXT: stw 22, 40(1) # 4-byte Folded Spill
57 ; PPC32-NEXT: stw 23, 44(1) # 4-byte Folded Spill
58 ; PPC32-NEXT: stw 24, 48(1) # 4-byte Folded Spill
59 ; PPC32-NEXT: stw 25, 52(1) # 4-byte Folded Spill
60 ; PPC32-NEXT: stw 28, 64(1) # 4-byte Folded Spill
61 ; PPC32-NEXT: mr 25, 10
62 ; PPC32-NEXT: stw 12, 28(1)
63 ; PPC32-NEXT: mr 28, 9
64 ; PPC32-NEXT: mr 23, 6
65 ; PPC32-NEXT: mr 24, 5
66 ; PPC32-NEXT: bl __multi3@PLT
68 ; PPC32-NEXT: mullw 4, 24, 30
69 ; PPC32-NEXT: mullw 8, 29, 23
70 ; PPC32-NEXT: mullw 10, 28, 27
71 ; PPC32-NEXT: mullw 11, 26, 25
72 ; PPC32-NEXT: mulhwu 9, 30, 23
73 ; PPC32-NEXT: mulhwu 12, 27, 25
74 ; PPC32-NEXT: mullw 0, 30, 23
75 ; PPC32-NEXT: mullw 22, 27, 25
76 ; PPC32-NEXT: add 21, 8, 4
77 ; PPC32-NEXT: add 10, 11, 10
78 ; PPC32-NEXT: addc 4, 22, 0
79 ; PPC32-NEXT: add 11, 9, 21
80 ; PPC32-NEXT: add 0, 12, 10
81 ; PPC32-NEXT: adde 8, 0, 11
82 ; PPC32-NEXT: addc 4, 7, 4
83 ; PPC32-NEXT: adde 8, 3, 8
84 ; PPC32-NEXT: xor 22, 4, 7
85 ; PPC32-NEXT: xor 20, 8, 3
86 ; PPC32-NEXT: or. 22, 22, 20
87 ; PPC32-NEXT: mcrf 1, 0
88 ; PPC32-NEXT: cmpwi 29, 0
89 ; PPC32-NEXT: cmpwi 5, 24, 0
90 ; PPC32-NEXT: cmpwi 6, 26, 0
91 ; PPC32-NEXT: cmpwi 7, 28, 0
92 ; PPC32-NEXT: crnor 8, 22, 2
93 ; PPC32-NEXT: mulhwu. 23, 29, 23
94 ; PPC32-NEXT: crnor 9, 30, 26
95 ; PPC32-NEXT: mcrf 5, 0
96 ; PPC32-NEXT: cmplwi 21, 0
97 ; PPC32-NEXT: cmplw 6, 11, 9
98 ; PPC32-NEXT: cmplwi 7, 10, 0
99 ; PPC32-NEXT: crandc 10, 24, 2
100 ; PPC32-NEXT: cmplw 3, 0, 12
101 ; PPC32-NEXT: mulhwu. 9, 24, 30
102 ; PPC32-NEXT: mcrf 6, 0
103 ; PPC32-NEXT: crandc 11, 12, 30
104 ; PPC32-NEXT: cmplw 4, 7
105 ; PPC32-NEXT: cmplw 7, 8, 3
106 ; PPC32-NEXT: crand 12, 30, 0
107 ; PPC32-NEXT: crandc 13, 28, 30
108 ; PPC32-NEXT: mulhwu. 3, 26, 25
109 ; PPC32-NEXT: mcrf 7, 0
110 ; PPC32-NEXT: cror 0, 12, 13
111 ; PPC32-NEXT: crandc 12, 0, 6
112 ; PPC32-NEXT: crorc 20, 8, 22
113 ; PPC32-NEXT: crorc 20, 20, 26
114 ; PPC32-NEXT: mulhwu. 3, 28, 27
115 ; PPC32-NEXT: mcrf 1, 0
116 ; PPC32-NEXT: crorc 25, 9, 30
117 ; PPC32-NEXT: or. 3, 27, 26
118 ; PPC32-NEXT: cror 24, 20, 10
119 ; PPC32-NEXT: mcrf 5, 0
120 ; PPC32-NEXT: crorc 25, 25, 6
121 ; PPC32-NEXT: or. 3, 30, 29
122 ; PPC32-NEXT: cror 25, 25, 11
123 ; PPC32-NEXT: crnor 20, 2, 22
124 ; PPC32-NEXT: lwz 12, 28(1)
125 ; PPC32-NEXT: cror 20, 20, 25
126 ; PPC32-NEXT: cror 20, 20, 24
127 ; PPC32-NEXT: crnor 20, 20, 12
128 ; PPC32-NEXT: li 3, 1
129 ; PPC32-NEXT: bc 12, 20, .LBB0_2
130 ; PPC32-NEXT: # %bb.1: # %start
131 ; PPC32-NEXT: ori 7, 3, 0
132 ; PPC32-NEXT: b .LBB0_3
133 ; PPC32-NEXT: .LBB0_2: # %start
134 ; PPC32-NEXT: addi 7, 0, 0
135 ; PPC32-NEXT: .LBB0_3: # %start
136 ; PPC32-NEXT: mr 3, 8
137 ; PPC32-NEXT: mtcrf 32, 12 # cr2
138 ; PPC32-NEXT: mtcrf 16, 12 # cr3
139 ; PPC32-NEXT: lwz 30, 72(1) # 4-byte Folded Reload
140 ; PPC32-NEXT: lwz 29, 68(1) # 4-byte Folded Reload
141 ; PPC32-NEXT: lwz 28, 64(1) # 4-byte Folded Reload
142 ; PPC32-NEXT: lwz 27, 60(1) # 4-byte Folded Reload
143 ; PPC32-NEXT: lwz 26, 56(1) # 4-byte Folded Reload
144 ; PPC32-NEXT: lwz 25, 52(1) # 4-byte Folded Reload
145 ; PPC32-NEXT: lwz 24, 48(1) # 4-byte Folded Reload
146 ; PPC32-NEXT: lwz 23, 44(1) # 4-byte Folded Reload
147 ; PPC32-NEXT: lwz 22, 40(1) # 4-byte Folded Reload
148 ; PPC32-NEXT: lwz 21, 36(1) # 4-byte Folded Reload
149 ; PPC32-NEXT: lwz 20, 32(1) # 4-byte Folded Reload
150 ; PPC32-NEXT: lwz 0, 84(1)
151 ; PPC32-NEXT: addi 1, 1, 80
154 ; PPC32-LABEL muloti_test:
156 %0 = tail call { i128, i1 } @llvm.umul.with.overflow.i128(i128 %l, i128 %r) #2
157 %1 = extractvalue { i128, i1 } %0, 0
158 %2 = extractvalue { i128, i1 } %0, 1
159 %3 = zext i1 %2 to i8
160 %4 = insertvalue { i128, i8 } undef, i128 %1, 0
161 %5 = insertvalue { i128, i8 } %4, i8 %3, 1
165 ; Function Attrs: nounwind readnone speculatable
166 declare { i128, i1 } @llvm.umul.with.overflow.i128(i128, i128) #1
168 attributes #0 = { nounwind readnone }
169 attributes #1 = { nounwind readnone speculatable }
170 attributes #2 = { nounwind }