1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=m68k-linux-gnu -verify-machineinstrs | FileCheck %s
4 declare {i32, i1} @llvm.umul.with.overflow.i32(i32 %a, i32 %b)
6 define i1 @a(i32 %x) nounwind {
9 ; CHECK-NEXT: suba.l #20, %sp
10 ; CHECK-NEXT: move.l #3, (12,%sp)
11 ; CHECK-NEXT: move.l #0, (8,%sp)
12 ; CHECK-NEXT: move.l (24,%sp), (4,%sp)
13 ; CHECK-NEXT: move.l #0, (%sp)
14 ; CHECK-NEXT: jsr __muldi3@PLT
15 ; CHECK-NEXT: cmpi.l #0, %d0
17 ; CHECK-NEXT: adda.l #20, %sp
19 %res = call {i32, i1} @llvm.umul.with.overflow.i32(i32 %x, i32 3)
20 %obil = extractvalue {i32, i1} %res, 1
24 define i32 @test2(i32 %a, i32 %b) nounwind readnone {
26 ; CHECK: ; %bb.0: ; %entry
27 ; CHECK-NEXT: move.l (8,%sp), %d0
28 ; CHECK-NEXT: add.l (4,%sp), %d0
29 ; CHECK-NEXT: add.l %d0, %d0
32 %tmp0 = add i32 %b, %a
33 %tmp1 = call { i32, i1 } @llvm.umul.with.overflow.i32(i32 %tmp0, i32 2)
34 %tmp2 = extractvalue { i32, i1 } %tmp1, 0
38 ; It shouldn't fallback to builtin in this scenario
39 ; Since we don't need the overflow bit here
40 define i32 @test3(i32 %a, i32 %b) nounwind readnone {
42 ; CHECK: ; %bb.0: ; %entry
43 ; CHECK-NEXT: move.l (8,%sp), %d0
44 ; CHECK-NEXT: add.l (4,%sp), %d0
45 ; CHECK-NEXT: lsl.l #2, %d0
48 %tmp0 = add i32 %b, %a
49 %tmp1 = call { i32, i1 } @llvm.umul.with.overflow.i32(i32 %tmp0, i32 4)
50 %tmp2 = extractvalue { i32, i1 } %tmp1, 0