1 ; RUN: llc < %s -march=x86 | FileCheck %s
3 define i16 @foo(i16 %x, i16 %y, i16 %z) nounwind readnone {
4 entry:
5 ; CHECK-LABEL: foo:
6 ; CHECK: rolw %cl
7 %0 = shl i16 %x, %z
8 %1 = sub i16 16, %z
9 %2 = lshr i16 %x, %1
10 %3 = or i16 %2, %0
11 ret i16 %3
12 }
14 define i16 @bar(i16 %x, i16 %y, i16 %z) nounwind readnone {
15 entry:
16 ; CHECK-LABEL: bar:
17 ; CHECK: shldw %cl
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 }
25 define i16 @un(i16 %x, i16 %y, i16 %z) nounwind readnone {
26 entry:
27 ; CHECK-LABEL: un:
28 ; CHECK: rorw %cl
29 %0 = lshr i16 %x, %z
30 %1 = sub i16 16, %z
31 %2 = shl i16 %x, %1
32 %3 = or i16 %2, %0
33 ret i16 %3
34 }
36 define i16 @bu(i16 %x, i16 %y, i16 %z) nounwind readnone {
37 entry:
38 ; CHECK-LABEL: bu:
39 ; CHECK: shrdw
40 %0 = lshr i16 %y, %z
41 %1 = sub i16 16, %z
42 %2 = shl i16 %x, %1
43 %3 = or i16 %2, %0
44 ret i16 %3
45 }
47 define i16 @xfoo(i16 %x, i16 %y, i16 %z) nounwind readnone {
48 entry:
49 ; CHECK-LABEL: xfoo:
50 ; CHECK: rolw $5
51 %0 = lshr i16 %x, 11
52 %1 = shl i16 %x, 5
53 %2 = or i16 %0, %1
54 ret i16 %2
55 }
57 define i16 @xbar(i16 %x, i16 %y, i16 %z) nounwind readnone {
58 entry:
59 ; CHECK-LABEL: xbar:
60 ; CHECK: shldw $5
61 %0 = shl i16 %y, 5
62 %1 = lshr i16 %x, 11
63 %2 = or i16 %0, %1
64 ret i16 %2
65 }
67 define i16 @xun(i16 %x, i16 %y, i16 %z) nounwind readnone {
68 entry:
69 ; CHECK-LABEL: xun:
70 ; CHECK: rolw $11
71 %0 = lshr i16 %x, 5
72 %1 = shl i16 %x, 11
73 %2 = or i16 %0, %1
74 ret i16 %2
75 }
77 define i16 @xbu(i16 %x, i16 %y, i16 %z) nounwind readnone {
78 entry:
79 ; CHECK-LABEL: xbu:
80 ; CHECK: shldw $11
81 %0 = lshr i16 %y, 5
82 %1 = shl i16 %x, 11
83 %2 = or i16 %0, %1
84 ret i16 %2
85 }