[x64] Load int32 constants with movl instead of movq to avoid sign extension.
R=bmeurer@chromium.org Review URL: https://codereview.chromium.org/1867293002 Cr-Commit-Position: refs/heads/master@{#35352}
This commit is contained in:
parent
d1ec440f5d
commit
f7aa8cc70e
@ -2077,10 +2077,16 @@ void CodeGenerator::AssembleMove(InstructionOperand* source,
|
||||
Register dst = destination->IsRegister() ? g.ToRegister(destination)
|
||||
: kScratchRegister;
|
||||
switch (src.type()) {
|
||||
case Constant::kInt32:
|
||||
case Constant::kInt32: {
|
||||
// TODO(dcarney): don't need scratch in this case.
|
||||
__ Set(dst, src.ToInt32());
|
||||
int32_t value = src.ToInt32();
|
||||
if (value == 0) {
|
||||
__ xorl(dst, dst);
|
||||
} else {
|
||||
__ movl(dst, Immediate(value));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Constant::kInt64:
|
||||
__ Set(dst, src.ToInt64());
|
||||
break;
|
||||
|
@ -1774,7 +1774,6 @@ TEST(RunInt32SubP) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TEST(RunInt32SubImm) {
|
||||
{
|
||||
FOR_UINT32_INPUTS(i) {
|
||||
@ -1798,6 +1797,11 @@ TEST(RunInt32SubImm) {
|
||||
}
|
||||
}
|
||||
|
||||
TEST(RunInt32SubImm2) {
|
||||
BufferedRawMachineAssemblerTester<int32_t> r;
|
||||
r.Return(r.Int32Sub(r.Int32Constant(-1), r.Int32Constant(0)));
|
||||
CHECK_EQ(-1, r.Call());
|
||||
}
|
||||
|
||||
TEST(RunInt32SubAndWord32SarP) {
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user