Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
halo
art
Commits
dfbeb145
Commit
dfbeb145
authored
9 years ago
by
Roland Levillain
Committed by
Gerrit Code Review
9 years ago
Browse files
Options
Download
Plain Diff
Merge "Add cmpb instruction to x86 and x86_64 assembler"
parents
fc7662f7
3b62593b
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
33 additions
and
0 deletions
+33
-0
compiler/utils/x86/assembler_x86.cc
compiler/utils/x86/assembler_x86.cc
+8
-0
compiler/utils/x86/assembler_x86.h
compiler/utils/x86/assembler_x86.h
+1
-0
compiler/utils/x86/assembler_x86_test.cc
compiler/utils/x86/assembler_x86_test.cc
+6
-0
compiler/utils/x86_64/assembler_x86_64.cc
compiler/utils/x86_64/assembler_x86_64.cc
+10
-0
compiler/utils/x86_64/assembler_x86_64.h
compiler/utils/x86_64/assembler_x86_64.h
+1
-0
compiler/utils/x86_64/assembler_x86_64_test.cc
compiler/utils/x86_64/assembler_x86_64_test.cc
+7
-0
No files found.
compiler/utils/x86/assembler_x86.cc
View file @
dfbeb145
...
...
@@ -1030,6 +1030,14 @@ void X86Assembler::xchgl(Register reg, const Address& address) {
}
void
X86Assembler
::
cmpb
(
const
Address
&
address
,
const
Immediate
&
imm
)
{
AssemblerBuffer
::
EnsureCapacity
ensured
(
&
buffer_
);
EmitUint8
(
0x80
);
EmitOperand
(
7
,
address
);
EmitUint8
(
imm
.
value
()
&
0xFF
);
}
void
X86Assembler
::
cmpw
(
const
Address
&
address
,
const
Immediate
&
imm
)
{
AssemblerBuffer
::
EnsureCapacity
ensured
(
&
buffer_
);
EmitUint8
(
0x66
);
...
...
This diff is collapsed.
Click to expand it.
compiler/utils/x86/assembler_x86.h
View file @
dfbeb145
...
...
@@ -479,6 +479,7 @@ class X86Assembler FINAL : public Assembler {
void
xchgl
(
Register
dst
,
Register
src
);
void
xchgl
(
Register
reg
,
const
Address
&
address
);
void
cmpb
(
const
Address
&
address
,
const
Immediate
&
imm
);
void
cmpw
(
const
Address
&
address
,
const
Immediate
&
imm
);
void
cmpl
(
Register
reg
,
const
Immediate
&
imm
);
...
...
This diff is collapsed.
Click to expand it.
compiler/utils/x86/assembler_x86_test.cc
View file @
dfbeb145
...
...
@@ -389,4 +389,10 @@ TEST_F(AssemblerX86Test, NearLabel) {
DriverStr
(
expected
,
"near_label"
);
}
TEST_F
(
AssemblerX86Test
,
Cmpb
)
{
GetAssembler
()
->
cmpb
(
x86
::
Address
(
x86
::
EDI
,
128
),
x86
::
Immediate
(
0
));
const
char
*
expected
=
"cmpb $0, 128(%EDI)
\n
"
;
DriverStr
(
expected
,
"cmpb"
);
}
}
// namespace art
This diff is collapsed.
Click to expand it.
compiler/utils/x86_64/assembler_x86_64.cc
View file @
dfbeb145
...
...
@@ -1224,6 +1224,16 @@ void X86_64Assembler::xchgl(CpuRegister reg, const Address& address) {
}
void
X86_64Assembler
::
cmpb
(
const
Address
&
address
,
const
Immediate
&
imm
)
{
AssemblerBuffer
::
EnsureCapacity
ensured
(
&
buffer_
);
CHECK
(
imm
.
is_int32
());
EmitOptionalRex32
(
address
);
EmitUint8
(
0x80
);
EmitOperand
(
7
,
address
);
EmitUint8
(
imm
.
value
()
&
0xFF
);
}
void
X86_64Assembler
::
cmpw
(
const
Address
&
address
,
const
Immediate
&
imm
)
{
AssemblerBuffer
::
EnsureCapacity
ensured
(
&
buffer_
);
CHECK
(
imm
.
is_int32
());
...
...
This diff is collapsed.
Click to expand it.
compiler/utils/x86_64/assembler_x86_64.h
View file @
dfbeb145
...
...
@@ -506,6 +506,7 @@ class X86_64Assembler FINAL : public Assembler {
void
xchgq
(
CpuRegister
dst
,
CpuRegister
src
);
void
xchgl
(
CpuRegister
reg
,
const
Address
&
address
);
void
cmpb
(
const
Address
&
address
,
const
Immediate
&
imm
);
void
cmpw
(
const
Address
&
address
,
const
Immediate
&
imm
);
void
cmpl
(
CpuRegister
reg
,
const
Immediate
&
imm
);
...
...
This diff is collapsed.
Click to expand it.
compiler/utils/x86_64/assembler_x86_64_test.cc
View file @
dfbeb145
...
...
@@ -1637,4 +1637,11 @@ TEST_F(AssemblerX86_64Test, Repecmpsq) {
DriverStr
(
expected
,
"Repecmpsq"
);
}
TEST_F
(
AssemblerX86_64Test
,
Cmpb
)
{
GetAssembler
()
->
cmpb
(
x86_64
::
Address
(
x86_64
::
CpuRegister
(
x86_64
::
RDI
),
128
),
x86_64
::
Immediate
(
0
));
const
char
*
expected
=
"cmpb $0, 128(%RDI)
\n
"
;
DriverStr
(
expected
,
"cmpb"
);
}
}
// namespace art
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment