1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=m68k-linux -verify-machineinstrs | FileCheck %s
4 declare i32 @printf(i8*, ...) nounwind
5 declare {i32, i1} @llvm.ssub.with.overflow.i32(i32, i32)
6 declare {i32, i1} @llvm.usub.with.overflow.i32(i32, i32)
8 @ok = internal constant [4 x i8] c"%d\0A\00"
9 @no = internal constant [4 x i8] c"no\0A\00"
11 define i1 @func1(i32 %v1, i32 %v2) nounwind {
13 ; CHECK: ; %bb.0: ; %entry
14 ; CHECK-NEXT: suba.l #12, %sp
15 ; CHECK-NEXT: move.l (16,%sp), %d0
16 ; CHECK-NEXT: sub.l (20,%sp), %d0
17 ; CHECK-NEXT: bvc .LBB0_1
18 ; CHECK-NEXT: ; %bb.2: ; %overflow
19 ; CHECK-NEXT: lea (no,%pc), %a0
20 ; CHECK-NEXT: move.l %a0, (%sp)
21 ; CHECK-NEXT: jsr printf@PLT
22 ; CHECK-NEXT: move.b #0, %d0
23 ; CHECK-NEXT: adda.l #12, %sp
25 ; CHECK-NEXT: .LBB0_1: ; %normal
26 ; CHECK-NEXT: move.l %d0, (4,%sp)
27 ; CHECK-NEXT: lea (ok,%pc), %a0
28 ; CHECK-NEXT: move.l %a0, (%sp)
29 ; CHECK-NEXT: jsr printf@PLT
30 ; CHECK-NEXT: move.b #1, %d0
31 ; CHECK-NEXT: adda.l #12, %sp
34 %t = call {i32, i1} @llvm.ssub.with.overflow.i32(i32 %v1, i32 %v2)
35 %sum = extractvalue {i32, i1} %t, 0
36 %obit = extractvalue {i32, i1} %t, 1
37 br i1 %obit, label %overflow, label %normal
40 %t1 = tail call i32 (i8*, ...) @printf( i8* getelementptr ([4 x i8], [4 x i8]* @ok, i32 0, i32 0), i32 %sum ) nounwind
44 %t2 = tail call i32 (i8*, ...) @printf( i8* getelementptr ([4 x i8], [4 x i8]* @no, i32 0, i32 0) ) nounwind
48 define i1 @func2(i32 %v1, i32 %v2) nounwind {
50 ; CHECK: ; %bb.0: ; %entry
51 ; CHECK-NEXT: suba.l #12, %sp
52 ; CHECK-NEXT: move.l (16,%sp), %d0
53 ; CHECK-NEXT: sub.l (20,%sp), %d0
54 ; CHECK-NEXT: bcc .LBB1_1
55 ; CHECK-NEXT: ; %bb.2: ; %carry
56 ; CHECK-NEXT: lea (no,%pc), %a0
57 ; CHECK-NEXT: move.l %a0, (%sp)
58 ; CHECK-NEXT: jsr printf@PLT
59 ; CHECK-NEXT: move.b #0, %d0
60 ; CHECK-NEXT: adda.l #12, %sp
62 ; CHECK-NEXT: .LBB1_1: ; %normal
63 ; CHECK-NEXT: move.l %d0, (4,%sp)
64 ; CHECK-NEXT: lea (ok,%pc), %a0
65 ; CHECK-NEXT: move.l %a0, (%sp)
66 ; CHECK-NEXT: jsr printf@PLT
67 ; CHECK-NEXT: move.b #1, %d0
68 ; CHECK-NEXT: adda.l #12, %sp
71 %t = call {i32, i1} @llvm.usub.with.overflow.i32(i32 %v1, i32 %v2)
72 %sum = extractvalue {i32, i1} %t, 0
73 %obit = extractvalue {i32, i1} %t, 1
74 br i1 %obit, label %carry, label %normal
77 %t1 = tail call i32 (i8*, ...) @printf( i8* getelementptr ([4 x i8], [4 x i8]* @ok, i32 0, i32 0), i32 %sum ) nounwind
81 %t2 = tail call i32 (i8*, ...) @printf( i8* getelementptr ([4 x i8], [4 x i8]* @no, i32 0, i32 0) ) nounwind
85 define i1 @func3(i32 %x) nounwind {
87 ; CHECK: ; %bb.0: ; %entry
88 ; CHECK-NEXT: move.l #-1, %d0
89 ; CHECK-NEXT: add.l (4,%sp), %d0
93 %t = call {i32, i1} @llvm.ssub.with.overflow.i32(i32 %x, i32 1)
94 %obit = extractvalue {i32, i1} %t, 1