summaryrefslogtreecommitdiff
path: root/test/CodeGen/X86/rot16.ll
blob: 0293f4e21123a49d4976a289065a4b304a5f1641 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
; RUN: llc < %s -march=x86 | FileCheck %s

define i16 @foo(i16 %x, i16 %y, i16 %z) nounwind readnone {
entry:
; CHECK-LABEL: foo:
; CHECK: rolw %cl
	%0 = shl i16 %x, %z
	%1 = sub i16 16, %z
	%2 = lshr i16 %x, %1
	%3 = or i16 %2, %0
	ret i16 %3
}

define i16 @bar(i16 %x, i16 %y, i16 %z) nounwind readnone {
entry:
; CHECK-LABEL: bar:
; CHECK: shldw %cl
	%0 = shl i16 %y, %z
	%1 = sub i16 16, %z
	%2 = lshr i16 %x, %1
	%3 = or i16 %2, %0
	ret i16 %3
}

define i16 @un(i16 %x, i16 %y, i16 %z) nounwind readnone {
entry:
; CHECK-LABEL: un:
; CHECK: rorw %cl
	%0 = lshr i16 %x, %z
	%1 = sub i16 16, %z
	%2 = shl i16 %x, %1
	%3 = or i16 %2, %0
	ret i16 %3
}

define i16 @bu(i16 %x, i16 %y, i16 %z) nounwind readnone {
entry:
; CHECK-LABEL: bu:
; CHECK: shrdw
	%0 = lshr i16 %y, %z
	%1 = sub i16 16, %z
	%2 = shl i16 %x, %1
	%3 = or i16 %2, %0
	ret i16 %3
}

define i16 @xfoo(i16 %x, i16 %y, i16 %z) nounwind readnone {
entry:
; CHECK-LABEL: xfoo:
; CHECK: rolw $5
	%0 = lshr i16 %x, 11
	%1 = shl i16 %x, 5
	%2 = or i16 %0, %1
	ret i16 %2
}

define i16 @xbar(i16 %x, i16 %y, i16 %z) nounwind readnone {
entry:
; CHECK-LABEL: xbar:
; CHECK: shldw $5
	%0 = shl i16 %y, 5
	%1 = lshr i16 %x, 11
	%2 = or i16 %0, %1
	ret i16 %2
}

define i16 @xun(i16 %x, i16 %y, i16 %z) nounwind readnone {
entry:
; CHECK-LABEL: xun:
; CHECK: rolw $11
	%0 = lshr i16 %x, 5
	%1 = shl i16 %x, 11
	%2 = or i16 %0, %1
	ret i16 %2
}

define i16 @xbu(i16 %x, i16 %y, i16 %z) nounwind readnone {
entry:
; CHECK-LABEL: xbu:
; CHECK: shldw $11
	%0 = lshr i16 %y, 5
	%1 = shl i16 %x, 11
	%2 = or i16 %0, %1
	ret i16 %2
}