ashr-scalar.ll
4.54 KB
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=x86_64-linux-gnu -global-isel -verify-machineinstrs < %s -o - | FileCheck %s --check-prefix=X64
define i64 @test_ashr_i64(i64 %arg1, i64 %arg2) {
; X64-LABEL: test_ashr_i64:
; X64: # %bb.0:
; X64-NEXT: movq %rdi, %rax
; X64-NEXT: movq %rsi, %rcx
; X64-NEXT: # kill: def $cl killed $cl killed $rcx
; X64-NEXT: sarq %cl, %rax
; X64-NEXT: retq
%res = ashr i64 %arg1, %arg2
ret i64 %res
}
define i64 @test_ashr_i64_imm(i64 %arg1) {
; X64-LABEL: test_ashr_i64_imm:
; X64: # %bb.0:
; X64-NEXT: movq %rdi, %rax
; X64-NEXT: sarq $5, %rax
; X64-NEXT: retq
%res = ashr i64 %arg1, 5
ret i64 %res
}
define i64 @test_ashr_i64_imm1(i64 %arg1) {
; X64-LABEL: test_ashr_i64_imm1:
; X64: # %bb.0:
; X64-NEXT: movq %rdi, %rax
; X64-NEXT: sarq %rax
; X64-NEXT: retq
%res = ashr i64 %arg1, 1
ret i64 %res
}
define i32 @test_ashr_i32(i32 %arg1, i32 %arg2) {
; X64-LABEL: test_ashr_i32:
; X64: # %bb.0:
; X64-NEXT: movl %edi, %eax
; X64-NEXT: movl %esi, %ecx
; X64-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-NEXT: sarl %cl, %eax
; X64-NEXT: retq
%res = ashr i32 %arg1, %arg2
ret i32 %res
}
define i32 @test_ashr_i32_imm(i32 %arg1) {
; X64-LABEL: test_ashr_i32_imm:
; X64: # %bb.0:
; X64-NEXT: movl %edi, %eax
; X64-NEXT: sarl $5, %eax
; X64-NEXT: retq
%res = ashr i32 %arg1, 5
ret i32 %res
}
define i32 @test_ashr_i32_imm1(i32 %arg1) {
; X64-LABEL: test_ashr_i32_imm1:
; X64: # %bb.0:
; X64-NEXT: movl %edi, %eax
; X64-NEXT: sarl %eax
; X64-NEXT: retq
%res = ashr i32 %arg1, 1
ret i32 %res
}
define i16 @test_ashr_i16(i32 %arg1, i32 %arg2) {
; X64-LABEL: test_ashr_i16:
; X64: # %bb.0:
; X64-NEXT: movl %edi, %eax
; X64-NEXT: movl %esi, %ecx
; X64-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-NEXT: sarw %cl, %ax
; X64-NEXT: # kill: def $ax killed $ax killed $eax
; X64-NEXT: retq
%a = trunc i32 %arg1 to i16
%a2 = trunc i32 %arg2 to i16
%res = ashr i16 %a, %a2
ret i16 %res
}
define i16 @test_ashr_i16_imm(i32 %arg1) {
; X64-LABEL: test_ashr_i16_imm:
; X64: # %bb.0:
; X64-NEXT: movl %edi, %eax
; X64-NEXT: sarw $5, %ax
; X64-NEXT: # kill: def $ax killed $ax killed $eax
; X64-NEXT: retq
%a = trunc i32 %arg1 to i16
%res = ashr i16 %a, 5
ret i16 %res
}
define i16 @test_ashr_i16_imm1(i32 %arg1) {
; X64-LABEL: test_ashr_i16_imm1:
; X64: # %bb.0:
; X64-NEXT: movl %edi, %eax
; X64-NEXT: sarw %ax
; X64-NEXT: # kill: def $ax killed $ax killed $eax
; X64-NEXT: retq
%a = trunc i32 %arg1 to i16
%res = ashr i16 %a, 1
ret i16 %res
}
define i8 @test_ashr_i8(i32 %arg1, i32 %arg2) {
; X64-LABEL: test_ashr_i8:
; X64: # %bb.0:
; X64-NEXT: movl %edi, %eax
; X64-NEXT: movl %esi, %ecx
; X64-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-NEXT: sarb %cl, %al
; X64-NEXT: # kill: def $al killed $al killed $eax
; X64-NEXT: retq
%a = trunc i32 %arg1 to i8
%a2 = trunc i32 %arg2 to i8
%res = ashr i8 %a, %a2
ret i8 %res
}
define i8 @test_ashr_i8_imm(i32 %arg1) {
; X64-LABEL: test_ashr_i8_imm:
; X64: # %bb.0:
; X64-NEXT: movl %edi, %eax
; X64-NEXT: sarb $5, %al
; X64-NEXT: # kill: def $al killed $al killed $eax
; X64-NEXT: retq
%a = trunc i32 %arg1 to i8
%res = ashr i8 %a, 5
ret i8 %res
}
define i8 @test_ashr_i8_imm1(i32 %arg1) {
; X64-LABEL: test_ashr_i8_imm1:
; X64: # %bb.0:
; X64-NEXT: movl %edi, %eax
; X64-NEXT: sarb %al
; X64-NEXT: # kill: def $al killed $al killed $eax
; X64-NEXT: retq
%a = trunc i32 %arg1 to i8
%res = ashr i8 %a, 1
ret i8 %res
}
define i1 @test_ashr_i1(i32 %arg1, i32 %arg2) {
; X64-LABEL: test_ashr_i1:
; X64: # %bb.0:
; X64-NEXT: movl %edi, %eax
; X64-NEXT: movl %esi, %ecx
; X64-NEXT: shlb $7, %al
; X64-NEXT: sarb $7, %al
; X64-NEXT: andb $1, %cl
; X64-NEXT: # kill: def $cl killed $cl killed $ecx
; X64-NEXT: sarb %cl, %al
; X64-NEXT: # kill: def $al killed $al killed $eax
; X64-NEXT: retq
%a = trunc i32 %arg1 to i1
%a2 = trunc i32 %arg2 to i1
%res = ashr i1 %a, %a2
ret i1 %res
}
define i1 @test_ashr_i1_imm1(i32 %arg1) {
; X64-LABEL: test_ashr_i1_imm1:
; X64: # %bb.0:
; X64-NEXT: movl %edi, %eax
; X64-NEXT: movb $1, %cl
; X64-NEXT: shlb $7, %al
; X64-NEXT: sarb $7, %al
; X64-NEXT: andb $1, %cl
; X64-NEXT: sarb %cl, %al
; X64-NEXT: # kill: def $al killed $al killed $eax
; X64-NEXT: retq
%a = trunc i32 %arg1 to i1
%res = ashr i1 %a, 1
ret i1 %res
}