1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i686-linux | FileCheck %s
4 @ok = internal constant [4 x i8] c"%d\0A\00"
5 @no = internal constant [4 x i8] c"no\0A\00"
7 define i1 @func1(i32 %v1, i32 %v2) nounwind {
9 ; CHECK: # %bb.0: # %entry
10 ; CHECK-NEXT: subl $12, %esp
11 ; CHECK-NEXT: movl {{[0-9]+}}(%esp), %eax
12 ; CHECK-NEXT: subl {{[0-9]+}}(%esp), %eax
13 ; CHECK-NEXT: jno .LBB0_1
14 ; CHECK-NEXT: # %bb.2: # %overflow
15 ; CHECK-NEXT: movl $no, (%esp)
16 ; CHECK-NEXT: calll printf@PLT
17 ; CHECK-NEXT: xorl %eax, %eax
18 ; CHECK-NEXT: addl $12, %esp
20 ; CHECK-NEXT: .LBB0_1: # %normal
21 ; CHECK-NEXT: movl %eax, {{[0-9]+}}(%esp)
22 ; CHECK-NEXT: movl $ok, (%esp)
23 ; CHECK-NEXT: calll printf@PLT
24 ; CHECK-NEXT: movb $1, %al
25 ; CHECK-NEXT: addl $12, %esp
28 %t = call {i32, i1} @llvm.ssub.with.overflow.i32(i32 %v1, i32 %v2)
29 %sum = extractvalue {i32, i1} %t, 0
30 %obit = extractvalue {i32, i1} %t, 1
31 br i1 %obit, label %overflow, label %normal
34 %t1 = tail call i32 (ptr, ...) @printf( ptr @ok, i32 %sum ) nounwind
38 %t2 = tail call i32 (ptr, ...) @printf( ptr @no ) nounwind
43 define i1 @func2(i32 %v1, i32 %v2) nounwind {
45 ; CHECK: # %bb.0: # %entry
46 ; CHECK-NEXT: subl $12, %esp
47 ; CHECK-NEXT: movl {{[0-9]+}}(%esp), %eax
48 ; CHECK-NEXT: subl {{[0-9]+}}(%esp), %eax
49 ; CHECK-NEXT: jae .LBB1_1
50 ; CHECK-NEXT: # %bb.2: # %carry
51 ; CHECK-NEXT: movl $no, (%esp)
52 ; CHECK-NEXT: calll printf@PLT
53 ; CHECK-NEXT: xorl %eax, %eax
54 ; CHECK-NEXT: addl $12, %esp
56 ; CHECK-NEXT: .LBB1_1: # %normal
57 ; CHECK-NEXT: movl %eax, {{[0-9]+}}(%esp)
58 ; CHECK-NEXT: movl $ok, (%esp)
59 ; CHECK-NEXT: calll printf@PLT
60 ; CHECK-NEXT: movb $1, %al
61 ; CHECK-NEXT: addl $12, %esp
64 %t = call {i32, i1} @llvm.usub.with.overflow.i32(i32 %v1, i32 %v2)
65 %sum = extractvalue {i32, i1} %t, 0
66 %obit = extractvalue {i32, i1} %t, 1
67 br i1 %obit, label %carry, label %normal
70 %t1 = tail call i32 (ptr, ...) @printf( ptr @ok, i32 %sum ) nounwind
74 %t2 = tail call i32 (ptr, ...) @printf( ptr @no ) nounwind
79 declare i32 @printf(ptr, ...) nounwind
80 declare {i32, i1} @llvm.ssub.with.overflow.i32(i32, i32)
81 declare {i32, i1} @llvm.usub.with.overflow.i32(i32, i32)
83 define i1 @func3(i32 %x) nounwind {
85 ; CHECK: # %bb.0: # %entry
86 ; CHECK-NEXT: movl {{[0-9]+}}(%esp), %eax
87 ; CHECK-NEXT: decl %eax
88 ; CHECK-NEXT: seto %al
91 %t = call {i32, i1} @llvm.ssub.with.overflow.i32(i32 %x, i32 1)
92 %obit = extractvalue {i32, i1} %t, 1