7c59e2d9b8b8fdfcf829cae7ce783062034dfe4c
[oota-llvm.git] / test / Transforms / InstCombine / cast-mul-select.ll
1 ; RUN: opt < %s -instcombine -S | notcast
2
3 define i32 @mul(i32 %x, i32 %y) {
4   %A = trunc i32 %x to i8
5   %B = trunc i32 %y to i8
6   %C = mul i8 %A, %B
7   %D = zext i8 %C to i32
8   ret i32 %D
9 }
10
11 define i32 @select1(i1 %cond, i32 %x, i32 %y, i32 %z) {
12   %A = trunc i32 %x to i8
13   %B = trunc i32 %y to i8
14   %C = trunc i32 %z to i8
15   %D = add i8 %A, %B
16   %E = select i1 %cond, i8 %C, i8 %D
17   %F = zext i8 %E to i32
18   ret i32 %F
19 }
20
21 define i8 @select2(i1 %cond, i8 %x, i8 %y, i8 %z) {
22   %A = zext i8 %x to i32
23   %B = zext i8 %y to i32
24   %C = zext i8 %z to i32
25   %D = add i32 %A, %B
26   %E = select i1 %cond, i32 %C, i32 %D
27   %F = trunc i32 %E to i8
28   ret i8 %F
29 }