summaryrefslogtreecommitdiff
path: root/test/Transforms/InstCombine/shift-simplify.ll
blob: b91637f7c4c28ef0a7ca095b76b542361cb026d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
; RUN: llvm-as < %s | opt -instcombine | llvm-dis | egrep 'shl|lshr|ashr' | wc -l | grep 3

int %test0(int %A, int %B, ubyte %C) {
	%X = shl int %A, ubyte %C
	%Y = shl int %B, ubyte %C
	%Z = and int %X, %Y
	ret int %Z
}

int %test1(int %A, int %B, ubyte %C) {
	%X = lshr int %A, ubyte %C
	%Y = lshr int %B, ubyte %C
	%Z = or int %X, %Y
	ret int %Z
}

int %test2(int %A, int %B, ubyte %C) {
	%X = ashr int %A, ubyte %C
	%Y = ashr int %B, ubyte %C
	%Z = xor int %X, %Y
	ret int %Z
}