Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Unified Diff: src/x64/assembler-x64.cc

Issue 2619263002: [x64] Fix code generation of testw and add tests (Closed)
Patch Set: Re-enable all tests Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/cctest/test-assembler-x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x64/assembler-x64.cc
diff --git a/src/x64/assembler-x64.cc b/src/x64/assembler-x64.cc
index 5402a8ce87a3987981e1c8a33340238b95b517c3..7a7fc6c87bcae85226d288b86a25060ab907ac49 100644
--- a/src/x64/assembler-x64.cc
+++ b/src/x64/assembler-x64.cc
@@ -2103,11 +2103,12 @@ void Assembler::testb(const Operand& op, Register reg) {
void Assembler::testw(Register dst, Register src) {
EnsureSpace ensure_space(this);
emit(0x66);
- if (src.low_bits() == 4) {
- emit_rex_32(src, dst);
+ if (!dst.is_byte_register() || !src.is_byte_register()) {
+ // Register is not one of al, bl, cl, dl. Its encoding needs REX.
+ emit_rex_32(dst, src);
}
emit(0x85);
- emit_modrm(src, dst);
+ emit_modrm(dst, src);
}
void Assembler::testw(Register reg, Immediate mask) {
@@ -2118,7 +2119,7 @@ void Assembler::testw(Register reg, Immediate mask) {
emit(0xA9);
emitw(mask.value_);
} else {
- if (reg.low_bits() == 4) {
+ if (!reg.is_byte_register()) {
emit_rex_32(reg);
}
emit(0xF7);
« no previous file with comments | « no previous file | test/cctest/test-assembler-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698