Index: src/arm64/macro-assembler-arm64.cc |
diff --git a/src/arm64/macro-assembler-arm64.cc b/src/arm64/macro-assembler-arm64.cc |
index eb8f0d282ef43f5056d80a367ed53cc01d99bc97..8c3587d3d7fb088d42c815d7b9a60981ca7f9ac3 100644 |
--- a/src/arm64/macro-assembler-arm64.cc |
+++ b/src/arm64/macro-assembler-arm64.cc |
@@ -64,17 +64,23 @@ void MacroAssembler::LogicalMacro(const Register& rd, |
} else if (operand.IsImmediate()) { |
int64_t immediate = operand.ImmediateValue(); |
unsigned reg_size = rd.SizeInBits(); |
- ASSERT(rd.Is64Bits() || is_uint32(immediate)); |
// If the operation is NOT, invert the operation and immediate. |
if ((op & NOT) == NOT) { |
op = static_cast<LogicalOp>(op & ~NOT); |
immediate = ~immediate; |
- if (rd.Is32Bits()) { |
- immediate &= kWRegMask; |
- } |
} |
+ // Ignore the top 32 bits of an immediate if we're moving to a W register. |
+ if (rd.Is32Bits()) { |
+ // Check that the top 32 bits are consistent. |
+ ASSERT(((immediate >> kWRegSizeInBits) == 0) || |
+ ((immediate >> kWRegSizeInBits) == -1)); |
+ immediate &= kWRegMask; |
+ } |
+ |
+ ASSERT(rd.Is64Bits() || is_uint32(immediate)); |
+ |
// Special cases for all set or all clear immediates. |
if (immediate == 0) { |
switch (op) { |