blob: 2408359a141dd6c7cbec243af77f1784bb1504be [file] [log] [blame]
Dan Gohman74feef22008-10-17 01:23:35 +00001; RUN: llvm-as < %s | llc -march=x86-64 > %t
2; RUN: grep rol %t | count 3
3; RUN: grep ror %t | count 1
4; RUN: grep shld %t | count 2
5; RUN: grep shrd %t | count 2
6
7define i64 @foo(i64 %x, i64 %y, i64 %z) nounwind readnone {
8entry:
9 %0 = shl i64 %x, %z
10 %1 = sub i64 64, %z
11 %2 = lshr i64 %x, %1
12 %3 = or i64 %2, %0
13 ret i64 %3
14}
15
16define i64 @bar(i64 %x, i64 %y, i64 %z) nounwind readnone {
17entry:
18 %0 = shl i64 %y, %z
19 %1 = sub i64 64, %z
20 %2 = lshr i64 %x, %1
21 %3 = or i64 %2, %0
22 ret i64 %3
23}
24
25define i64 @un(i64 %x, i64 %y, i64 %z) nounwind readnone {
26entry:
27 %0 = lshr i64 %x, %z
28 %1 = sub i64 64, %z
29 %2 = shl i64 %x, %1
30 %3 = or i64 %2, %0
31 ret i64 %3
32}
33
34define i64 @bu(i64 %x, i64 %y, i64 %z) nounwind readnone {
35entry:
36 %0 = lshr i64 %y, %z
37 %1 = sub i64 64, %z
38 %2 = shl i64 %x, %1
39 %3 = or i64 %2, %0
40 ret i64 %3
41}
42
43define i64 @xfoo(i64 %x, i64 %y, i64 %z) nounwind readnone {
44entry:
45 %0 = lshr i64 %x, 57
46 %1 = shl i64 %x, 7
47 %2 = or i64 %0, %1
48 ret i64 %2
49}
50
51define i64 @xbar(i64 %x, i64 %y, i64 %z) nounwind readnone {
52entry:
53 %0 = shl i64 %y, 7
54 %1 = lshr i64 %x, 57
55 %2 = or i64 %0, %1
56 ret i64 %2
57}
58
59define i64 @xun(i64 %x, i64 %y, i64 %z) nounwind readnone {
60entry:
61 %0 = lshr i64 %x, 7
62 %1 = shl i64 %x, 57
63 %2 = or i64 %0, %1
64 ret i64 %2
65}
66
67define i64 @xbu(i64 %x, i64 %y, i64 %z) nounwind readnone {
68entry:
69 %0 = lshr i64 %y, 7
70 %1 = shl i64 %x, 57
71 %2 = or i64 %0, %1
72 ret i64 %2
73}