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