115 Commits

Author SHA1 Message Date
Damien Lespiau
574a249142 assembler: Don't warn if identical declared registers are redefined
There's no real need to warn when the same register is declared twice.
Currently the libva driver does do that and this warning makes other
errors really hide in a sea of warnings.

Redefining a register with different parameters is a real error though,
so we should not allow that and error out in that case.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:39 +00:00
Damien Lespiau
9c72beb701 assembler: Store immediate values in reg.dw1.ud
Another step in pushing the parsing in struct brw_reg.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:39 +00:00
Damien Lespiau
c0592b2882 assembler: Factor out the source register validation
The goal is to use brw_set_src[01](), so let's start by validating the
register we have before generating the opcode.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:39 +00:00
Damien Lespiau
9fcc1bdcad assembler: Use brw_set_dest() to encode the destination
A few notes:

I needed to introduce a brw context and compile structs. These are only
used to get which generation we are compiling code for, but eventually
we can use more of the infrastructure.

brw_set_dest() uses the destination register width to program the
instruction execution size.

The assembler can either take subnr in bytes or in number of elements,
so we need a resolve step when setting a brw_reg.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:39 +00:00
Damien Lespiau
5e0da9f854 assembler: Factor out the destination register validation
The goal is to use brw_set_dest(), so let's start by validating the
register we have before generating the opcode.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:39 +00:00
Damien Lespiau
9d5a87a096 assembler: Use brw_reg in the source operand
Last refactoring step in transition to struct brw_reg.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:38 +00:00
Damien Lespiau
c13613ea2d assembler: Get rid of src operand's swizzle_set
swizzle_set can be derived from the value of swizzle itself, no need for
that field.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:38 +00:00
Damien Lespiau
a82722b60f assembler: Consolidate the swizzling configuration on 8 bits
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:38 +00:00
Damien Lespiau
0375073f05 assembler: Replace struct dst_operand by struct brw_reg
One more step on the road to replacing all register-like structures by
struct brw_reg.

Two things in this commit are worth noting:

* As we are using more and more brw_reg, a lot of the field-by-field
  assignments can be replaced by 1 assignment which results is a
  reduction of code

* As the destination horizontal stride is now stored on 2 bits in
  brw_reg, it's not possible to defer the handling of DEFAULT_DSTREGION
  (aka (int)-1) when setting the destination operand. It has to be done
  when parsing the region and resolve_dst_region() is a helper for that
  task.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:38 +00:00
Damien Lespiau
801b4eb1b3 assembler: Unify the direct and indirect register type
They are all struct brw_reg registers now.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:38 +00:00
Damien Lespiau
36f8f65aa0 assembler: Replace struct indirect_reg by struct brw_reg
More code simplification can be layered on top of that (by using some
brw_* helpers to create registers), that'd be for another commit.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:38 +00:00
Damien Lespiau
b33b8810e0 assembler: Replace struct direct_reg by struct brw_reg
More code simplification can be layered on top of that (by using some
brw_* helpers to create registers), that'd be for another commit.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:38 +00:00
Damien Lespiau
cce4fc2c36 assembler: Make struct declared_register use struct brw_reg
It's time to start converting the emission code in gram.y to use libbrw
infrastructure. Let's start with using brw_reg for declared register.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:38 +00:00
Damien Lespiau
79c62f1134 assembler: Don't change the size of opcodes!
Until now, the assembler had relocation-related fields added to struct
brw_instruction. This changes the size of the structure and break code
assuming the opcode structure is really 16 bytes, for instance the
emission code in brw_eu_emit.c.

With this commit, we build on the infrastructure that slowly emerged in
the few previous commits to add a relocatable instruction with the
needed fields.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:38 +00:00
Damien Lespiau
a45a47183a assembler: Make explicit that labels are part of the instructions list
The output of the parsing is a list of struct brw_program_instruction.
These instructions can be either GEN instructions aka struct
brw_instruction or labels. To make this more explicit we now have a type
to test to determine which instruction we are dealing with.

This will also allow to to pull the relocation bits into struct
brw_program_instruction instead of having them in the structure
representing the opcodes.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:38 +00:00
Damien Lespiau
73d58edab9 assembler: Refactor the code adding instructions and labels
Factoring out the code from the grammar will allow us to switch to
using brw_compile in a cleaner way.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:38 +00:00
Damien Lespiau
c716e2bdb4 assembler: Simplify get_subreg_address()
This function can only be called to resolve subreg_nr in direct mode
(there is an other function for the indirect case) and it makes no sense
to call it with an immediate operand.

Express those facts with asserts and simplify the logic.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:37 +00:00
Damien Lespiau
8322802acb assembler: Use subreg_nr to store the address register subreg
Another step towards using struct brw_reg for source and destination
operands.

Instead of having a separate field to store the sub register number of
the address register in indirect access mode, we can reuse the subreg_nr
field that was only used for direct access so far.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:37 +00:00
Damien Lespiau
02019d4d55 assembler: Remove the writemask_set field of struct dest_operand
writemask_set gets in the way of switching to using struct brw_reg and
it's possible to derive it from the writemask value.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:37 +00:00
Damien Lespiau
db6f5e08ba assembler: Use BRW_WRITEMASK_XYZW instead of the 0xf constant
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:37 +00:00
Damien Lespiau
4431869bef assembler: Rename BRW_ACCWRCTRL_ACCWRCTRL
To a more self-describing define. This hopefully will help its inclusion
into Mesa.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:36 +00:00
Damien Lespiau
5e7e3f43a5 assembler: Adopt enum brw_message_target from mesa
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:36 +00:00
Damien Lespiau
0fde3ddccc assembler: Rename gen5 DP pixel_scoreboard_clear to last_render_target
The purpose of this commit is to synchronize opcode definitions across
the gen4asm assembler and mesa.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:36 +00:00
Damien Lespiau
fe0bd3776e assembler: Remove struct dp_write_gen6 and struct use gen6_dp
We ended up with 2 structures that where exactly the same, so just use
one, which happens to be the one Mesa has.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:36 +00:00
Damien Lespiau
8fa561d4bb assembler: Rename dp_gen7 to gen7_dp and sync it with Mesa's
The purpose of this commit is to synchronize opcode definitions across
the gen4asm assembler and mesa.

I had to drop how mesa splits msg_control as the current assembly
language gives access the the whole msg_control field.

Recompiling the xorg and the intel driver of libva shaders doesn't show
any difference in the assembly created.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:36 +00:00
Damien Lespiau
1f1ad59746 assembler: Rename dp_gen6 to gen6_dp and sync with Mesa's
The purpose of this commit is to synchronize opcode definitions across
the gen4asm assembler and mesa.

I had to drop how mesa splits msg_control as the current assembly
language gives access the the whole msg_control field.

Recompiling the xorg and the intel driver of libva shaders doesn't show
any difference in the assembly created.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:36 +00:00
Damien Lespiau
668e0dff7d assembler: Rename dp_read_gen6 to gen6_dp_sampler_const_cache
The purpose of this commit is to synchronize opcode definitions across
the gen4asm assembler and mesa.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:36 +00:00
Damien Lespiau
31259c5edc assembler: Rename three_src_gen6 to da3src
Mesa's brw_structs.h has named/renamed this field to da3src. Sync with
them.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:36 +00:00
Damien Lespiau
e71f1d2ad4 assembler: Sync brw_instruction's header with mesa's
Two changes there, a field has been renamed and one bit of padding is
now used for compressed instructions.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:35 +00:00
Damien Lespiau
191c85976d build: Integrate the merged gen assembler in the build system
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:54:35 +00:00
Eric Anholt
9b40c3724a Add autotools build system, and rearrange directory layout. 2013-03-04 15:54:23 +00:00
Eric Anholt
2d298742bf Add support for register-indirect addressing in source operands. 2013-03-04 15:54:23 +00:00
Eric Anholt
3bcf6b29cd Add support for register-indirect access in destination registers.
This is untested.  Also, a few bits for source operand register-indirect access
sneak in with this commit.
2013-03-04 15:54:23 +00:00
Eric Anholt
2dac0a19a4 Add support for destination writemasks.
This involved changing dest operands to have their own structure like src
operands, as the destination writemask (which is align16-only) shares space
with register numbers in align1 mode.
2013-03-04 15:54:23 +00:00
Eric Anholt
de1a889fe3 Avoid shift/reduce conflict in predicate by making flagreg and subreg 1 token.
Thanks to keithp for pointing out where the conflict was.
2013-03-04 15:54:23 +00:00
Eric Anholt
0ed5d93cc2 Add support for predicate control.
This is untested on programs using predicate control, and also causes a
shift/reduce conflict.
2013-03-04 15:54:22 +00:00
Eric Anholt
6a88ada7e8 Add support for swizzle control on source operands.
This required restructuring to store source operands in a new structure rather
than being stored in instructions, as swizzle is align16-only and shares
storage with other fields for align1 mode.

These changes were not tested on real programs using swizzle.
2013-03-04 15:54:22 +00:00
Eric Anholt
2a0f135784 Add acc[01] as src operands. 2013-03-04 15:54:22 +00:00
Eric Anholt
edc82a045c Comment cleanup and add missing semicolons after rules. 2013-03-04 15:54:22 +00:00
Eric Anholt
908f37d92d Add support for more instruction options. 2013-03-04 15:54:22 +00:00
Eric Anholt
6db54d7465 Typo fix in comment. 2013-03-04 15:54:22 +00:00
Eric Anholt
1d7d04228e Rename direct_gen_reg struct to direct_reg now that it fills more roles. 2013-03-04 15:54:22 +00:00
Eric Anholt
5297b2a7e8 Support src ARF operands in another place, and spell it arch instead of acc. 2013-03-04 15:54:22 +00:00
Eric Anholt
2c7876583e Add support for more registers as source operands. 2013-03-04 15:54:22 +00:00
Eric Anholt
883408eab8 Add rules for more registers, and use some for destinations. 2013-03-04 15:54:22 +00:00
Eric Anholt
f914c6ace2 Add many more opcodes. 2013-03-04 15:54:22 +00:00
Eric Anholt
569990bf6b Lex the register number with the register name.
This avoids the need for a start condition to prevent for example g1.8<0,1,0>UW
being lexed as GENREG NUMBER LANGLE etc. rather than
GENREG INTEGER DOT INTEGER LANGLE etc.
2013-03-04 15:54:22 +00:00
Eric Anholt
3d36079ae3 Add syntax for extended math send functions, and adjust packed_yuv_sf for it. 2013-03-04 15:54:22 +00:00
Eric Anholt
e865196a9d Add a syntax for urb write messages. 2013-03-04 15:54:21 +00:00
Eric Anholt
43313946e7 Add syntax for translating the DP write send message. 2013-03-04 15:54:21 +00:00