[Mesa-dev] [PATCH 17/23] i965/vec4: Trivial improvements to the with_writemask() function.
Paul Berry
stereotype441 at gmail.com
Mon Dec 30 10:29:23 PST 2013
On 2 December 2013 11:31, Francisco Jerez <currojerez at riseup.net> wrote:
> Add assertion that the register is not in the HW_REG or IMM file,
> calculate the conjunction of the old and new mask instead of replacing
> the old [consistent with the behavior of brw_writemask(), causes no
> functional changes right now], make it static inline to let the
> compiler do a slightly better job at optimizing things, and shorten
> its name.
> ---
> src/mesa/drivers/dri/i965/brw_vec4.h | 9 +++++++--
> src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 11 +----------
> src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp | 12 ++++++------
> 3 files changed, 14 insertions(+), 18 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h
> b/src/mesa/drivers/dri/i965/brw_vec4.h
> index 19de4c6..50e4794 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4.h
> +++ b/src/mesa/drivers/dri/i965/brw_vec4.h
> @@ -192,8 +192,13 @@ offset(dst_reg reg, unsigned delta)
> return reg;
> }
>
> -dst_reg
> -with_writemask(dst_reg const &r, int mask);
> +static inline dst_reg
> +writemask(dst_reg reg, unsigned mask)
> +{
> + assert(reg.file != HW_REG && reg.file != IMM);
> + reg.writemask &= mask;
> + return reg;
> +}
>
IIRC, hardware behaviour is undefined if the destination of an instruction
has a writemask of 0. Should we add an assertion here to verify that the
new reg.writemask != 0?
With that addressed, this patch is:
Reviewed-by: Paul Berry <stereotype441 at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20131230/85a9c102/attachment.html>
More information about the mesa-dev
mailing list