Skip to content

Commit e2613c5

Browse files
rotaterighttru
authored andcommitted
[AArch64] add test for recursive libcall lowering; NFC
Issue #56403 (cherry picked from commit 8eddd1e)
1 parent 05c8502 commit e2613c5

File tree

1 file changed

+56
-1
lines changed

1 file changed

+56
-1
lines changed

llvm/test/CodeGen/AArch64/umulo-128-legalisation-lowering.ll

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,64 @@ start:
3030
ret { i128, i8 } %5
3131
}
3232

33-
; Function Attrs: nounwind readnone speculatable
33+
define i128 @__muloti4(i128 %0, i128 %1, i32* nocapture nonnull writeonly align 4 %2) #4 {
34+
; AARCH-LABEL: __muloti4:
35+
; AARCH: // %bb.0: // %Entry
36+
; AARCH-NEXT: str x30, [sp, #-48]! // 8-byte Folded Spill
37+
; AARCH-NEXT: stp x20, x19, [sp, #32] // 16-byte Folded Spill
38+
; AARCH-NEXT: mov x19, x4
39+
; AARCH-NEXT: str wzr, [x4]
40+
; AARCH-NEXT: add x4, sp, #8
41+
; AARCH-NEXT: stp x22, x21, [sp, #16] // 16-byte Folded Spill
42+
; AARCH-NEXT: mov x21, x3
43+
; AARCH-NEXT: mov x20, x2
44+
; AARCH-NEXT: mov x22, x1
45+
; AARCH-NEXT: str xzr, [sp, #8]
46+
; AARCH-NEXT: bl __muloti4
47+
; AARCH-NEXT: ldr x8, [sp, #8]
48+
; AARCH-NEXT: cmp x8, #0
49+
; AARCH-NEXT: cset w8, ne
50+
; AARCH-NEXT: tbz x22, #63, .LBB1_2
51+
; AARCH-NEXT: // %bb.1: // %Entry
52+
; AARCH-NEXT: eor x9, x21, #0x8000000000000000
53+
; AARCH-NEXT: orr x9, x20, x9
54+
; AARCH-NEXT: cbz x9, .LBB1_3
55+
; AARCH-NEXT: .LBB1_2: // %Else2
56+
; AARCH-NEXT: cbz w8, .LBB1_4
57+
; AARCH-NEXT: .LBB1_3: // %Then7
58+
; AARCH-NEXT: mov w8, #1
59+
; AARCH-NEXT: str w8, [x19]
60+
; AARCH-NEXT: .LBB1_4: // %Block9
61+
; AARCH-NEXT: ldp x20, x19, [sp, #32] // 16-byte Folded Reload
62+
; AARCH-NEXT: ldp x22, x21, [sp, #16] // 16-byte Folded Reload
63+
; AARCH-NEXT: ldr x30, [sp], #48 // 8-byte Folded Reload
64+
; AARCH-NEXT: ret
65+
Entry:
66+
store i32 0, i32* %2, align 4
67+
%.fr = freeze i128 %1
68+
%mul = tail call { i128, i1 } @llvm.smul.with.overflow.i128(i128 %0, i128 %.fr)
69+
%3 = icmp slt i128 %0, 0
70+
%4 = icmp eq i128 %.fr, -170141183460469231731687303715884105728
71+
%5 = and i1 %3, %4
72+
br i1 %5, label %Then7, label %Else2
73+
74+
Else2: ; preds = %Entry
75+
%mul.ov = extractvalue { i128, i1 } %mul, 1
76+
br i1 %mul.ov, label %Then7, label %Block9
77+
78+
Then7: ; preds = %Else2, %Entry
79+
store i32 1, i32* %2, align 4
80+
br label %Block9
81+
82+
Block9: ; preds = %Else2, %Then7
83+
%mul.val = extractvalue { i128, i1 } %mul, 0
84+
ret i128 %mul.val
85+
}
86+
3487
declare { i128, i1 } @llvm.umul.with.overflow.i128(i128, i128) #1
88+
declare { i128, i1 } @llvm.smul.with.overflow.i128(i128, i128) #1
3589

3690
attributes #0 = { nounwind readnone uwtable }
3791
attributes #1 = { nounwind readnone speculatable }
3892
attributes #2 = { nounwind }
93+
attributes #4 = { nounwind mustprogress nobuiltin }

0 commit comments

Comments
 (0)