From 56667002fd757cae2a3330f38a8836f4948c42fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A4in=C3=B6=20M=C3=A4kel=C3=A4?= Date: Thu, 8 Dec 2022 17:52:04 +0200 Subject: [PATCH] intel/vec4: Don't optimize multiply by 1.0 away The SPIR-V compiler's implementation of tanh generates a multiply by 1.0 to flush denorms to zero. Reviewed-by: Emma Anholt Part-of: --- src/intel/compiler/brw_vec4.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/intel/compiler/brw_vec4.cpp b/src/intel/compiler/brw_vec4.cpp index 6d767254221..64e6f29f52a 100644 --- a/src/intel/compiler/brw_vec4.cpp +++ b/src/intel/compiler/brw_vec4.cpp @@ -668,6 +668,12 @@ vec4_visitor::opt_algebraic() break; case BRW_OPCODE_MUL: + if (inst->src[1].file != IMM) + continue; + + if (brw_reg_type_is_floating_point(inst->src[1].type)) + break; + if (inst->src[1].is_zero()) { inst->opcode = BRW_OPCODE_MOV; switch (inst->src[0].type) {