vc4: Abstract out the field-merging logic for instructions.

I'm going to be doing the same logic for some more fields next.
vc4: Set unused raddr fields to QPU_R_NOP.

The simulator assertion fails if you have a write to a reg and then a read
(for example, in the NOP side of an instruction), even if the read isn't
used for anything.  By setting unused raddrs to NOP, we avoid the problem
(since only the phsyical registers are tracked).
gallium: Copy fd_lowering.[ch] to tgsi_lowering.[ch] for code sharing.

Lots of drivers need to transform the weird instructions in TGSI into
reasonable scalar ops, and this code can make those translations
canonical.

Acked-by: Rob Clark <robclark@freedesktop.org>
gallium: Reformat tgsi_lowering.c for the normal style.

Acked-by: Rob Clark <robclark@freedesktop.org>
gallium: Rename freedreno parts of tgsi_lowering.[ch].

Acked-by: Rob Clark <robclark@freedesktop.org>
vc4: Start using tgsi_lowering for opcodes we haven't supported before.
vc4: Enable DP lowering in TGSI instead of our own code.
vc4: Enable POW lowering in TGSI instead of our own code.
vc4: Add support for two-sided color.

It's fairly easy, thanks to Rob Clark's lowering code.  Fixes
two-sided-lighting and 4 vertex-program-two-side testcases, while
regressing 8 testcases that involve enabling two-sided color while only
initializing one of the two colors in the VS.  If you're enabling two
sided color, it's of course expected that you really do set up both
colors, so this is still an improvement (and when we set up a linker for
TGSI, we'll hopefully fix those 8 fails).
ilo: fix rectlist on GEN7+

It was broken by 343b014b57ecc5431477e090100e6a26edbda540.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
vc4: Fix scalar math opcodes to replicate their result from the X channel.

Thanks to robclark for pointing out that I was probably failing to do this
when I reported a "bug" in his lowering code.
vc4: Enable LIT lowering in TGSI instead of our own code.

This brings us the -128/128 clamping on the w component.