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: # %bb.0: # %start
8 ; PPC64-NEXT: addic 8, 5, -1
9 ; PPC64-NEXT: mulhdu 9, 5, 4
10 ; PPC64-NEXT: mulld 10, 5, 4
11 ; PPC64-NEXT: subfe 5, 8, 5
12 ; PPC64-NEXT: mulld 8, 3, 6
13 ; PPC64-NEXT: add 8, 8, 10
14 ; PPC64-NEXT: addic 10, 3, -1
15 ; PPC64-NEXT: mulhdu 7, 3, 6
16 ; PPC64-NEXT: subfe 3, 10, 3
17 ; PPC64-NEXT: and 5, 3, 5
18 ; PPC64-NEXT: addic 3, 7, -1
19 ; PPC64-NEXT: subfe 7, 3, 7
20 ; PPC64-NEXT: or 5, 5, 7
21 ; PPC64-NEXT: mulhdu 10, 4, 6
22 ; PPC64-NEXT: addic 7, 9, -1
23 ; PPC64-NEXT: add 3, 10, 8
24 ; PPC64-NEXT: subfe 7, 7, 9
25 ; PPC64-NEXT: or 5, 5, 7
26 ; PPC64-NEXT: subc 7, 3, 10
27 ; PPC64-NEXT: subfe 7, 3, 3
28 ; PPC64-NEXT: neg 7, 7
29 ; PPC64-NEXT: or 5, 5, 7
30 ; PPC64-NEXT: mulld 4, 4, 6
33 ; PPC32-LABEL: muloti_test:
34 ; PPC32: # %bb.0: # %start
36 ; PPC32-NEXT: stw 0, 4(1)
37 ; PPC32-NEXT: stwu 1, -64(1)
38 ; PPC32-NEXT: stw 24, 32(1) # 4-byte Folded Spill
40 ; PPC32-NEXT: stw 26, 40(1) # 4-byte Folded Spill
41 ; PPC32-NEXT: mr 26, 7
42 ; PPC32-NEXT: stw 28, 48(1) # 4-byte Folded Spill
43 ; PPC32-NEXT: mr 28, 4
44 ; PPC32-NEXT: stw 29, 52(1) # 4-byte Folded Spill
45 ; PPC32-NEXT: mr 29, 8
46 ; PPC32-NEXT: mr 24, 3
51 ; PPC32-NEXT: stw 23, 28(1) # 4-byte Folded Spill
52 ; PPC32-NEXT: mr 23, 5
53 ; PPC32-NEXT: stw 25, 36(1) # 4-byte Folded Spill
54 ; PPC32-NEXT: mr 25, 9
55 ; PPC32-NEXT: stw 27, 44(1) # 4-byte Folded Spill
56 ; PPC32-NEXT: mr 27, 6
57 ; PPC32-NEXT: stw 30, 56(1) # 4-byte Folded Spill
58 ; PPC32-NEXT: mr 30, 10
59 ; PPC32-NEXT: stw 12, 24(1)
60 ; PPC32-NEXT: bl __multi3
61 ; PPC32-NEXT: mulhwu. 9, 26, 27
62 ; PPC32-NEXT: mfcr 9 # cr0
63 ; PPC32-NEXT: cmpwi 2, 26, 0
64 ; PPC32-NEXT: stw 9, 20(1)
65 ; PPC32-NEXT: cmpwi 3, 23, 0
66 ; PPC32-NEXT: crnor 12, 14, 10
67 ; PPC32-NEXT: cmpwi 4, 24, 0
68 ; PPC32-NEXT: mulhwu. 9, 23, 29
69 ; PPC32-NEXT: mcrf 5, 0
70 ; PPC32-NEXT: cmpwi 1, 25, 0
71 ; PPC32-NEXT: crnor 4, 6, 18
72 ; PPC32-NEXT: mulhwu. 9, 24, 30
73 ; PPC32-NEXT: mcrf 6, 0
74 ; PPC32-NEXT: mulhwu. 0, 25, 28
75 ; PPC32-NEXT: mcrf 7, 0
76 ; PPC32-NEXT: or. 0, 28, 24
77 ; PPC32-NEXT: mcrf 2, 0
78 ; PPC32-NEXT: or. 0, 29, 26
79 ; PPC32-NEXT: crnor 5, 2, 10
80 ; PPC32-NEXT: mullw 10, 26, 27
81 ; PPC32-NEXT: lwz 26, 20(1)
82 ; PPC32-NEXT: mullw 9, 23, 29
83 ; PPC32-NEXT: add 9, 10, 9
84 ; PPC32-NEXT: mtcrf 128, 26 # cr0
85 ; PPC32-NEXT: crorc 6, 12, 2
86 ; PPC32-NEXT: crorc 20, 6, 22
87 ; PPC32-NEXT: mulhwu 7, 29, 27
88 ; PPC32-NEXT: add 9, 7, 9
89 ; PPC32-NEXT: cmplw 9, 7
90 ; PPC32-NEXT: crorc 21, 4, 26
91 ; PPC32-NEXT: cror 20, 20, 0
92 ; PPC32-NEXT: crorc 21, 21, 30
93 ; PPC32-NEXT: mullw 11, 25, 28
94 ; PPC32-NEXT: mullw 12, 24, 30
95 ; PPC32-NEXT: add 10, 12, 11
96 ; PPC32-NEXT: lwz 12, 24(1)
97 ; PPC32-NEXT: lwz 26, 40(1) # 4-byte Folded Reload
98 ; PPC32-NEXT: mulhwu 8, 28, 30
99 ; PPC32-NEXT: add 10, 8, 10
100 ; PPC32-NEXT: cmplw 10, 8
101 ; PPC32-NEXT: cror 21, 21, 0
102 ; PPC32-NEXT: cror 21, 5, 21
103 ; PPC32-NEXT: cror 20, 21, 20
104 ; PPC32-NEXT: mullw 0, 29, 27
105 ; PPC32-NEXT: mtcrf 32, 12 # cr2
106 ; PPC32-NEXT: mtcrf 16, 12 # cr3
107 ; PPC32-NEXT: mtcrf 8, 12 # cr4
108 ; PPC32-NEXT: lwz 29, 52(1) # 4-byte Folded Reload
109 ; PPC32-NEXT: mullw 7, 28, 30
110 ; PPC32-NEXT: addc 7, 7, 0
111 ; PPC32-NEXT: adde 11, 10, 9
112 ; PPC32-NEXT: addc 9, 4, 7
113 ; PPC32-NEXT: adde 8, 3, 11
114 ; PPC32-NEXT: cmplw 6, 9, 4
115 ; PPC32-NEXT: cmplw 8, 3
116 ; PPC32-NEXT: crand 22, 2, 24
117 ; PPC32-NEXT: crandc 23, 0, 2
118 ; PPC32-NEXT: cror 22, 22, 23
119 ; PPC32-NEXT: crnor 20, 20, 22
120 ; PPC32-NEXT: li 3, 1
121 ; PPC32-NEXT: bc 12, 20, .LBB0_2
122 ; PPC32-NEXT: # %bb.1: # %start
123 ; PPC32-NEXT: ori 7, 3, 0
124 ; PPC32-NEXT: b .LBB0_3
125 ; PPC32-NEXT: .LBB0_2: # %start
126 ; PPC32-NEXT: li 7, 0
127 ; PPC32-NEXT: .LBB0_3: # %start
128 ; PPC32-NEXT: mr 3, 8
129 ; PPC32-NEXT: mr 4, 9
130 ; PPC32-NEXT: lwz 30, 56(1) # 4-byte Folded Reload
131 ; PPC32-NEXT: lwz 28, 48(1) # 4-byte Folded Reload
132 ; PPC32-NEXT: lwz 27, 44(1) # 4-byte Folded Reload
133 ; PPC32-NEXT: lwz 25, 36(1) # 4-byte Folded Reload
134 ; PPC32-NEXT: lwz 24, 32(1) # 4-byte Folded Reload
135 ; PPC32-NEXT: lwz 23, 28(1) # 4-byte Folded Reload
136 ; PPC32-NEXT: lwz 0, 68(1)
137 ; PPC32-NEXT: addi 1, 1, 64
141 %0 = tail call { i128, i1 } @llvm.umul.with.overflow.i128(i128 %l, i128 %r) #2
142 %1 = extractvalue { i128, i1 } %0, 0
143 %2 = extractvalue { i128, i1 } %0, 1
144 %3 = zext i1 %2 to i8
145 %4 = insertvalue { i128, i8 } undef, i128 %1, 0
146 %5 = insertvalue { i128, i8 } %4, i8 %3, 1
150 ; Function Attrs: nounwind readnone speculatable
151 declare { i128, i1 } @llvm.umul.with.overflow.i128(i128, i128) #1
153 attributes #0 = { nounwind readnone }
154 attributes #1 = { nounwind readnone speculatable }
155 attributes #2 = { nounwind }