1 ; RUN: opt -codegenprepare -S < %s | FileCheck %s
3 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
4 target triple = "x86_64-apple-darwin10.0.0"
7 ; CHECK: llvm.uadd.with.overflow
9 define i64 @test1(i64 %a, i64 %b) nounwind ssp {
12 %cmp = icmp ult i64 %add, %a
13 %Q = select i1 %cmp, i64 %b, i64 42
17 ; CHECK-LABEL: @test2(
18 ; CHECK: llvm.uadd.with.overflow
20 define i64 @test2(i64 %a, i64 %b) nounwind ssp {
23 %cmp = icmp ult i64 %add, %b
24 %Q = select i1 %cmp, i64 %b, i64 42
28 ; CHECK-LABEL: @test3(
29 ; CHECK: llvm.uadd.with.overflow
31 define i64 @test3(i64 %a, i64 %b) nounwind ssp {
34 %cmp = icmp ugt i64 %b, %add
35 %Q = select i1 %cmp, i64 %b, i64 42
39 ; CHECK-LABEL: @test4(
40 ; CHECK: llvm.uadd.with.overflow
44 define i64 @test4(i64 %a, i64 %b, i1 %c) nounwind ssp {
47 %cmp = icmp ugt i64 %b, %add
48 br i1 %c, label %next, label %exit
51 %Q = select i1 %cmp, i64 %b, i64 42
58 ; CHECK-LABEL: @test5(
59 ; CHECK-NOT: llvm.uadd.with.overflow
61 define i64 @test5(i64 %a, i64 %b, i64* %ptr, i1 %c) nounwind ssp {
64 store i64 %add, i64* %ptr
65 %cmp = icmp ugt i64 %b, %add
66 br i1 %c, label %next, label %exit
69 %Q = select i1 %cmp, i64 %b, i64 42