Add a triple to switch.ll test.
[oota-llvm.git] / test / CodeGen / X86 / rot64.ll
1 ; RUN: llc < %s -march=x86-64 -mcpu=corei7 > %t
2 ; RUN: grep rol %t | count 5
3 ; RUN: grep ror %t | count 1
4 ; RUN: grep shld %t | count 2
5 ; RUN: grep shrd %t | count 2
6 ; RUN: llc < %s -march=x86-64 -mcpu=core-avx2 | FileCheck %s --check-prefix=BMI2
7
8 define i64 @foo(i64 %x, i64 %y, i64 %z) nounwind readnone {
9 entry:
10         %0 = shl i64 %x, %z
11         %1 = sub i64 64, %z
12         %2 = lshr i64 %x, %1
13         %3 = or i64 %2, %0
14         ret i64 %3
15 }
16
17 define i64 @bar(i64 %x, i64 %y, i64 %z) nounwind readnone {
18 entry:
19         %0 = shl i64 %y, %z
20         %1 = sub i64 64, %z
21         %2 = lshr i64 %x, %1
22         %3 = or i64 %2, %0
23         ret i64 %3
24 }
25
26 define i64 @un(i64 %x, i64 %y, i64 %z) nounwind readnone {
27 entry:
28         %0 = lshr i64 %x, %z
29         %1 = sub i64 64, %z
30         %2 = shl i64 %x, %1
31         %3 = or i64 %2, %0
32         ret i64 %3
33 }
34
35 define i64 @bu(i64 %x, i64 %y, i64 %z) nounwind readnone {
36 entry:
37         %0 = lshr i64 %y, %z
38         %1 = sub i64 64, %z
39         %2 = shl i64 %x, %1
40         %3 = or i64 %2, %0
41         ret i64 %3
42 }
43
44 define i64 @xfoo(i64 %x, i64 %y, i64 %z) nounwind readnone {
45 entry:
46 ; BMI2-LABEL: xfoo:
47 ; BMI2: rorxq $57
48         %0 = lshr i64 %x, 57
49         %1 = shl i64 %x, 7
50         %2 = or i64 %0, %1
51         ret i64 %2
52 }
53
54 define i64 @xfoop(i64* %p) nounwind readnone {
55 entry:
56 ; BMI2-LABEL: xfoop:
57 ; BMI2: rorxq $57, ({{.+}}), %{{.+}}
58         %x = load i64, i64* %p
59         %a = lshr i64 %x, 57
60         %b = shl i64 %x, 7
61         %c = or i64 %a, %b
62         ret i64 %c
63 }
64
65 define i64 @xbar(i64 %x, i64 %y, i64 %z) nounwind readnone {
66 entry:
67         %0 = shl i64 %y, 7
68         %1 = lshr i64 %x, 57
69         %2 = or i64 %0, %1
70         ret i64 %2
71 }
72
73 define i64 @xun(i64 %x, i64 %y, i64 %z) nounwind readnone {
74 entry:
75 ; BMI2-LABEL: xun:
76 ; BMI2: rorxq $7
77         %0 = lshr i64 %x, 7
78         %1 = shl i64 %x, 57
79         %2 = or i64 %0, %1
80         ret i64 %2
81 }
82
83 define i64 @xunp(i64* %p) nounwind readnone {
84 entry:
85 ; BMI2-LABEL: xunp:
86 ; BMI2: rorxq $7, ({{.+}}), %{{.+}}
87         %x = load i64, i64* %p
88         %a = lshr i64 %x, 7
89         %b = shl i64 %x, 57
90         %c = or i64 %a, %b
91         ret i64 %c
92 }
93
94 define i64 @xbu(i64 %x, i64 %y, i64 %z) nounwind readnone {
95 entry:
96         %0 = lshr i64 %y, 7
97         %1 = shl i64 %x, 57
98         %2 = or i64 %0, %1
99         ret i64 %2
100 }