| 120 | } |
| 121 | |
| 122 | void OpDispatchBuilder::FADDF64(OpcodeArgs, IR::OpSize Width, bool Integer, OpDispatchBuilder::OpResult ResInST0) { |
| 123 | if (Op->Src[0].IsNone()) { // Implicit argument case |
| 124 | auto Offset = Op->OP & 7; |
| 125 | auto St0 = 0; |
| 126 | if (ResInST0 == OpResult::RES_STI) { |
| 127 | _F80AddStack(Offset, St0); |
| 128 | } else { |
| 129 | _F80AddStack(St0, Offset); |
| 130 | } |
| 131 | if (Op->TableInfo->Flags & X86Tables::InstFlags::FLAGS_POP) { |
| 132 | _PopStackDestroy(); |
| 133 | } |
| 134 | return; |
| 135 | } |
| 136 | |
| 137 | // We have one memory argument |
| 138 | Ref arg {}; |
| 139 | |
| 140 | if (Integer) { |
| 141 | arg = LoadSource(GPRClass, Op, Op->Src[0], Op->Flags); |
| 142 | if (Width == OpSize::i16Bit) { |
| 143 | arg = _Sbfe(OpSize::i64Bit, 16, 0, arg); |
| 144 | } |
| 145 | arg = _Float_FromGPR_S(OpSize::i64Bit, Width == OpSize::i64Bit ? OpSize::i64Bit : OpSize::i32Bit, arg); |
| 146 | } else if (Width == OpSize::i32Bit) { |
| 147 | arg = LoadSource(FPRClass, Op, Op->Src[0], Op->Flags); |
| 148 | arg = _Float_FToF(OpSize::i64Bit, OpSize::i32Bit, arg); |
| 149 | } else if (Width == OpSize::i64Bit) { |
| 150 | arg = LoadSource(FPRClass, Op, Op->Src[0], Op->Flags); |
| 151 | } else { |
| 152 | FEX_UNREACHABLE; |
| 153 | } |
| 154 | |
| 155 | // top of stack is at offset zero |
| 156 | _F80AddValue(0, arg); |
| 157 | } |
| 158 | |
| 159 | // FIXME: following is very similar to FADDF64 |
| 160 | void OpDispatchBuilder::FMULF64(OpcodeArgs, IR::OpSize Width, bool Integer, OpDispatchBuilder::OpResult ResInST0) { |