-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path110-cc.64sa
More file actions
83 lines (83 loc) · 1.41 KB
/
110-cc.64sa
File metadata and controls
83 lines (83 loc) · 1.41 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
.file "110-cc.c"
.text
.globl comp
.type comp, @function
/* $begin 110-cc-s 5 */
# int comp(data_t a, data_t b)
# a in \rdireg{}, b in \rsireg{}
comp:
cmpq %rsi, %rdi # Compare a:b # line:asm:cc:cmpq
setl %al # Set low order byte of \eaxreg{} to 0 or 1
movzbl %al, %eax # Clear rest of \eaxreg{} (and rest of \raxreg) # line:asm:cc:movzbl
ret
/* $end 110-cc-s 5 */
.size comp, .-comp
.globl ge
.type ge, @function
ge:
cmpb %sil, %dil
setae %al
movzbl %al, %eax
ret
.size ge, .-ge
.globl ne
.type ne, @function
ne:
cmpw %si, %di
setne %al
movzbl %al, %eax
ret
.size ne, .-ne
.globl eq
.type eq, @function
eq:
cmpl %esi, %edi
sete %al
movzbl %al, %eax
ret
.size eq, .-eq
.globl gt
.type gt, @function
gt:
cmpq %rsi, %rdi
seta %al
movzbl %al, %eax
ret
.size gt, .-gt
.globl test
.type test, @function
test:
testq %rdi, %rdi
setne %al
movzbl %al, %eax
ret
.size test, .-test
.globl test_eq
.type test_eq, @function
test_eq:
testw %di, %di
sete %al
movzbl %al, %eax
ret
.size test_eq, .-test_eq
.globl test_ge
.type test_ge, @function
test_ge:
movl %edi, %eax
notl %eax
shrb $7, %al
movzbl %al, %eax
ret
.size test_ge, .-test_ge
.globl test_ne
.type test_ne, @function
test_ne:
testl %edi, %edi
setne %al
movzbl %al, %eax
ret
.size test_ne, .-test_ne
.comm y,4,4
.comm x,4,4
.ident "GCC: (Ubuntu 4.8.1-2ubuntu1~12.04) 4.8.1"
.section .note.GNU-stack,"",@progbits