Add test for demorgans law with constants
[oota-llvm.git] / test / Transforms / InstCombine / mul.ll
1 ; This test makes sure that mul instructions are properly eliminated.
2 ;
3
4 ; RUN: if as < %s | opt -instcombine | dis | grep mul
5 ; RUN: then exit 1
6 ; RUN: else exit 0
7 ; RUN: fi
8
9 implementation
10
11 int %test1(int %A) {
12         %B = mul int %A, 1
13         ret int %B
14 }
15
16 int %test2(int %A) {
17         %B = mul int %A, 2   ; Should convert to an add instruction
18         ret int %B
19 }
20
21 int %test3(int %A) {
22         %B = mul int %A, 0   ; This should disappear entirely
23         ret int %B
24 }
25
26 double %test4(double %A) {
27         %B = mul double 1.0, %A   ; This is safe for FP
28         ret double %B
29 }
30
31 int %test5(int %A) {
32         %B = mul int %A, 8
33         ret int %B
34 }
35
36 int %test6(ubyte %A) {
37         %B = mul ubyte %A, 8
38         %C = mul ubyte %B, 13
39         ret ubyte %C
40 }