test for a variety of new transformations:
[oota-llvm.git] / test / Transforms / InstCombine / div.ll
1 ; This test makes sure that div instructions are properly eliminated.
2 ;
3
4 ; RUN: if as < %s | opt -instcombine | dis | grep div
5 ; RUN: then exit 1
6 ; RUN: else exit 0
7 ; RUN: fi
8
9 implementation
10
11 int %test1(int %A) {
12         %B = div int %A, 1
13         ret int %B
14 }
15
16 uint %test2(uint %A) {
17         %B = div uint %A, 8   ; => Shift
18         ret int %B
19 }
20
21 int %test3(int %A) {
22         %B = div int 0, %A    ; => 0, don't need to keep traps
23         ret int %B
24 }