Skip to content

Commit 4dbe6c3

Browse files
committed
[a64] Remove VOne constant in favor of FMOV
1 parent e96544e commit 4dbe6c3

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

src/xenia/cpu/backend/a64/a64_emitter.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,6 @@ void A64Emitter::MovMem64(const oaknut::XRegSp& addr, intptr_t offset,
689689

690690
static const vec128_t v_consts[] = {
691691
/* VZero */ vec128f(0.0f),
692-
/* VOne */ vec128f(1.0f),
693692
/* VOnePD */ vec128d(1.0),
694693
/* VNegativeOne */ vec128f(-1.0f, -1.0f, -1.0f, -1.0f),
695694
/* VFFFF */

src/xenia/cpu/backend/a64/a64_emitter.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ enum RegisterFlags {
4747

4848
enum VConst {
4949
VZero = 0,
50-
VOne,
5150
VOnePD,
5251
VNegativeOne,
5352
VFFFF,
@@ -201,12 +200,12 @@ class A64Emitter : public oaknut::CodeBlock, public oaknut::CodeGenerator {
201200
void ReloadMembase();
202201

203202
// Moves a 64bit immediate into memory.
204-
bool ConstantFitsIn32Reg(uint64_t v);
203+
static bool ConstantFitsIn32Reg(uint64_t v);
205204
void MovMem64(const oaknut::XRegSp& addr, intptr_t offset, uint64_t v);
206205

207206
std::byte* GetVConstPtr() const;
208207
std::byte* GetVConstPtr(VConst id) const;
209-
constexpr uintptr_t GetVConstOffset(VConst id) const {
208+
static constexpr uintptr_t GetVConstOffset(VConst id){
210209
return sizeof(vec128_t) * id;
211210
}
212211
void LoadConstantV(oaknut::QReg dest, float v);

src/xenia/cpu/backend/a64/a64_seq_vector.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1746,7 +1746,7 @@ struct UNPACK : Sequence<UNPACK, I<OPCODE_UNPACK, V128Op, V128Op>> {
17461746

17471747
if (i.src1.is_constant) {
17481748
if (i.src1.value->IsConstantZero()) {
1749-
e.LDR(i.dest.reg(), VConstData, e.GetVConstOffset(VOne));
1749+
e.FMOV(i.dest.reg().S4(), FImm8(0, 7, 0));
17501750
return;
17511751
}
17521752
src = i.dest;
@@ -1759,7 +1759,7 @@ struct UNPACK : Sequence<UNPACK, I<OPCODE_UNPACK, V128Op, V128Op>> {
17591759
e.LDR(Q1, VConstData, e.GetVConstOffset(VUnpackD3DCOLOR));
17601760
e.TBL(i.dest.reg().B16(), oaknut::List{src.B16()}, Q1.B16());
17611761
// Add 1.0f to each.
1762-
e.LDR(Q1, VConstData, e.GetVConstOffset(VOne));
1762+
e.FMOV(Q1.S4(), FImm8(0, 7, 0));
17631763
e.EOR(i.dest.reg().B16(), i.dest.reg().B16(), Q1.B16());
17641764
// To convert to 0 to 1, games multiply by 0x47008081 and add 0xC7008081.
17651765
}

0 commit comments

Comments
 (0)