From 271218b733b3e6870769415900f0b75923049a24 Mon Sep 17 00:00:00 2001 From: merry Date: Sat, 11 Nov 2023 12:57:01 +0000 Subject: [PATCH] shader_jit_a64_compiler: Improve MAX, MIN (#7137) --- .../shader/shader_jit_a64_compiler.cpp | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/video_core/shader/shader_jit_a64_compiler.cpp b/src/video_core/shader/shader_jit_a64_compiler.cpp index 2eff827f54..61dfadb9ed 100644 --- a/src/video_core/shader/shader_jit_a64_compiler.cpp +++ b/src/video_core/shader/shader_jit_a64_compiler.cpp @@ -548,13 +548,8 @@ void JitShader::Compile_MAX(Instruction instr) { Compile_SwizzleSrc(instr, 1, instr.common.src1, SRC1); Compile_SwizzleSrc(instr, 2, instr.common.src2, SRC2); - // VSCRATCH0 = Ordinal(SRC1) - FCMEQ(VSCRATCH0.S4(), SRC1.S4(), SRC1.S4()); - - // FMAX will always pick the NaN - FMAX(SRC1.S4(), SRC1.S4(), SRC2.S4()); - - // In the case of NaN, pick SRC2 + // Equivalent to (b < a) ? a : b with associated NaN caveats + FCMGT(VSCRATCH0.S4(), SRC1.S4(), SRC2.S4()); BIF(SRC1.B16(), SRC2.B16(), VSCRATCH0.B16()); Compile_DestEnable(instr, SRC1); @@ -564,13 +559,8 @@ void JitShader::Compile_MIN(Instruction instr) { Compile_SwizzleSrc(instr, 1, instr.common.src1, SRC1); Compile_SwizzleSrc(instr, 2, instr.common.src2, SRC2); - // VSCRATCH0 = Ordinal(SRC1) - FCMEQ(VSCRATCH0.S4(), SRC1.S4(), SRC1.S4()); - - // FMIN will always pick the NaN - FMIN(SRC1.S4(), SRC1.S4(), SRC2.S4()); - - // In the case of NaN, pick SRC2 + // Equivalent to (a < b) ? a : b with associated NaN caveats + FCMGT(VSCRATCH0.S4(), SRC2.S4(), SRC1.S4()); BIF(SRC1.B16(), SRC2.B16(), VSCRATCH0.B16()); Compile_DestEnable(instr, SRC1);