blob: aeb59aab556b6c35e8f840ae9e8961106858444b [file] [log] [blame]
Reid Spencer69ccadd2006-12-02 04:23:10 +00001; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | not grep or &&
Reid Spencercfd09d92007-01-05 18:33:43 +00002; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | \
3; RUN: grep rlwnm | wc -l | grep 2 &&
4; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | \
5; RUN: grep rlwinm | wc -l | grep 2
Nate Begemancfde3c12006-01-11 22:58:12 +00006
7implementation ; Functions:
8
9int %rotlw(uint %x, int %sh) {
10entry:
11 %tmp.3 = cast int %sh to ubyte ; <ubyte> [#uses=1]
Reid Spencer8aabc9e2007-01-02 05:53:06 +000012 %x = cast uint %x to int ; <int> [#uses=1]
Nate Begemancfde3c12006-01-11 22:58:12 +000013 %tmp.7 = sub int 32, %sh ; <int> [#uses=1]
14 %tmp.9 = cast int %tmp.7 to ubyte ; <ubyte> [#uses=1]
15 %tmp.10 = shr uint %x, ubyte %tmp.9 ; <uint> [#uses=1]
Reid Spencer8aabc9e2007-01-02 05:53:06 +000016 %tmp.4 = shl int %x, ubyte %tmp.3 ; <int> [#uses=1]
17 %tmp.10 = cast uint %tmp.10 to int ; <int> [#uses=1]
Nate Begemancfde3c12006-01-11 22:58:12 +000018 %tmp.12 = or int %tmp.10, %tmp.4 ; <int> [#uses=1]
19 ret int %tmp.12
20}
21
22int %rotrw(uint %x, int %sh) {
23entry:
24 %tmp.3 = cast int %sh to ubyte ; <ubyte> [#uses=1]
25 %tmp.4 = shr uint %x, ubyte %tmp.3 ; <uint> [#uses=1]
26 %tmp.7 = sub int 32, %sh ; <int> [#uses=1]
27 %tmp.9 = cast int %tmp.7 to ubyte ; <ubyte> [#uses=1]
Reid Spencer8aabc9e2007-01-02 05:53:06 +000028 %x = cast uint %x to int ; <int> [#uses=1]
29 %tmp.4 = cast uint %tmp.4 to int ; <int> [#uses=1]
30 %tmp.10 = shl int %x, ubyte %tmp.9 ; <int> [#uses=1]
Nate Begemancfde3c12006-01-11 22:58:12 +000031 %tmp.12 = or int %tmp.4, %tmp.10 ; <int> [#uses=1]
32 ret int %tmp.12
33}
34
35int %rotlwi(uint %x) {
36entry:
Reid Spencer8aabc9e2007-01-02 05:53:06 +000037 %x = cast uint %x to int ; <int> [#uses=1]
Nate Begemancfde3c12006-01-11 22:58:12 +000038 %tmp.7 = shr uint %x, ubyte 27 ; <uint> [#uses=1]
Reid Spencer8aabc9e2007-01-02 05:53:06 +000039 %tmp.3 = shl int %x, ubyte 5 ; <int> [#uses=1]
40 %tmp.7 = cast uint %tmp.7 to int ; <int> [#uses=1]
Nate Begemancfde3c12006-01-11 22:58:12 +000041 %tmp.9 = or int %tmp.3, %tmp.7 ; <int> [#uses=1]
42 ret int %tmp.9
43}
44
45int %rotrwi(uint %x) {
46entry:
47 %tmp.3 = shr uint %x, ubyte 5 ; <uint> [#uses=1]
Reid Spencer8aabc9e2007-01-02 05:53:06 +000048 %x = cast uint %x to int ; <int> [#uses=1]
49 %tmp.3 = cast uint %tmp.3 to int ; <int> [#uses=1]
50 %tmp.7 = shl int %x, ubyte 27 ; <int> [#uses=1]
Nate Begemancfde3c12006-01-11 22:58:12 +000051 %tmp.9 = or int %tmp.3, %tmp.7 ; <int> [#uses=1]
52 ret int %tmp.9
53}