From: Kenneth Graunke Date: Mon, 1 Apr 2019 23:00:25 +0000 (-0700) Subject: intel/mi: Optimize away LOAD_REGISTER_REG from a register to itself X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=79b8e3c260003a7ae4089a03d69aeb0ad50c8c0e;p=mesa.git intel/mi: Optimize away LOAD_REGISTER_REG from a register to itself We might want to resolve something to be in a particular register, so we can access it outside of the gen_mi framework...but it may already be in that register, at which point there's no work to do. Reviewed-by: Caio Marcelo de Oliveira Filho --- diff --git a/src/intel/common/gen_mi_builder.h b/src/intel/common/gen_mi_builder.h index bb817ce930e..500893559c3 100644 --- a/src/intel/common/gen_mi_builder.h +++ b/src/intel/common/gen_mi_builder.h @@ -414,9 +414,11 @@ _gen_mi_copy_no_unref(struct gen_mi_builder *b, case GEN_MI_VALUE_TYPE_REG32: case GEN_MI_VALUE_TYPE_REG64: #if GEN_GEN >= 8 || GEN_IS_HASWELL - gen_mi_builder_emit(b, GENX(MI_LOAD_REGISTER_REG), lrr) { - lrr.SourceRegisterAddress = src.reg; - lrr.DestinationRegisterAddress = dst.reg; + if (src.reg != dst.reg) { + gen_mi_builder_emit(b, GENX(MI_LOAD_REGISTER_REG), lrr) { + lrr.SourceRegisterAddress = src.reg; + lrr.DestinationRegisterAddress = dst.reg; + } } #else unreachable("Cannot do reg <-> reg copy on IVB and earlier");