blob: d0ba29cbf65c223b4f43db7b0d9b3f52f209dbb7 [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -x86-asm-syntax=intel | \
Dan Gohman8c89a502007-08-15 13:36:28 +00002; RUN: grep {ro\[rl\]} | count 12
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003
4uint %rotl32(uint %A, ubyte %Amt) {
5 %B = shl uint %A, ubyte %Amt
6 %Amt2 = sub ubyte 32, %Amt
7 %C = shr uint %A, ubyte %Amt2
8 %D = or uint %B, %C
9 ret uint %D
10}
11
12uint %rotr32(uint %A, ubyte %Amt) {
13 %B = shr uint %A, ubyte %Amt
14 %Amt2 = sub ubyte 32, %Amt
15 %C = shl uint %A, ubyte %Amt2
16 %D = or uint %B, %C
17 ret uint %D
18}
19
20uint %rotli32(uint %A) {
21 %B = shl uint %A, ubyte 5
22 %C = shr uint %A, ubyte 27
23 %D = or uint %B, %C
24 ret uint %D
25}
26
27uint %rotri32(uint %A) {
28 %B = shr uint %A, ubyte 5
29 %C = shl uint %A, ubyte 27
30 %D = or uint %B, %C
31 ret uint %D
32}
33
34ushort %rotl16(ushort %A, ubyte %Amt) {
35 %B = shl ushort %A, ubyte %Amt
36 %Amt2 = sub ubyte 16, %Amt
37 %C = shr ushort %A, ubyte %Amt2
38 %D = or ushort %B, %C
39 ret ushort %D
40}
41
42ushort %rotr16(ushort %A, ubyte %Amt) {
43 %B = shr ushort %A, ubyte %Amt
44 %Amt2 = sub ubyte 16, %Amt
45 %C = shl ushort %A, ubyte %Amt2
46 %D = or ushort %B, %C
47 ret ushort %D
48}
49
50ushort %rotli16(ushort %A) {
51 %B = shl ushort %A, ubyte 5
52 %C = shr ushort %A, ubyte 11
53 %D = or ushort %B, %C
54 ret ushort %D
55}
56
57ushort %rotri16(ushort %A) {
58 %B = shr ushort %A, ubyte 5
59 %C = shl ushort %A, ubyte 11
60 %D = or ushort %B, %C
61 ret ushort %D
62}
63
64ubyte %rotl8(ubyte %A, ubyte %Amt) {
65 %B = shl ubyte %A, ubyte %Amt
66 %Amt2 = sub ubyte 8, %Amt
67 %C = shr ubyte %A, ubyte %Amt2
68 %D = or ubyte %B, %C
69 ret ubyte %D
70}
71
72ubyte %rotr8(ubyte %A, ubyte %Amt) {
73 %B = shr ubyte %A, ubyte %Amt
74 %Amt2 = sub ubyte 8, %Amt
75 %C = shl ubyte %A, ubyte %Amt2
76 %D = or ubyte %B, %C
77 ret ubyte %D
78}
79
80ubyte %rotli8(ubyte %A) {
81 %B = shl ubyte %A, ubyte 5
82 %C = shr ubyte %A, ubyte 3
83 %D = or ubyte %B, %C
84 ret ubyte %D
85}
86
87ubyte %rotri8(ubyte %A) {
88 %B = shr ubyte %A, ubyte 5
89 %C = shl ubyte %A, ubyte 3
90 %D = or ubyte %B, %C
91 ret ubyte %D
92}