Revert "Mark vastart_save_xmm_regs as changing EFLAGS"
[oota-llvm.git] / test / CodeGen / X86 / cse-add-with-overflow.ll
1 ; RUN: llc < %s -mtriple=x86_64-darwin -mcpu=generic | FileCheck %s
2 ; rdar:15661073 simple example of redundant adds
3 ;
4 ; MachineCSE should coalesce trivial subregister copies.
5 ;
6 ; The extra movl+addl should be removed during MachineCSE.
7 ; CHECK-LABEL: redundantadd
8 ; CHECK: cmpq
9 ; CHECK: movq
10 ; CHECK-NOT: movl
11 ; CHECK: addl
12 ; CHECK-NOT: addl
13 ; CHECK: ret
14
15 define i64 @redundantadd(i64* %a0, i64* %a1) {
16 entry:
17   %tmp8 = load i64* %a0, align 8
18   %tmp12 = load i64* %a1, align 8
19   %tmp13 = icmp ult i64 %tmp12, -281474976710656
20   br i1 %tmp13, label %exit1, label %body
21
22 exit1:
23   unreachable
24
25 body:
26   %tmp14 = trunc i64 %tmp8 to i32
27   %tmp15 = trunc i64 %tmp12 to i32
28   %tmp16 = tail call { i32, i1 } @llvm.sadd.with.overflow.i32(i32 %tmp14, i32 %tmp15)
29   %tmp17 = extractvalue { i32, i1 } %tmp16, 1
30   br i1 %tmp17, label %exit2, label %return
31
32 exit2:
33   unreachable
34
35 return:
36   %tmp18 = add i64 %tmp12, %tmp8
37   %tmp19 = and i64 %tmp18, 4294967295
38   %tmp20 = or i64 %tmp19, -281474976710656
39   ret i64 %tmp20
40 }
41
42 declare { i32, i1 } @llvm.sadd.with.overflow.i32(i32, i32)