From e32828f5fc4d8fac717fab113ab5c837ea2e2bc6 Mon Sep 17 00:00:00 2001 From: Sagar Ghuge Date: Mon, 29 Apr 2024 10:55:09 -0700 Subject: [PATCH] intel/compiler: Fix destination type for CMP/CMPN For CMP/CMPN, use src0 type if destination is null otherwise get the src0 type register with destination register size. This fixes dEQP-VK.glsl.builtin_var.frontfacing.* tests cases on Xe2+. Signed-off-by: Sagar Ghuge Reviewed-by: Francisco Jerez Part-of: --- src/intel/compiler/brw_fs_builder.h | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/intel/compiler/brw_fs_builder.h b/src/intel/compiler/brw_fs_builder.h index dd0daaa850e..6db6e54983c 100644 --- a/src/intel/compiler/brw_fs_builder.h +++ b/src/intel/compiler/brw_fs_builder.h @@ -679,13 +679,14 @@ namespace brw { * Original gfx4 does type conversion to the destination type * before comparison, producing garbage results for floating * point comparisons. - * - * The destination type doesn't matter on newer generations, - * so we set the type to match src0 so we can compact the - * instruction. */ + const enum brw_reg_type type = + dst.is_null() ? + src0.type : + brw_type_with_size(src0.type, brw_type_size_bits(dst.type)); + return set_condmod(condition, - emit(BRW_OPCODE_CMP, retype(dst, src0.type), + emit(BRW_OPCODE_CMP, retype(dst, type), fix_unsigned_negate(src0), fix_unsigned_negate(src1))); } @@ -704,13 +705,14 @@ namespace brw { * Original gfx4 does type conversion to the destination type * before comparison, producing garbage results for floating * point comparisons. - * - * The destination type doesn't matter on newer generations, - * so we set the type to match src0 so we can compact the - * instruction. */ + const enum brw_reg_type type = + dst.is_null() ? + src0.type : + brw_type_with_size(src0.type, brw_type_size_bits(dst.type)); + return set_condmod(condition, - emit(BRW_OPCODE_CMPN, retype(dst, src0.type), + emit(BRW_OPCODE_CMPN, retype(dst, type), fix_unsigned_negate(src0), fix_unsigned_negate(src1))); }