diff --git a/FEXCore/Source/Interface/Core/CPUBackend.cpp b/FEXCore/Source/Interface/Core/CPUBackend.cpp index f4ce5bf526..3c8d94ff04 100644 --- a/FEXCore/Source/Interface/Core/CPUBackend.cpp +++ b/FEXCore/Source/Interface/Core/CPUBackend.cpp @@ -47,6 +47,7 @@ namespace CPU { {0x43E0'0000'0000'0000ULL, 0x43E0'0000'0000'0000ULL}, // NAMED_VECTOR_CVTMAX_F64_I64 {0x8000'0000'8000'0000ULL, 0x8000'0000'8000'0000ULL}, // NAMED_VECTOR_CVTMAX_I32 {0x8000'0000'0000'0000ULL, 0x8000'0000'0000'0000ULL}, // NAMED_VECTOR_CVTMAX_I64 + {0x0000'0000'0000'0000ULL, 0x0000'0000'0000'8000ULL}, // NAMED_VECTOR_F80_SIGN_MASK }; constexpr static auto PSHUFLW_LUT {[]() consteval { diff --git a/FEXCore/Source/Interface/IR/Passes/x87StackOptimizationPass.cpp b/FEXCore/Source/Interface/IR/Passes/x87StackOptimizationPass.cpp index 9c45c769a0..1dd1f58823 100644 --- a/FEXCore/Source/Interface/IR/Passes/x87StackOptimizationPass.cpp +++ b/FEXCore/Source/Interface/IR/Passes/x87StackOptimizationPass.cpp @@ -885,10 +885,7 @@ void X87StackOptimization::Run(IREmitter* Emit) { if (ReducedPrecisionMode) { ResultNode = IREmit->_VFNeg(OpSize::i64Bit, OpSize::i64Bit, Value); } else { - Ref Low = GetConstant(0); - Ref High = GetConstant(0b1'000'0000'0000'0000ULL); - Ref HelperNode = IREmit->_VCastFromGPR(OpSize::i128Bit, OpSize::i64Bit, Low); - HelperNode = IREmit->_VInsGPR(OpSize::i128Bit, OpSize::i64Bit, 1, HelperNode, High); + Ref HelperNode = IREmit->_LoadNamedVectorConstant(OpSize::i128Bit, IR::NamedVectorConstant::NAMED_VECTOR_F80_SIGN_MASK); ResultNode = IREmit->_VXor(OpSize::i128Bit, OpSize::i8Bit, Value, HelperNode); } StoreStackValue(ResultNode); @@ -903,11 +900,8 @@ void X87StackOptimization::Run(IREmitter* Emit) { ResultNode = IREmit->_VFAbs(OpSize::i64Bit, OpSize::i64Bit, Value); } else { // Intermediate insts - Ref Low = GetConstant(~0ULL); - Ref High = GetConstant(0b0'111'1111'1111'1111ULL); - Ref HelperNode = IREmit->_VCastFromGPR(OpSize::i128Bit, OpSize::i64Bit, Low); - HelperNode = IREmit->_VInsGPR(OpSize::i128Bit, OpSize::i64Bit, 1, HelperNode, High); - ResultNode = IREmit->_VAnd(OpSize::i128Bit, OpSize::i8Bit, Value, HelperNode); + Ref HelperNode = IREmit->_LoadNamedVectorConstant(OpSize::i128Bit, IR::NamedVectorConstant::NAMED_VECTOR_F80_SIGN_MASK); + ResultNode = IREmit->_VAndn(OpSize::i128Bit, OpSize::i8Bit, Value, HelperNode); } StoreStackValue(ResultNode); break; diff --git a/FEXCore/include/FEXCore/IR/IR.h b/FEXCore/include/FEXCore/IR/IR.h index febfcaba58..0268d55ff8 100644 --- a/FEXCore/include/FEXCore/IR/IR.h +++ b/FEXCore/include/FEXCore/IR/IR.h @@ -79,6 +79,7 @@ enum NamedVectorConstant : uint8_t { NAMED_VECTOR_CVTMAX_F64_I64, NAMED_VECTOR_CVTMAX_I32, NAMED_VECTOR_CVTMAX_I64, + NAMED_VECTOR_F80_SIGN_MASK, NAMED_VECTOR_CONST_POOL_MAX, // Beginning of named constants that don't have a constant pool backing.