1 ; All of these ands and shifts should be folded into rlw[i]nm instructions
2 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | not grep and &&
3 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | not grep srawi &&
4 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | not grep srwi &&
5 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | not grep slwi &&
6 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | grep rlwnm | wc -l | grep 1 &&
7 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | grep rlwinm | wc -l | grep 1
10 implementation ; Functions:
12 uint %test1(uint %X, int %Y) {
14 %tmp = cast int %Y to ubyte ; <ubyte> [#uses=2]
15 %tmp1 = shl uint %X, ubyte %tmp ; <uint> [#uses=1]
16 %tmp2 = sub ubyte 32, %tmp ; <ubyte> [#uses=1]
17 %tmp3 = shr uint %X, ubyte %tmp2 ; <uint> [#uses=1]
18 %tmp4 = or uint %tmp1, %tmp3 ; <uint> [#uses=1]
19 %tmp6 = and uint %tmp4, 127 ; <uint> [#uses=1]
23 uint %test2(uint %X) {
25 %tmp1 = shr uint %X, ubyte 27 ; <uint> [#uses=1]
26 %tmp2 = shl uint %X, ubyte 5 ; <uint> [#uses=1]
27 %tmp2.masked = and uint %tmp2, 96 ; <uint> [#uses=1]
28 %tmp5 = or uint %tmp1, %tmp2.masked ; <uint> [#uses=1]