[Mesa-dev] [PATCH v2? 1-2/9] i965/fs: Add fs_reg::is_zero() and is_one(); use for opt_algebraic().

Eric Anholt eric at anholt.net
Sun Nov 18 10:52:33 PST 2012


Kenneth Graunke <kenneth at whitecape.org> writes:

> These helper macros save you from writing nasty expressions like:
>
>    if ((inst->src[1].type == BRW_REGISTER_TYPE_F &&
>          inst->src[1].imm.f == 1.0) ||
>         ((inst->src[1].type == BRW_REGISTER_TYPE_D ||
>           inst->src[1].type == BRW_REGISTER_TYPE_UD) &&
>          inst->src[1].imm.u == 1)) {
>
> Instead, you simply get to write inst->src[1].is_one().  Simple.
> Also, this makes the FS backend match the VS backend (which has these).
>
> This patch also converts opt_algebraic to use the new helper functions.
> As a consequence, it will now also optimize integer-typed expressions.

Reviewed-by: Eric Anholt <eric at anholt.net>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20121118/e65068b3/attachment.pgp>


More information about the mesa-dev mailing list