1 ; RUN: opt < %s -instcombine -S | FileCheck %s
3 define i32 @mul(i32 %x, i32 %y) {
4 %A = trunc i32 %x to i8
5 %B = trunc i32 %y to i8
9 ; CHECK: %C = mul i32 %x, %y
10 ; CHECK: %D = and i32 %C, 255
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
19 %E = select i1 %cond, i8 %C, i8 %D
20 %F = zext i8 %E to i32
22 ; CHECK: %D = add i32 %x, %y
23 ; CHECK: %E = select i1 %cond, i32 %z, i32 %D
24 ; CHECK: %F = and i32 %E, 255
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
33 %E = select i1 %cond, i32 %C, i32 %D
34 %F = trunc i32 %E to i8
36 ; CHECK: %D = add i8 %x, %y
37 ; CHECK: %E = select i1 %cond, i8 %z, i8 %D