Update Transforms tests to use CHECK-LABEL for easier debugging. No functionality...
[oota-llvm.git] / test / Transforms / InstCombine / 2008-11-20-DivMulRem.ll
1 ; RUN: opt < %s -instcombine -S | FileCheck %s
2 ; PR3103
3
4 define i8 @test1(i8 %x, i8 %y) {
5 ; CHECK-LABEL: @test1(
6   %A = udiv i8 %x, %y
7 ; CHECK-NEXT: urem
8   %B = mul i8 %A, %y
9   %C = sub i8 %x, %B
10   ret i8 %C
11 ; CHECK-NEXT: ret
12 }
13
14 define i8 @test2(i8 %x, i8 %y) {
15 ; CHECK-LABEL: @test2(
16   %A = sdiv i8 %x, %y
17 ; CHECK-NEXT: srem
18   %B = mul i8 %A, %y
19   %C = sub i8 %x, %B
20   ret i8 %C
21 ; CHECK-NEXT: ret
22 }
23
24 define i8 @test3(i8 %x, i8 %y) {
25 ; CHECK-LABEL: @test3(
26   %A = udiv i8 %x, %y
27 ; CHECK-NEXT: urem
28   %B = mul i8 %A, %y
29   %C = sub i8 %B, %x
30 ; CHECK-NEXT: sub
31   ret i8 %C
32 ; CHECK-NEXT: ret
33 }
34
35 define i8 @test4(i8 %x) {
36 ; CHECK-LABEL: @test4(
37   %A = udiv i8 %x, 3
38 ; CHECK-NEXT: urem
39   %B = mul i8 %A, -3
40 ; CHECK-NEXT: sub
41   %C = sub i8 %x, %B
42 ; CHECK-NEXT: add
43   ret i8 %C
44 ; CHECK-NEXT: ret
45 }
46
47 define i32 @test5(i32 %x, i32 %y) {
48 ; CHECK-LABEL: @test5(
49 ; (((X / Y) * Y) / Y) -> X / Y
50   %div = sdiv i32 %x, %y
51 ; CHECK-NEXT: sdiv
52   %mul = mul i32 %div, %y
53   %r = sdiv i32 %mul, %y
54   ret i32 %r
55 ; CHECK-NEXT: ret
56 }
57
58 define i32 @test6(i32 %x, i32 %y) {
59 ; CHECK-LABEL: @test6(
60 ; (((X / Y) * Y) / Y) -> X / Y
61   %div = udiv i32 %x, %y
62 ; CHECK-NEXT: udiv
63   %mul = mul i32 %div, %y
64   %r = udiv i32 %mul, %y
65   ret i32 %r
66 ; CHECK-NEXT: ret
67 }