diff options
Diffstat (limited to 'src/shader_recompiler/frontend/ir')
-rw-r--r-- | src/shader_recompiler/frontend/ir/ir_emitter.cpp | 60 | ||||
-rw-r--r-- | src/shader_recompiler/frontend/ir/ir_emitter.h | 10 |
2 files changed, 36 insertions, 34 deletions
diff --git a/src/shader_recompiler/frontend/ir/ir_emitter.cpp b/src/shader_recompiler/frontend/ir/ir_emitter.cpp index 354d72c9b..ce6c9af07 100644 --- a/src/shader_recompiler/frontend/ir/ir_emitter.cpp +++ b/src/shader_recompiler/frontend/ir/ir_emitter.cpp @@ -1622,84 +1622,86 @@ U32U64 IREmitter::ConvertFToI(size_t bitsize, bool is_signed, const F16F32F64& v return is_signed ? ConvertFToS(bitsize, value) : ConvertFToU(bitsize, value); } -F16F32F64 IREmitter::ConvertSToF(size_t dest_bitsize, size_t src_bitsize, const Value& value) { +F16F32F64 IREmitter::ConvertSToF(size_t dest_bitsize, size_t src_bitsize, const Value& value, + FpControl control) { switch (dest_bitsize) { case 16: switch (src_bitsize) { case 8: - return Inst<F16>(Opcode::ConvertF16S8, value); + return Inst<F16>(Opcode::ConvertF16S8, Flags{control}, value); case 16: - return Inst<F16>(Opcode::ConvertF16S16, value); + return Inst<F16>(Opcode::ConvertF16S16, Flags{control}, value); case 32: - return Inst<F16>(Opcode::ConvertF16S32, value); + return Inst<F16>(Opcode::ConvertF16S32, Flags{control}, value); case 64: - return Inst<F16>(Opcode::ConvertF16S64, value); + return Inst<F16>(Opcode::ConvertF16S64, Flags{control}, value); } break; case 32: switch (src_bitsize) { case 8: - return Inst<F32>(Opcode::ConvertF32S8, value); + return Inst<F32>(Opcode::ConvertF32S8, Flags{control}, value); case 16: - return Inst<F32>(Opcode::ConvertF32S16, value); + return Inst<F32>(Opcode::ConvertF32S16, Flags{control}, value); case 32: - return Inst<F32>(Opcode::ConvertF32S32, value); + return Inst<F32>(Opcode::ConvertF32S32, Flags{control}, value); case 64: - return Inst<F32>(Opcode::ConvertF32S64, value); + return Inst<F32>(Opcode::ConvertF32S64, Flags{control}, value); } break; case 64: switch (src_bitsize) { case 8: - return Inst<F64>(Opcode::ConvertF64S8, value); + return Inst<F64>(Opcode::ConvertF64S8, Flags{control}, value); case 16: - return Inst<F64>(Opcode::ConvertF64S16, value); + return Inst<F64>(Opcode::ConvertF64S16, Flags{control}, value); case 32: - return Inst<F64>(Opcode::ConvertF64S32, value); + return Inst<F64>(Opcode::ConvertF64S32, Flags{control}, value); case 64: - return Inst<F64>(Opcode::ConvertF64S64, value); + return Inst<F64>(Opcode::ConvertF64S64, Flags{control}, value); } break; } throw InvalidArgument("Invalid bit size combination dst={} src={}", dest_bitsize, src_bitsize); } -F16F32F64 IREmitter::ConvertUToF(size_t dest_bitsize, size_t src_bitsize, const Value& value) { +F16F32F64 IREmitter::ConvertUToF(size_t dest_bitsize, size_t src_bitsize, const Value& value, + FpControl control) { switch (dest_bitsize) { case 16: switch (src_bitsize) { case 8: - return Inst<F16>(Opcode::ConvertF16U8, value); + return Inst<F16>(Opcode::ConvertF16U8, Flags{control}, value); case 16: - return Inst<F16>(Opcode::ConvertF16U16, value); + return Inst<F16>(Opcode::ConvertF16U16, Flags{control}, value); case 32: - return Inst<F16>(Opcode::ConvertF16U32, value); + return Inst<F16>(Opcode::ConvertF16U32, Flags{control}, value); case 64: - return Inst<F16>(Opcode::ConvertF16U64, value); + return Inst<F16>(Opcode::ConvertF16U64, Flags{control}, value); } break; case 32: switch (src_bitsize) { case 8: - return Inst<F32>(Opcode::ConvertF32U8, value); + return Inst<F32>(Opcode::ConvertF32U8, Flags{control}, value); case 16: - return Inst<F32>(Opcode::ConvertF32U16, value); + return Inst<F32>(Opcode::ConvertF32U16, Flags{control}, value); case 32: - return Inst<F32>(Opcode::ConvertF32U32, value); + return Inst<F32>(Opcode::ConvertF32U32, Flags{control}, value); case 64: - return Inst<F32>(Opcode::ConvertF32U64, value); + return Inst<F32>(Opcode::ConvertF32U64, Flags{control}, value); } break; case 64: switch (src_bitsize) { case 8: - return Inst<F64>(Opcode::ConvertF64U8, value); + return Inst<F64>(Opcode::ConvertF64U8, Flags{control}, value); case 16: - return Inst<F64>(Opcode::ConvertF64U16, value); + return Inst<F64>(Opcode::ConvertF64U16, Flags{control}, value); case 32: - return Inst<F64>(Opcode::ConvertF64U32, value); + return Inst<F64>(Opcode::ConvertF64U32, Flags{control}, value); case 64: - return Inst<F64>(Opcode::ConvertF64U64, value); + return Inst<F64>(Opcode::ConvertF64U64, Flags{control}, value); } break; } @@ -1707,9 +1709,9 @@ F16F32F64 IREmitter::ConvertUToF(size_t dest_bitsize, size_t src_bitsize, const } F16F32F64 IREmitter::ConvertIToF(size_t dest_bitsize, size_t src_bitsize, bool is_signed, - const Value& value) { - return is_signed ? ConvertSToF(dest_bitsize, src_bitsize, value) - : ConvertUToF(dest_bitsize, src_bitsize, value); + const Value& value, FpControl control) { + return is_signed ? ConvertSToF(dest_bitsize, src_bitsize, value, control) + : ConvertUToF(dest_bitsize, src_bitsize, value, control); } U32U64 IREmitter::UConvert(size_t result_bitsize, const U32U64& value) { diff --git a/src/shader_recompiler/frontend/ir/ir_emitter.h b/src/shader_recompiler/frontend/ir/ir_emitter.h index 4e614d424..fd41b7e89 100644 --- a/src/shader_recompiler/frontend/ir/ir_emitter.h +++ b/src/shader_recompiler/frontend/ir/ir_emitter.h @@ -291,12 +291,12 @@ public: [[nodiscard]] U32U64 ConvertFToS(size_t bitsize, const F16F32F64& value); [[nodiscard]] U32U64 ConvertFToU(size_t bitsize, const F16F32F64& value); [[nodiscard]] U32U64 ConvertFToI(size_t bitsize, bool is_signed, const F16F32F64& value); - [[nodiscard]] F16F32F64 ConvertSToF(size_t dest_bitsize, size_t src_bitsize, - const Value& value); - [[nodiscard]] F16F32F64 ConvertUToF(size_t dest_bitsize, size_t src_bitsize, - const Value& value); + [[nodiscard]] F16F32F64 ConvertSToF(size_t dest_bitsize, size_t src_bitsize, const Value& value, + FpControl control = {}); + [[nodiscard]] F16F32F64 ConvertUToF(size_t dest_bitsize, size_t src_bitsize, const Value& value, + FpControl control = {}); [[nodiscard]] F16F32F64 ConvertIToF(size_t dest_bitsize, size_t src_bitsize, bool is_signed, - const Value& value); + const Value& value, FpControl control = {}); [[nodiscard]] U32U64 UConvert(size_t result_bitsize, const U32U64& value); [[nodiscard]] F16F32F64 FPConvert(size_t result_bitsize, const F16F32F64& value, |