From 79d281f7fa3b6cf7ce2cf572dc6d0ab9b8498d73 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Mon, 30 Nov 2009 02:17:08 +0000 Subject: [PATCH] encourage loads from memory directly into SSE registers where appropriate --- src/compiler.cpp | 6 +++++- src/x86.cpp | 10 ++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/compiler.cpp b/src/compiler.cpp index ec243184b6..4223a30741 100644 --- a/src/compiler.cpp +++ b/src/compiler.cpp @@ -3447,6 +3447,10 @@ maybeMove(Context* c, BinaryOperation type, unsigned srcSize, c->arch->planSource(type, dstSize, &srcTypeMask, &srcRegisterMask, dstSize, &thunk); + if (src->type == ValueGeneral) { + srcRegisterMask &= c->arch->generalRegisterMask(); + } + assert(c, thunk == 0); assert(c, dstMask.typeMask & srcTypeMask & (1 << RegisterOperand)); @@ -6013,7 +6017,7 @@ class MyCompiler: public Compiler { virtual void push(unsigned footprint UNUSED) { assert(&c, footprint == 1); - Value* v = value(&c, ValueFloat); + Value* v = value(&c, ValueGeneral); Stack* s = local::stack(&c, v, c.stack); v->home = frameIndex(&c, s->index + c.localFootprint); diff --git a/src/x86.cpp b/src/x86.cpp index b492f299f6..13d9673c9b 100644 --- a/src/x86.cpp +++ b/src/x86.cpp @@ -946,6 +946,9 @@ void sseMoveRR(Context* c, unsigned aSize, Assembler::Register* a, unsigned bSize UNUSED, Assembler::Register* b) { + assert(c, aSize >= 4); + assert(c, aSize == bSize); + if (floatReg(a) and floatReg(b)) { if (aSize == 4) { opcode(c, 0xf3); @@ -1090,6 +1093,9 @@ void sseMoveMR(Context* c, unsigned aSize, Assembler::Memory* a, unsigned bSize UNUSED, Assembler::Register* b) { + assert(c, aSize >= 4); + assert(c, aSize == bSize); + if (BytesPerWord == 4 and aSize == 8) { opcode(c, 0xf3); opcode(c, 0x0f, 0x7e); @@ -1165,6 +1171,7 @@ void sseMoveRM(Context* c, unsigned aSize, Assembler::Register* a, UNUSED unsigned bSize, Assembler::Memory* b) { + assert(c, aSize >= 4); assert(c, aSize == bSize); if (BytesPerWord == 4 and aSize == 8) { @@ -2942,8 +2949,7 @@ class MyArchitecture: public Assembler::Architecture { case Move: *aTypeMask = (1 << RegisterOperand) | (1 << MemoryOperand); - *aRegisterMask = GeneralRegisterMask - | (static_cast(GeneralRegisterMask) << 32); + *aRegisterMask = ~static_cast(0); if (BytesPerWord == 4) { if (aSize == 4 and bSize == 8) {