profile/extras/intel-gpu-tools.git
11 years agoassembler: Get rid of src operand's swizzle_set
Damien Lespiau [Wed, 23 Jan 2013 21:46:21 +0000 (21:46 +0000)]
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>
11 years agoassembler: Consolidate the swizzling configuration on 8 bits
Damien Lespiau [Wed, 23 Jan 2013 21:35:10 +0000 (21:35 +0000)]
assembler: Consolidate the swizzling configuration on 8 bits

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
11 years agoassembler: Replace struct dst_operand by struct brw_reg
Damien Lespiau [Wed, 23 Jan 2013 20:33:00 +0000 (20:33 +0000)]
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>
11 years agoassembler: Unify the direct and indirect register type
Damien Lespiau [Wed, 23 Jan 2013 16:20:05 +0000 (16:20 +0000)]
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>
11 years agoassembler: Replace struct indirect_reg by struct brw_reg
Damien Lespiau [Wed, 23 Jan 2013 16:17:28 +0000 (16:17 +0000)]
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>
11 years agoassembler: Replace struct direct_reg by struct brw_reg
Damien Lespiau [Wed, 23 Jan 2013 16:06:49 +0000 (16:06 +0000)]
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>
11 years agoassembler: Make struct declared_register use struct brw_reg
Damien Lespiau [Wed, 23 Jan 2013 15:13:55 +0000 (15:13 +0000)]
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>
11 years agoassembler: Don't expose functions only used in main.c
Damien Lespiau [Mon, 21 Jan 2013 22:17:54 +0000 (22:17 +0000)]
assembler: Don't expose functions only used in main.c

and make then static.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
11 years agoassembler: Make sure nobody adds a field back to struct brw_instruction
Damien Lespiau [Mon, 21 Jan 2013 22:12:10 +0000 (22:12 +0000)]
assembler: Make sure nobody adds a field back to struct brw_instruction

Adding something there will break the library, so we might as check for
it.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
11 years agoassembler: Don't change the size of opcodes!
Damien Lespiau [Mon, 21 Jan 2013 21:41:36 +0000 (21:41 +0000)]
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>
11 years agoassembler: Make explicit that labels are part of the instructions list
Damien Lespiau [Mon, 21 Jan 2013 19:28:41 +0000 (19:28 +0000)]
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>
11 years agoassembler: Refactor the code adding instructions and labels
Damien Lespiau [Mon, 21 Jan 2013 17:07:28 +0000 (17:07 +0000)]
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>
11 years agoassembler: Make print_instruction() take an instruction
Damien Lespiau [Mon, 21 Jan 2013 15:10:01 +0000 (15:10 +0000)]
assembler: Make print_instruction() take an instruction

No need to use a brw_program_instruction there as a brw_instruction is
what you really dump anyway, espcially when the plan is to use
brw_compile from Mesa sooner rather than later.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
11 years agoassembler: Simplify get_subreg_address()
Damien Lespiau [Mon, 21 Jan 2013 14:45:46 +0000 (14:45 +0000)]
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>
11 years agoassembler: Use subreg_nr to store the address register subreg
Damien Lespiau [Mon, 21 Jan 2013 14:04:59 +0000 (14:04 +0000)]
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>
11 years agoassembler: Remove the writemask_set field of struct dest_operand
Damien Lespiau [Sun, 20 Jan 2013 21:52:05 +0000 (21:52 +0000)]
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>
11 years agoassembler: Use BRW_WRITEMASK_XYZW instead of the 0xf constant
Damien Lespiau [Sun, 20 Jan 2013 21:11:29 +0000 (21:11 +0000)]
assembler: Use BRW_WRITEMASK_XYZW instead of the 0xf constant

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
11 years agoassembler: Import brw_eu_emit.c
Damien Lespiau [Sat, 19 Jan 2013 23:27:46 +0000 (23:27 +0000)]
assembler: Import brw_eu_emit.c

Finally importing the meaty brw_eu_emit.c code that emit instructions.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
11 years agoassembler: Don't use -Wpointer-arith
Damien Lespiau [Sat, 19 Jan 2013 23:25:22 +0000 (23:25 +0000)]
assembler: Don't use -Wpointer-arith

Mesa's code uses the GNU C extension that allows additions and
soustractions on void* (+/- 1).

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
11 years agoassembler: Import brw_eu.c
Damien Lespiau [Sat, 19 Jan 2013 23:04:07 +0000 (23:04 +0000)]
assembler: Import brw_eu.c

Another step the road of importing Mesa's emission code.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
11 years agoassembler: Import brw_eu_compact.c
Damien Lespiau [Sat, 19 Jan 2013 22:52:21 +0000 (22:52 +0000)]
assembler: Import brw_eu_compact.c

To be able to import brw_eu.c and brw_eu_emit.c later on. This could be
used to get the assembler generate compact instructions at some point.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
11 years agoassembler: Protect gen4asm.h from multiple inclusions
Damien Lespiau [Sat, 19 Jan 2013 22:50:57 +0000 (22:50 +0000)]
assembler: Protect gen4asm.h from multiple inclusions

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
11 years agoassembler: Make an libbrw library
Damien Lespiau [Sat, 19 Jan 2013 17:24:56 +0000 (17:24 +0000)]
assembler: Make an libbrw library

With the brw_* files imported from mesa.

There are still a few things in that library that needs gen4asm.h, for
instance the GLuint and GLint types. The hope is that eventually libbrw
can be split out in its own directory and shared.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
11 years agoassembler: Introduce struct brw_context
Damien Lespiau [Sat, 19 Jan 2013 17:05:48 +0000 (17:05 +0000)]
assembler: Introduce struct brw_context

A lot of the mesa code use struct brw_context to get the GPU generation
and various information. Let's stub this structure and initialize it
ourselves to be able to resuse mesa's code untouched.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
11 years agoassembler: Remove white space from brw_eu.h
Damien Lespiau [Sat, 19 Jan 2013 11:51:08 +0000 (11:51 +0000)]
assembler: Remove white space from brw_eu.h

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
11 years agoassembler: Import ralloc from Mesa
Damien Lespiau [Sat, 19 Jan 2013 11:49:11 +0000 (11:49 +0000)]
assembler: Import ralloc from Mesa

This also add a new brw_compat.h that should help maintaining the
diff between mesa's version and our as small as possible.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
11 years agoassembler: Update the disassembler code
Damien Lespiau [Sat, 19 Jan 2013 00:30:18 +0000 (00:30 +0000)]
assembler: Update the disassembler code

From Mesa. This imports a bit more the of brw_eu* infrastructure (which
is going towards the right direction!) from mesa and the update is quite
a significant improvement over what we had.

I also verified that the changes that were done on the assembler old
version of brw_disasm.c were already supported by the Mesa version, and
indeed they were.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
11 years agoassembler: Remove trailing white space from brw_defines.h
Damien Lespiau [Fri, 18 Jan 2013 13:21:32 +0000 (13:21 +0000)]
assembler: Remove trailing white space from brw_defines.h

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
11 years agoassembler: Import brw_defines.h from Mesa
Damien Lespiau [Fri, 18 Jan 2013 13:14:23 +0000 (13:14 +0000)]
assembler: Import brw_defines.h from Mesa

Almost identical files now, the diff is:

-#include "intel_chipset.h"
+#define EX_DESC_SFID_MASK 0xF
+#define EX_DESC_EOT_MASK  0x20

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
11 years agoassembler: Rename BRW_ACCWRCTRL_ACCWRCTRL
Damien Lespiau [Fri, 18 Jan 2013 11:52:01 +0000 (11:52 +0000)]
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>
11 years agoassembler: Adopt enum brw_message_target from mesa
Damien Lespiau [Fri, 18 Jan 2013 11:04:37 +0000 (11:04 +0000)]
assembler: Adopt enum brw_message_target from mesa

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
11 years agoassembler: Remove trailing white spaces from brw_structs.h
Damien Lespiau [Wed, 16 Jan 2013 15:11:05 +0000 (15:11 +0000)]
assembler: Remove trailing white spaces from brw_structs.h

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
11 years agoassembler: Adopt brw_structs.h from mesa
Damien Lespiau [Wed, 16 Jan 2013 14:56:40 +0000 (14:56 +0000)]
assembler: Adopt brw_structs.h from mesa

Finally merge both brw_structs.h from mesa. One detail has risen in that
last commit, the msg_control field of data port message descriptors.

Mesa's msg_control field is sometimes split with messages-specific
fields where the assembler (at least for recent generations) exposes the
full msg_control value in the send instruction.

As libva's shaders encodes the full msg_control value in its send
instructions, I've chosen to not take the split msg_control from mesa.
It's absolutely possible to have a patch fixing that divergence at some
later point.

I've also kept a hack introduced with ironlake to not have to rewrite
shaders (that encode msg_control in the text, remember), and thus
creates a another difference with Mesa.

-  GLuint msg_control:3;
-  GLuint msg_type:3;
+  GLuint msg_control:4;
+  GLuint msg_type:2;

Once again, I've made sure that re-generating libva's shaders don't show
any difference.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
11 years agoassembler: Rename bits3.id and bits3.fd
Damien Lespiau [Wed, 16 Jan 2013 01:50:47 +0000 (01:50 +0000)]
assembler: Rename bits3.id and bits3.fd

As always, to sync with mesa.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
11 years agoassembler: Rename branch_2_offset to break_cont
Damien Lespiau [Wed, 16 Jan 2013 01:44:41 +0000 (01:44 +0000)]
assembler: Rename branch_2_offset to break_cont

Once again, import the equivalent struct from mesa.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
11 years agoassembler: Rename branch to branch_gen6
Damien Lespiau [Wed, 16 Jan 2013 01:19:29 +0000 (01:19 +0000)]
assembler: Rename branch to branch_gen6

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>
11 years agoassembler: Rename gen5 DP pixel_scoreboard_clear to last_render_target
Damien Lespiau [Tue, 15 Jan 2013 20:34:50 +0000 (20:34 +0000)]
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>
11 years agoassembler: Remove struct dp_write_gen6 and struct use gen6_dp
Damien Lespiau [Tue, 15 Jan 2013 20:24:51 +0000 (20:24 +0000)]
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>
11 years agoassembler: Rename dp_gen7 to gen7_dp and sync it with Mesa's
Damien Lespiau [Tue, 15 Jan 2013 18:47:05 +0000 (18:47 +0000)]
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>
11 years agoassembler: Rename dp_gen6 to gen6_dp and sync with Mesa's
Damien Lespiau [Tue, 15 Jan 2013 17:35:24 +0000 (17:35 +0000)]
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>
11 years agoassembler: Rename dp_read_gen6 to gen6_dp_sampler_const_cache
Damien Lespiau [Tue, 15 Jan 2013 16:40:06 +0000 (16:40 +0000)]
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>
11 years agoassembler: Rename three_src_gen6 to da3src
Damien Lespiau [Tue, 15 Jan 2013 14:05:23 +0000 (14:05 +0000)]
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>
11 years agoassembler: Sync brw_instruction's header with mesa's
Damien Lespiau [Mon, 14 Jan 2013 19:13:19 +0000 (19:13 +0000)]
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>
11 years agobuild: Add the debugger compilation status to the summary
Damien Lespiau [Tue, 22 Jan 2013 08:35:15 +0000 (08:35 +0000)]
build: Add the debugger compilation status to the summary

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
11 years agobuild: Only build the assembler if flex and bison are found
Damien Lespiau [Mon, 21 Jan 2013 23:02:36 +0000 (23:02 +0000)]
build: Only build the assembler if flex and bison are found

And start displaying a nice summary of what we are going to compile.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
11 years agobuild: Don't use AM_MAINTAINER_MODE
Damien Lespiau [Sat, 19 Jan 2013 11:54:05 +0000 (11:54 +0000)]
build: Don't use AM_MAINTAINER_MODE

This does not bring us anything these days, not using the macro at all
is the same thing as having it always on.

See this discussion:
https://www.redhat.com/archives/virt-tools-list/2010-October/msg00049.html

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
11 years agogitignore: Ignore TAGS files
Damien Lespiau [Tue, 15 Jan 2013 13:52:57 +0000 (13:52 +0000)]
gitignore: Ignore TAGS files

TAGS files are generated with "make tags" to quickly jump through the
code. Ignore those by-products of automake/ctags.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
11 years agobuild: Add CAIRO_FLAGS to the debugger compilation
Damien Lespiau [Mon, 14 Jan 2013 23:25:14 +0000 (23:25 +0000)]
build: Add CAIRO_FLAGS to the debugger compilation

The library in lib/ exposes <cairo.h> in its main header and thus users
must be able to include it.

11 years agobuild: Integrate the merged gen assembler in the build system
Damien Lespiau [Mon, 14 Jan 2013 23:21:21 +0000 (23:21 +0000)]
build: Integrate the merged gen assembler in the build system

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
11 years agobump version to 1.3
Xiang, Haihao [Wed, 31 Oct 2012 08:10:20 +0000 (16:10 +0800)]
bump version to 1.3

Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
11 years agoFix typo. "donesn't" -> "doesn't"
Homer Hsing [Tue, 23 Oct 2012 01:21:15 +0000 (09:21 +0800)]
Fix typo. "donesn't" -> "doesn't"

11 years agoAdd the CRE enginee for HSW+
Zhao Yakui [Mon, 22 Oct 2012 20:13:51 +0000 (16:13 -0400)]
Add the CRE enginee for HSW+

This is also for media encoding like VME, which can do
the operation of check & refinement.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
11 years agoFix JMPI encoding for Haswell.
Gwenole Beauchesne [Mon, 22 Oct 2012 20:13:51 +0000 (16:13 -0400)]
Fix JMPI encoding for Haswell.

It uses the byte-aligned jump instead of 64-bit units.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
11 years agoAdd initial support for Haswell.
Gwenole Beauchesne [Mon, 22 Oct 2012 20:13:51 +0000 (16:13 -0400)]
Add initial support for Haswell.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
11 years agoAllow Gen version decimals.
Gwenole Beauchesne [Mon, 22 Oct 2012 20:13:51 +0000 (16:13 -0400)]
Allow Gen version decimals.

This is preparatory work for Haswell (Gen 7.5).

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
11 years agoBump gen_level to multiple of tens.
Gwenole Beauchesne [Mon, 22 Oct 2012 20:13:51 +0000 (16:13 -0400)]
Bump gen_level to multiple of tens.

Add new helper macros to check versions:
- IS_GENp() meant to match Gen X and above
- IS_GENx() meant to match Gen X exactly.

Patch mechanically generated. No stale "gen_level" usage.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
11 years agoFix Gen7 JMPI compilation
Homer Hsing [Fri, 19 Oct 2012 03:18:23 +0000 (11:18 +0800)]
Fix Gen7 JMPI compilation

Gen7 JMPI Restrictions in bspec:
The JIP data type must be Signed DWord

11 years agoFix sub-register number of an address register encoding
Homer Hsing [Thu, 18 Oct 2012 04:37:31 +0000 (12:37 +0800)]
Fix sub-register number of an address register encoding

The AddrSubRegNum field in the instruction binary code should be:
  code    value(advanced_flag==0)   value(advanced_flag==1)
  a0.0             0                         0
  a0.1        invalid input                  1
  a0.2             1                         2
  a0.3        invalid input                  3
  a0.4             2                         4
  a0.5        invalid input                  5
  a0.6             3                         6
  a0.7        invalid input                  7
  a0.8             4                  invalid input
  a0.10            5                  invalid input
  a0.12            6                  invalid input
  a0.14            7                  invalid input

11 years agoFix symbol register subreg number calculation rule symbol_reg_p
Homer Hsing [Tue, 16 Oct 2012 06:14:25 +0000 (14:14 +0800)]
Fix symbol register subreg number calculation rule symbol_reg_p

When in normal mode, subreg_nr should not be divided by type_size.
This patch fixes such bug.

11 years agoShow warning when compiling the grammar parser
Homer Hsing [Fri, 28 Sep 2012 06:10:00 +0000 (14:10 +0800)]
Show warning when compiling the grammar parser

11 years agoSupport Gen6 WHILE instruction
Homer Hsing [Fri, 28 Sep 2012 06:05:51 +0000 (14:05 +0800)]
Support Gen6 WHILE instruction

11 years agoMake sure Gen6 IF works
Homer Hsing [Fri, 28 Sep 2012 06:02:25 +0000 (14:02 +0800)]
Make sure Gen6 IF works

11 years agoMake sure Gen6 ENDIF work
Homer Hsing [Fri, 28 Sep 2012 05:46:21 +0000 (13:46 +0800)]
Make sure Gen6 ENDIF work

11 years agoFix JIP position for Gen6 JMPI
Homer Hsing [Fri, 28 Sep 2012 05:43:44 +0000 (13:43 +0800)]
Fix JIP position for Gen6 JMPI

11 years agoFix Gen6 ELSE instructions code logic according to bspec.
Homer Hsing [Thu, 27 Sep 2012 08:20:39 +0000 (16:20 +0800)]
Fix Gen6 ELSE instructions code logic according to bspec.

11 years agoMake sure BREAK/CONT/HALT work on Gen6.
Homer Hsing [Thu, 27 Sep 2012 07:44:15 +0000 (15:44 +0800)]
Make sure BREAK/CONT/HALT work on Gen6.

11 years agoSupport Gen6 RET instruction.
Homer Hsing [Thu, 27 Sep 2012 07:39:28 +0000 (15:39 +0800)]
Support Gen6 RET instruction.

11 years agoSupport Gen6 CALL instruction.
Homer Hsing [Thu, 27 Sep 2012 07:31:56 +0000 (15:31 +0800)]
Support Gen6 CALL instruction.

11 years agoReplace variable init code in WAIT by src_null_reg
Homer Hsing [Thu, 27 Sep 2012 06:56:30 +0000 (14:56 +0800)]
Replace variable init code in WAIT by src_null_reg

11 years agoLet ip_dst and ip_src become local const variable, so as to reduce replicated code.
Homer Hsing [Thu, 27 Sep 2012 06:48:14 +0000 (14:48 +0800)]
Let ip_dst and ip_src become local const variable, so as to reduce replicated code.

11 years agoSupport Gen6 three-source-operand instructions.
Homer Hsing [Thu, 27 Sep 2012 06:20:32 +0000 (14:20 +0800)]
Support Gen6 three-source-operand instructions.

Add bits1.three_src.gen6.dest_reg_file according to Gen6 spec

11 years agoCompile ELSE and WHILE in Gen5 as same way as in Gen4
Homer Hsing [Thu, 27 Sep 2012 05:51:33 +0000 (13:51 +0800)]
Compile ELSE and WHILE in Gen5 as same way as in Gen4

11 years agoFix reloc_target_offset computing logic
Homer Hsing [Mon, 24 Sep 2012 08:39:36 +0000 (16:39 +0800)]
Fix reloc_target_offset computing logic

11 years agoFully support Gen7 branching instructions
Homer Hsing [Mon, 24 Sep 2012 02:12:26 +0000 (10:12 +0800)]
Fully support Gen7 branching instructions

Also fix integer argument parsing rule for JMPI, IF and WHILE
Fix shift/reduce conflicts in relativelocation

11 years agoSupporting multi-branch instructios BRD & BRC
Homer Hsing [Mon, 24 Sep 2012 02:06:35 +0000 (10:06 +0800)]
Supporting multi-branch instructios BRD & BRC

brd: redirect channels to branches
brc: let channels converging together

also rewrite code converting label to offset

11 years agoUse right-recursing in parser rule inst_option_list
Homer Hsing [Fri, 21 Sep 2012 04:35:35 +0000 (12:35 +0800)]
Use right-recursing in parser rule inst_option_list

This recursing cost less memory. It is recommended by Bison.

11 years agoSupport subroutine instructions, CALL & RET
Homer Hsing [Fri, 21 Sep 2012 04:33:13 +0000 (12:33 +0800)]
Support subroutine instructions, CALL & RET

11 years agoMerge replicative code in gram.y
Homer Hsing [Fri, 21 Sep 2012 02:14:31 +0000 (10:14 +0800)]
Merge replicative code in gram.y

11 years agoReduce replicative code in gram.y by reloc_target field in src_operand
Homer Hsing [Fri, 21 Sep 2012 02:06:20 +0000 (10:06 +0800)]
Reduce replicative code in gram.y by reloc_target field in src_operand

Bspec says JIP and UIP should be the source operands. It is better if
src_operand has a field "reloc_target" according to bspec.
The replicative code in JMPI and branchloop rules can be merged into one.

11 years agoRestrict type of relativelocation2 to int
Homer Hsing [Fri, 21 Sep 2012 01:51:55 +0000 (09:51 +0800)]
Restrict type of relativelocation2 to int

Original rule set it to EXP | NUMBER, then YYERROR if it is NUMBER.
This patch set it directly to EXP, restricting its type to int.

11 years agoRewrite label matching code. Collect labels in a linked list.
Homer Hsing [Fri, 21 Sep 2012 01:37:06 +0000 (09:37 +0800)]
Rewrite label matching code. Collect labels in a linked list.

Label matching is faster because of searching only in a small list,
rather than searching a label in all instructions.

11 years agoAdd second_reloc_target in the data structure.
Homer Hsing [Fri, 21 Sep 2012 00:39:57 +0000 (08:39 +0800)]
Add second_reloc_target in the data structure.

Since Gen6+, some branching instructions have two relocation targets.

11 years agoAdd test case for ".declare" overriding feature.
Homer Hsing [Thu, 20 Sep 2012 06:06:06 +0000 (14:06 +0800)]
Add test case for ".declare" overriding feature.

Later same name .declare pragma will override previously defined
one. This patch add a test case for that feature.

11 years agoFix memory leaking in the parser
Homer Hsing [Thu, 20 Sep 2012 06:04:20 +0000 (14:04 +0800)]
Fix memory leaking in the parser

STRING has been malloc'ed by strdup in src/lex.l but forgotten to
be freed in src/gram.y.

11 years agoFix field length of JIP for one-offset-branch in Gen6
Homer Hsing [Thu, 20 Sep 2012 05:09:15 +0000 (13:09 +0800)]
Fix field length of JIP for one-offset-branch in Gen6

Such JIP has 25 bits length in Gen6.

11 years agoAutomatically run all test cases.
Homer Hsing [Wed, 19 Sep 2012 01:34:58 +0000 (09:34 +0800)]
Automatically run all test cases.

In the past test/run-test.sh run only one test case per call.
This patch let it automatically run all test cases.

11 years agoFix missing environment variables problem in test/run-test.sh
Homer Hsing [Tue, 18 Sep 2012 08:44:45 +0000 (16:44 +0800)]
Fix missing environment variables problem in test/run-test.sh

Currently test/run-test.sh cannot get the value of ${srcdir} and
${top_builddir}. Thus we cannot run any test case. This patch uses
$0 to get the absolute path of run-test.sh. Now test cases work.

11 years agoAdd a generic hash table algorithm. Reuse for declared_reg_table and label_table...
Homer Hsing [Tue, 18 Sep 2012 08:32:39 +0000 (16:32 +0800)]
Add a generic hash table algorithm. Reuse for declared_reg_table and label_table in the future.

Rewrite find_register() and insert_register(). The hash table code
has been extracted. We may use those code for label table in the future.

11 years agoAdd a test case for ".declare" pragma
Homer Hsing [Tue, 18 Sep 2012 08:28:27 +0000 (16:28 +0800)]
Add a test case for ".declare" pragma

11 years agoRename brw_instruction.bits3.if_else to branch
Homer Hsing [Tue, 18 Sep 2012 05:57:20 +0000 (13:57 +0800)]
Rename brw_instruction.bits3.if_else to branch

Because that field will be used for all branch instructions

11 years agoAccording to BSPEC, put PLN & BFI1 to binaryop, put SUBB to binaryaccop
Homer Hsing [Tue, 18 Sep 2012 05:47:22 +0000 (13:47 +0800)]
According to BSPEC, put PLN & BFI1 to binaryop, put SUBB to binaryaccop

bspec: BFI1 should not access accumulator. PLN should not use accumulator
as source.
future work in gram.y: show warning if acc is used as dest for
ADDC/SUBB/CMP/CMPN/SHL/BFI1.

11 years agoExplain the difference between binaryinstruction and binaryaccinstruction
Homer Hsing [Tue, 18 Sep 2012 05:25:53 +0000 (13:25 +0800)]
Explain the difference between binaryinstruction and binaryaccinstruction

Developers may add new instructions in wrong place in the future
if they don't know the difference between binaryinstruction and
binaryaccinstruction.

11 years agoRenaming according to BSPEC: jump_count -> JIP; pop_count -> UIP.
Homer Hsing [Tue, 18 Sep 2012 05:12:50 +0000 (13:12 +0800)]
Renaming according to BSPEC: jump_count -> JIP; pop_count -> UIP.

Since bspec SNB+, jump_count and pop_count is renamed to JIP and uIP.

11 years agoUse bits3.if_else.jump_count instead of bits3.ud for readability
Homer Hsing [Mon, 17 Sep 2012 08:11:49 +0000 (16:11 +0800)]
Use bits3.if_else.jump_count instead of bits3.ud for readability

11 years agoPad NOP instructions instead of the ILLEGAL instruction for entry
Homer Hsing [Mon, 17 Sep 2012 08:01:16 +0000 (16:01 +0800)]
Pad NOP instructions instead of the ILLEGAL instruction for entry

If a label is an entry, the assembler will pad empty instruction
before the label until offset % 4 == 0. In the past, the ILLEGAL
instructions are padded. It may raise exceptions. We use the NOP
instructions instead.

11 years agoMerge same if branches in declare_pragma section in gram.y
Homer Hsing [Mon, 17 Sep 2012 05:34:38 +0000 (13:34 +0800)]
Merge same if branches in declare_pragma section in gram.y

11 years agoReduce memory cost in entry_table
Homer Hsing [Fri, 14 Sep 2012 07:27:19 +0000 (15:27 +0800)]
Reduce memory cost in entry_table

Original code double entry table space if there is no space. It may
waste 50% memory of the entry table. Now we use a link list to store
entry items.

11 years agoMake the entry point padding code logic looks nicer
Homer Hsing [Fri, 14 Sep 2012 05:40:08 +0000 (13:40 +0800)]
Make the entry point padding code logic looks nicer

11 years agoFix a typo in src/main.c: "in unit of type" -> "in unit of byte"
Homer Hsing [Fri, 14 Sep 2012 02:50:09 +0000 (10:50 +0800)]
Fix a typo in src/main.c: "in unit of type" -> "in unit of byte"

11 years agoReduce hash value collision probability in src/main.c
Homer Hsing [Fri, 14 Sep 2012 02:06:39 +0000 (10:06 +0800)]
Reduce hash value collision probability in src/main.c

Original code use "hash_value = *name++", which may produce
hash value collision for word permutations like "abc", "bac" and "cba".