1 /* This file is part of the dynarmic project. 2 * Copyright (c) 2016 MerryMage 3 * SPDX-License-Identifier: 0BSD 4 */ 5 6 #pragma once 7 8 #include "common/common_types.h" 9 #include "frontend/ir/basic_block.h" 10 #include "frontend/ir/location_descriptor.h" 11 #include "frontend/ir/terminal.h" 12 #include "frontend/ir/value.h" 13 14 namespace Dynarmic::FP { 15 enum class RoundingMode; 16 } // namespace Dynarmic::FP 17 18 // ARM JIT Microinstruction Intermediate Representation 19 // 20 // This intermediate representation is an SSA IR. It is designed primarily for analysis, 21 // though it can be lowered into a reduced form for interpretation. Each IR node (Value) 22 // is a microinstruction of an idealised ARM CPU. The choice of microinstructions is made 23 // not based on any existing microarchitecture but on ease of implementation. 24 25 namespace Dynarmic::IR { 26 27 enum class Opcode; 28 29 template <typename T> 30 struct ResultAndCarry { 31 T result; 32 U1 carry; 33 }; 34 35 template <typename T> 36 struct ResultAndOverflow { 37 T result; 38 U1 overflow; 39 }; 40 41 template <typename T> 42 struct ResultAndCarryAndOverflow { 43 T result; 44 U1 carry; 45 U1 overflow; 46 }; 47 48 template <typename T> 49 struct ResultAndGE { 50 T result; 51 U32 ge; 52 }; 53 54 struct UpperAndLower { 55 U128 upper; 56 U128 lower; 57 }; 58 59 enum class AccType { 60 NORMAL, VEC, STREAM, VECSTREAM, 61 ATOMIC, ORDERED, ORDEREDRW, LIMITEDORDERED, 62 UNPRIV, IFETCH, PTW, DC, IC, DCZVA, AT, 63 }; 64 65 enum class MemOp { 66 LOAD, STORE, PREFETCH, 67 }; 68 69 /** 70 * Convenience class to construct a basic block of the intermediate representation. 71 * `block` is the resulting block. 72 * The user of this class updates `current_location` as appropriate. 73 */ 74 class IREmitter { 75 public: IREmitter(Block & block)76 explicit IREmitter(Block& block) : block(block), insertion_point(block.end()) {} 77 78 Block& block; 79 80 U1 Imm1(bool value) const; 81 U8 Imm8(u8 value) const; 82 U16 Imm16(u16 value) const; 83 U32 Imm32(u32 value) const; 84 U64 Imm64(u64 value) const; 85 86 void PushRSB(const LocationDescriptor& return_location); 87 88 U64 Pack2x32To1x64(const U32& lo, const U32& hi); 89 U128 Pack2x64To1x128(const U64& lo, const U64& hi); 90 UAny LeastSignificant(size_t bitsize, const U32U64& value); 91 U32 LeastSignificantWord(const U64& value); 92 U16 LeastSignificantHalf(U32U64 value); 93 U8 LeastSignificantByte(U32U64 value); 94 ResultAndCarry<U32> MostSignificantWord(const U64& value); 95 U1 MostSignificantBit(const U32& value); 96 U1 IsZero(const U32& value); 97 U1 IsZero(const U64& value); 98 U1 IsZero(const U32U64& value); 99 U1 TestBit(const U32U64& value, const U8& bit); 100 U32 ConditionalSelect(Cond cond, const U32& a, const U32& b); 101 U64 ConditionalSelect(Cond cond, const U64& a, const U64& b); 102 NZCV ConditionalSelect(Cond cond, const NZCV& a, const NZCV& b); 103 U32U64 ConditionalSelect(Cond cond, const U32U64& a, const U32U64& b); 104 105 NZCV NZCVFromPackedFlags(const U32& a); 106 // This pseudo-instruction may only be added to instructions that support it. 107 NZCV NZCVFrom(const Value& value); 108 109 ResultAndCarry<U32> LogicalShiftLeft(const U32& value_in, const U8& shift_amount, const U1& carry_in); 110 ResultAndCarry<U32> LogicalShiftRight(const U32& value_in, const U8& shift_amount, const U1& carry_in); 111 ResultAndCarry<U32> ArithmeticShiftRight(const U32& value_in, const U8& shift_amount, const U1& carry_in); 112 ResultAndCarry<U32> RotateRight(const U32& value_in, const U8& shift_amount, const U1& carry_in); 113 U32U64 LogicalShiftLeft(const U32U64& value_in, const U8& shift_amount); 114 U32U64 LogicalShiftRight(const U32U64& value_in, const U8& shift_amount); 115 U32U64 ArithmeticShiftRight(const U32U64& value_in, const U8& shift_amount); 116 U32U64 RotateRight(const U32U64& value_in, const U8& shift_amount); 117 U32U64 LogicalShiftLeftMasked(const U32U64& value_in, const U32U64& shift_amount); 118 U32U64 LogicalShiftRightMasked(const U32U64& value_in, const U32U64& shift_amount); 119 U32U64 ArithmeticShiftRightMasked(const U32U64& value_in, const U32U64& shift_amount); 120 U32U64 RotateRightMasked(const U32U64& value_in, const U32U64& shift_amount); 121 ResultAndCarry<U32> RotateRightExtended(const U32& value_in, const U1& carry_in); 122 ResultAndCarryAndOverflow<U32> AddWithCarry(const U32& a, const U32& b, const U1& carry_in); 123 ResultAndCarryAndOverflow<U32> SubWithCarry(const U32& a, const U32& b, const U1& carry_in); 124 U32U64 AddWithCarry(const U32U64& a, const U32U64& b, const U1& carry_in); 125 U32U64 SubWithCarry(const U32U64& a, const U32U64& b, const U1& carry_in); 126 U32U64 Add(const U32U64& a, const U32U64& b); 127 U32U64 Sub(const U32U64& a, const U32U64& b); 128 U32U64 Mul(const U32U64& a, const U32U64& b); 129 U64 UnsignedMultiplyHigh(const U64& a, const U64& b); 130 U64 SignedMultiplyHigh(const U64& a, const U64& b); 131 U32U64 UnsignedDiv(const U32U64& a, const U32U64& b); 132 U32U64 SignedDiv(const U32U64& a, const U32U64& b); 133 U32U64 And(const U32U64& a, const U32U64& b); 134 U32U64 Eor(const U32U64& a, const U32U64& b); 135 U32U64 Or(const U32U64& a, const U32U64& b); 136 U32U64 Not(const U32U64& a); 137 U32 SignExtendToWord(const UAny& a); 138 U64 SignExtendToLong(const UAny& a); 139 U32 SignExtendByteToWord(const U8& a); 140 U32 SignExtendHalfToWord(const U16& a); 141 U64 SignExtendWordToLong(const U32& a); 142 U32 ZeroExtendToWord(const UAny& a); 143 U64 ZeroExtendToLong(const UAny& a); 144 U128 ZeroExtendToQuad(const UAny& a); 145 U32 ZeroExtendByteToWord(const U8& a); 146 U32 ZeroExtendHalfToWord(const U16& a); 147 U64 ZeroExtendWordToLong(const U32& a); 148 U32 IndeterminateExtendToWord(const UAny& a); 149 U64 IndeterminateExtendToLong(const UAny& a); 150 U32 ByteReverseWord(const U32& a); 151 U16 ByteReverseHalf(const U16& a); 152 U64 ByteReverseDual(const U64& a); 153 U32U64 CountLeadingZeros(const U32U64& a); 154 U32U64 ExtractRegister(const U32U64& a, const U32U64& b, const U8& lsb); 155 U32U64 ReplicateBit(const U32U64& a, u8 bit); 156 U32U64 MaxSigned(const U32U64& a, const U32U64& b); 157 U32U64 MaxUnsigned(const U32U64& a, const U32U64& b); 158 U32U64 MinSigned(const U32U64& a, const U32U64& b); 159 U32U64 MinUnsigned(const U32U64& a, const U32U64& b); 160 161 ResultAndOverflow<UAny> SignedSaturatedAdd(const UAny& a, const UAny& b); 162 ResultAndOverflow<UAny> SignedSaturatedDoublingMultiplyReturnHigh(const UAny& a, const UAny& b); 163 ResultAndOverflow<UAny> SignedSaturatedSub(const UAny& a, const UAny& b); 164 ResultAndOverflow<U32> SignedSaturation(const U32& a, size_t bit_size_to_saturate_to); 165 ResultAndOverflow<UAny> UnsignedSaturatedAdd(const UAny& a, const UAny& b); 166 ResultAndOverflow<UAny> UnsignedSaturatedSub(const UAny& a, const UAny& b); 167 ResultAndOverflow<U32> UnsignedSaturation(const U32& a, size_t bit_size_to_saturate_to); 168 169 U128 VectorSignedSaturatedAdd(size_t esize, const U128& a, const U128& b); 170 U128 VectorSignedSaturatedSub(size_t esize, const U128& a, const U128& b); 171 U128 VectorUnsignedSaturatedAdd(size_t esize, const U128& a, const U128& b); 172 U128 VectorUnsignedSaturatedSub(size_t esize, const U128& a, const U128& b); 173 174 ResultAndGE<U32> PackedAddU8(const U32& a, const U32& b); 175 ResultAndGE<U32> PackedAddS8(const U32& a, const U32& b); 176 ResultAndGE<U32> PackedAddU16(const U32& a, const U32& b); 177 ResultAndGE<U32> PackedAddS16(const U32& a, const U32& b); 178 ResultAndGE<U32> PackedSubU8(const U32& a, const U32& b); 179 ResultAndGE<U32> PackedSubS8(const U32& a, const U32& b); 180 ResultAndGE<U32> PackedSubU16(const U32& a, const U32& b); 181 ResultAndGE<U32> PackedSubS16(const U32& a, const U32& b); 182 ResultAndGE<U32> PackedAddSubU16(const U32& a, const U32& b); 183 ResultAndGE<U32> PackedAddSubS16(const U32& a, const U32& b); 184 ResultAndGE<U32> PackedSubAddU16(const U32& a, const U32& b); 185 ResultAndGE<U32> PackedSubAddS16(const U32& a, const U32& b); 186 U32 PackedHalvingAddU8(const U32& a, const U32& b); 187 U32 PackedHalvingAddS8(const U32& a, const U32& b); 188 U32 PackedHalvingSubU8(const U32& a, const U32& b); 189 U32 PackedHalvingSubS8(const U32& a, const U32& b); 190 U32 PackedHalvingAddU16(const U32& a, const U32& b); 191 U32 PackedHalvingAddS16(const U32& a, const U32& b); 192 U32 PackedHalvingSubU16(const U32& a, const U32& b); 193 U32 PackedHalvingSubS16(const U32& a, const U32& b); 194 U32 PackedHalvingAddSubU16(const U32& a, const U32& b); 195 U32 PackedHalvingAddSubS16(const U32& a, const U32& b); 196 U32 PackedHalvingSubAddU16(const U32& a, const U32& b); 197 U32 PackedHalvingSubAddS16(const U32& a, const U32& b); 198 U32 PackedSaturatedAddU8(const U32& a, const U32& b); 199 U32 PackedSaturatedAddS8(const U32& a, const U32& b); 200 U32 PackedSaturatedSubU8(const U32& a, const U32& b); 201 U32 PackedSaturatedSubS8(const U32& a, const U32& b); 202 U32 PackedSaturatedAddU16(const U32& a, const U32& b); 203 U32 PackedSaturatedAddS16(const U32& a, const U32& b); 204 U32 PackedSaturatedSubU16(const U32& a, const U32& b); 205 U32 PackedSaturatedSubS16(const U32& a, const U32& b); 206 U32 PackedAbsDiffSumS8(const U32& a, const U32& b); 207 U32 PackedSelect(const U32& ge, const U32& a, const U32& b); 208 209 U32 CRC32Castagnoli8(const U32& a, const U32& b); 210 U32 CRC32Castagnoli16(const U32& a, const U32& b); 211 U32 CRC32Castagnoli32(const U32& a, const U32& b); 212 U32 CRC32Castagnoli64(const U32& a, const U64& b); 213 U32 CRC32ISO8(const U32& a, const U32& b); 214 U32 CRC32ISO16(const U32& a, const U32& b); 215 U32 CRC32ISO32(const U32& a, const U32& b); 216 U32 CRC32ISO64(const U32& a, const U64& b); 217 218 U128 AESDecryptSingleRound(const U128& a); 219 U128 AESEncryptSingleRound(const U128& a); 220 U128 AESInverseMixColumns(const U128& a); 221 U128 AESMixColumns(const U128& a); 222 223 U8 SM4AccessSubstitutionBox(const U8& a); 224 225 UAny VectorGetElement(size_t esize, const U128& a, size_t index); 226 U128 VectorSetElement(size_t esize, const U128& a, size_t index, const UAny& elem); 227 U128 VectorAbs(size_t esize, const U128& a); 228 U128 VectorAdd(size_t esize, const U128& a, const U128& b); 229 U128 VectorAnd(const U128& a, const U128& b); 230 U128 VectorArithmeticShiftRight(size_t esize, const U128& a, u8 shift_amount); 231 U128 VectorArithmeticVShift(size_t esize, const U128& a, const U128& b); 232 U128 VectorBroadcast(size_t esize, const UAny& a); 233 U128 VectorBroadcastLower(size_t esize, const UAny& a); 234 U128 VectorCountLeadingZeros(size_t esize, const U128& a); 235 U128 VectorEor(const U128& a, const U128& b); 236 U128 VectorDeinterleaveEven(size_t esize, const U128& a, const U128& b); 237 U128 VectorDeinterleaveOdd(size_t esize, const U128& a, const U128& b); 238 U128 VectorEqual(size_t esize, const U128& a, const U128& b); 239 U128 VectorExtract(const U128& a, const U128& b, size_t position); 240 U128 VectorExtractLower(const U128& a, const U128& b, size_t position); 241 U128 VectorGreaterEqualSigned(size_t esize, const U128& a, const U128& b); 242 U128 VectorGreaterEqualUnsigned(size_t esize, const U128& a, const U128& b); 243 U128 VectorGreaterSigned(size_t esize, const U128& a, const U128& b); 244 U128 VectorGreaterUnsigned(size_t esize, const U128& a, const U128& b); 245 U128 VectorHalvingAddSigned(size_t esize, const U128& a, const U128& b); 246 U128 VectorHalvingAddUnsigned(size_t esize, const U128& a, const U128& b); 247 U128 VectorHalvingSubSigned(size_t esize, const U128& a, const U128& b); 248 U128 VectorHalvingSubUnsigned(size_t esize, const U128& a, const U128& b); 249 U128 VectorInterleaveLower(size_t esize, const U128& a, const U128& b); 250 U128 VectorInterleaveUpper(size_t esize, const U128& a, const U128& b); 251 U128 VectorLessEqualSigned(size_t esize, const U128& a, const U128& b); 252 U128 VectorLessEqualUnsigned(size_t esize, const U128& a, const U128& b); 253 U128 VectorLessSigned(size_t esize, const U128& a, const U128& b); 254 U128 VectorLessUnsigned(size_t esize, const U128& a, const U128& b); 255 U128 VectorLogicalShiftLeft(size_t esize, const U128& a, u8 shift_amount); 256 U128 VectorLogicalShiftRight(size_t esize, const U128& a, u8 shift_amount); 257 U128 VectorLogicalVShift(size_t esize, const U128& a, const U128& b); 258 U128 VectorMaxSigned(size_t esize, const U128& a, const U128& b); 259 U128 VectorMaxUnsigned(size_t esize, const U128& a, const U128& b); 260 U128 VectorMinSigned(size_t esize, const U128& a, const U128& b); 261 U128 VectorMinUnsigned(size_t esize, const U128& a, const U128& b); 262 U128 VectorMultiply(size_t esize, const U128& a, const U128& b); 263 U128 VectorNarrow(size_t original_esize, const U128& a); 264 U128 VectorNot(const U128& a); 265 U128 VectorOr(const U128& a, const U128& b); 266 U128 VectorPairedAdd(size_t esize, const U128& a, const U128& b); 267 U128 VectorPairedAddLower(size_t esize, const U128& a, const U128& b); 268 U128 VectorPairedAddSignedWiden(size_t original_esize, const U128& a); 269 U128 VectorPairedAddUnsignedWiden(size_t original_esize, const U128& a); 270 U128 VectorPairedMaxSigned(size_t esize, const U128& a, const U128& b); 271 U128 VectorPairedMaxUnsigned(size_t esize, const U128& a, const U128& b); 272 U128 VectorPairedMinSigned(size_t esize, const U128& a, const U128& b); 273 U128 VectorPairedMinUnsigned(size_t esize, const U128& a, const U128& b); 274 U128 VectorPolynomialMultiply(const U128& a, const U128& b); 275 U128 VectorPolynomialMultiplyLong(size_t esize, const U128& a, const U128& b); 276 U128 VectorPopulationCount(const U128& a); 277 U128 VectorReverseBits(const U128& a); 278 U128 VectorRotateLeft(size_t esize, const U128& a, u8 amount); 279 U128 VectorRotateRight(size_t esize, const U128& a, u8 amount); 280 U128 VectorRoundingHalvingAddSigned(size_t esize, const U128& a, const U128& b); 281 U128 VectorRoundingHalvingAddUnsigned(size_t esize, const U128& a, const U128& b); 282 U128 VectorRoundingShiftLeftSigned(size_t esize, const U128& a, const U128& b); 283 U128 VectorRoundingShiftLeftUnsigned(size_t esize, const U128& a, const U128& b); 284 U128 VectorShuffleHighHalfwords(const U128& a, u8 mask); 285 U128 VectorShuffleLowHalfwords(const U128& a, u8 mask); 286 U128 VectorShuffleWords(const U128& a, u8 mask); 287 U128 VectorSignExtend(size_t original_esize, const U128& a); 288 U128 VectorSignedAbsoluteDifference(size_t esize, const U128& a, const U128& b); 289 UpperAndLower VectorSignedMultiply(size_t esize, const U128& a, const U128& b); 290 U128 VectorSignedSaturatedAbs(size_t esize, const U128& a); 291 U128 VectorSignedSaturatedAccumulateUnsigned(size_t esize, const U128& a, const U128& b); 292 UpperAndLower VectorSignedSaturatedDoublingMultiply(size_t esize, const U128& a, const U128& b); 293 U128 VectorSignedSaturatedDoublingMultiplyLong(size_t esize, const U128& a, const U128& b); 294 U128 VectorSignedSaturatedNarrowToSigned(size_t original_esize, const U128& a); 295 U128 VectorSignedSaturatedNarrowToUnsigned(size_t original_esize, const U128& a); 296 U128 VectorSignedSaturatedNeg(size_t esize, const U128& a); 297 U128 VectorSignedSaturatedShiftLeft(size_t esize, const U128& a, const U128& b); 298 U128 VectorSignedSaturatedShiftLeftUnsigned(size_t esize, const U128& a, const U128& b); 299 U128 VectorSub(size_t esize, const U128& a, const U128& b); 300 Table VectorTable(std::vector<U128> values); 301 U128 VectorTableLookup(const U128& defaults, const Table& table, const U128& indices); 302 U128 VectorUnsignedAbsoluteDifference(size_t esize, const U128& a, const U128& b); 303 U128 VectorUnsignedRecipEstimate(const U128& a); 304 U128 VectorUnsignedRecipSqrtEstimate(const U128& a); 305 U128 VectorUnsignedSaturatedAccumulateSigned(size_t esize, const U128& a, const U128& b); 306 U128 VectorUnsignedSaturatedNarrow(size_t esize, const U128& a); 307 U128 VectorUnsignedSaturatedShiftLeft(size_t esize, const U128& a, const U128& b); 308 U128 VectorZeroExtend(size_t original_esize, const U128& a); 309 U128 VectorZeroUpper(const U128& a); 310 U128 ZeroVector(); 311 312 U16U32U64 FPAbs(const U16U32U64& a); 313 U32U64 FPAdd(const U32U64& a, const U32U64& b, bool fpcr_controlled); 314 NZCV FPCompare(const U32U64& a, const U32U64& b, bool exc_on_qnan, bool fpcr_controlled); 315 U32U64 FPDiv(const U32U64& a, const U32U64& b, bool fpcr_controlled); 316 U32U64 FPMax(const U32U64& a, const U32U64& b, bool fpcr_controlled); 317 U32U64 FPMaxNumeric(const U32U64& a, const U32U64& b, bool fpcr_controlled); 318 U32U64 FPMin(const U32U64& a, const U32U64& b, bool fpcr_controlled); 319 U32U64 FPMinNumeric(const U32U64& a, const U32U64& b, bool fpcr_controlled); 320 U32U64 FPMul(const U32U64& a, const U32U64& b, bool fpcr_controlled); 321 U16U32U64 FPMulAdd(const U16U32U64& addend, const U16U32U64& op1, const U16U32U64& op2, bool fpcr_controlled); 322 U32U64 FPMulX(const U32U64& a, const U32U64& b); 323 U16U32U64 FPNeg(const U16U32U64& a); 324 U16U32U64 FPRecipEstimate(const U16U32U64& a); 325 U16U32U64 FPRecipExponent(const U16U32U64& a); 326 U16U32U64 FPRecipStepFused(const U16U32U64& a, const U16U32U64& b); 327 U16U32U64 FPRoundInt(const U16U32U64& a, FP::RoundingMode rounding, bool exact); 328 U16U32U64 FPRSqrtEstimate(const U16U32U64& a); 329 U16U32U64 FPRSqrtStepFused(const U16U32U64& a, const U16U32U64& b); 330 U32U64 FPSqrt(const U32U64& a); 331 U32U64 FPSub(const U32U64& a, const U32U64& b, bool fpcr_controlled); 332 U16 FPDoubleToHalf(const U64& a, FP::RoundingMode rounding); 333 U32 FPDoubleToSingle(const U64& a, FP::RoundingMode rounding); 334 U64 FPHalfToDouble(const U16& a, FP::RoundingMode rounding); 335 U32 FPHalfToSingle(const U16& a, FP::RoundingMode rounding); 336 U16 FPSingleToHalf(const U32& a, FP::RoundingMode rounding); 337 U64 FPSingleToDouble(const U32& a, FP::RoundingMode rounding); 338 U32 FPToFixedS32(const U16U32U64& a, size_t fbits, FP::RoundingMode rounding); 339 U64 FPToFixedS64(const U16U32U64& a, size_t fbits, FP::RoundingMode rounding); 340 U32 FPToFixedU32(const U16U32U64& a, size_t fbits, FP::RoundingMode rounding); 341 U64 FPToFixedU64(const U16U32U64& a, size_t fbits, FP::RoundingMode rounding); 342 U32 FPSignedFixedToSingle(const U32U64& a, size_t fbits, FP::RoundingMode rounding); 343 U32 FPUnsignedFixedToSingle(const U32U64& a, size_t fbits, FP::RoundingMode rounding); 344 U64 FPSignedFixedToDouble(const U32U64& a, size_t fbits, FP::RoundingMode rounding); 345 U64 FPUnsignedFixedToDouble(const U32U64& a, size_t fbits, FP::RoundingMode rounding); 346 347 U128 FPVectorAbs(size_t esize, const U128& a); 348 U128 FPVectorAdd(size_t esize, const U128& a, const U128& b); 349 U128 FPVectorDiv(size_t esize, const U128& a, const U128& b); 350 U128 FPVectorEqual(size_t esize, const U128& a, const U128& b); 351 U128 FPVectorFromSignedFixed(size_t esize, const U128& a, size_t fbits, FP::RoundingMode rounding); 352 U128 FPVectorFromUnsignedFixed(size_t esize, const U128& a, size_t fbits, FP::RoundingMode rounding); 353 U128 FPVectorGreater(size_t esize, const U128& a, const U128& b); 354 U128 FPVectorGreaterEqual(size_t esize, const U128& a, const U128& b); 355 U128 FPVectorMax(size_t esize, const U128& a, const U128& b); 356 U128 FPVectorMin(size_t esize, const U128& a, const U128& b); 357 U128 FPVectorMul(size_t esize, const U128& a, const U128& b); 358 U128 FPVectorMulAdd(size_t esize, const U128& addend, const U128& op1, const U128& op2); 359 U128 FPVectorMulX(size_t esize, const U128& a, const U128& b); 360 U128 FPVectorNeg(size_t esize, const U128& a); 361 U128 FPVectorPairedAdd(size_t esize, const U128& a, const U128& b); 362 U128 FPVectorPairedAddLower(size_t esize, const U128& a, const U128& b); 363 U128 FPVectorRecipEstimate(size_t esize, const U128& a); 364 U128 FPVectorRecipStepFused(size_t esize, const U128& a, const U128& b); 365 U128 FPVectorRoundInt(size_t esize, const U128& operand, FP::RoundingMode rounding, bool exact); 366 U128 FPVectorRSqrtEstimate(size_t esize, const U128& a); 367 U128 FPVectorRSqrtStepFused(size_t esize, const U128& a, const U128& b); 368 U128 FPVectorSqrt(size_t esize, const U128& a); 369 U128 FPVectorSub(size_t esize, const U128& a, const U128& b); 370 U128 FPVectorToSignedFixed(size_t esize, const U128& a, size_t fbits, FP::RoundingMode rounding); 371 U128 FPVectorToUnsignedFixed(size_t esize, const U128& a, size_t fbits, FP::RoundingMode rounding); 372 373 void Breakpoint(); 374 375 void SetTerm(const Terminal& terminal); 376 SetInsertionPoint(IR::Inst * new_insertion_point)377 void SetInsertionPoint(IR::Inst* new_insertion_point) { 378 insertion_point = IR::Block::iterator{*new_insertion_point}; 379 } 380 SetInsertionPoint(IR::Block::iterator new_insertion_point)381 void SetInsertionPoint(IR::Block::iterator new_insertion_point) { 382 insertion_point = new_insertion_point; 383 } 384 385 protected: 386 IR::Block::iterator insertion_point; 387 388 template<typename T = Value, typename ...Args> Inst(Opcode op,Args...args)389 T Inst(Opcode op, Args ...args) { 390 auto iter = block.PrependNewInst(insertion_point, op, {Value(args)...}); 391 return T(Value(&*iter)); 392 } 393 }; 394 395 } // namespace Dynarmic::IR 396