New testcase
[oota-llvm.git] / test / Transforms / InstCombine / div.ll
1 ; This test makes sure that div instructions are properly eliminated.
2 ;
3
4 ; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep div
5
6 implementation
7
8 int %test1(int %A) {
9         %B = div int %A, 1
10         ret int %B
11 }
12
13 uint %test2(uint %A) {
14         %B = div uint %A, 8   ; => Shift
15         ret uint %B
16 }
17
18 int %test3(int %A) {
19         %B = div int 0, %A    ; => 0, don't need to keep traps
20         ret int %B
21 }
22
23 int %test4(int %A) {
24         %B = div int %A, -1    ; 0-A
25         ret int %B
26 }
27
28 uint %test5(uint %A) {
29         %B = div uint %A, 4294967280
30         %C = div uint %B, 4294967292
31         ret uint %C
32 }