Convert the rest of the InstCombine tests from notcast to FileCheck.
[oota-llvm.git] / test / Transforms / InstCombine / cast-mul-select.ll
1 ; RUN: opt < %s -instcombine -S | FileCheck %s
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 ; CHECK: %C = mul i32 %x, %y
10 ; CHECK: %D = and i32 %C, 255
11 ; CHECK: ret i32 %D
12 }
13
14 define i32 @select1(i1 %cond, i32 %x, i32 %y, i32 %z) {
15   %A = trunc i32 %x to i8
16   %B = trunc i32 %y to i8
17   %C = trunc i32 %z to i8
18   %D = add i8 %A, %B
19   %E = select i1 %cond, i8 %C, i8 %D
20   %F = zext i8 %E to i32
21   ret i32 %F
22 ; CHECK: %D = add i32 %x, %y
23 ; CHECK: %E = select i1 %cond, i32 %z, i32 %D
24 ; CHECK: %F = and i32 %E, 255
25 ; CHECK: ret i32 %F
26 }
27
28 define i8 @select2(i1 %cond, i8 %x, i8 %y, i8 %z) {
29   %A = zext i8 %x to i32
30   %B = zext i8 %y to i32
31   %C = zext i8 %z to i32
32   %D = add i32 %A, %B
33   %E = select i1 %cond, i32 %C, i32 %D
34   %F = trunc i32 %E to i8
35   ret i8 %F
36 ; CHECK: %D = add i8 %x, %y
37 ; CHECK: %E = select i1 %cond, i8 %z, i8 %D
38 ; CHECK: ret i8 %E
39 }