summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2006-09-01 13:37:51 -0700
committerDamien Lespiau <damien.lespiau@intel.com>2013-03-04 15:54:25 +0000
commit4ee9c3d869742334672a1c622e2589ebeb8991cd (patch)
tree5c80793e37ae144469d56ac341264faf7405ce17
parent9201e4e2a0eb2311daf5333f198631a497e06313 (diff)
Add break, cont, and halt instructions.
-rw-r--r--assembler/TODO1
-rw-r--r--assembler/src/gram.y45
2 files changed, 41 insertions, 5 deletions
diff --git a/assembler/TODO b/assembler/TODO
index 4e2a4dab..99fe77b2 100644
--- a/assembler/TODO
+++ b/assembler/TODO
@@ -8,3 +8,4 @@
- boolean types
- replace GL* with non-GL?
- labels for branch/jump instruction destinations
+- break/cont syntax should be better.
diff --git a/assembler/src/gram.y b/assembler/src/gram.y
index 05a85a8a..d39fbac9 100644
--- a/assembler/src/gram.y
+++ b/assembler/src/gram.y
@@ -116,12 +116,12 @@ void set_direct_src_operand(struct src_operand *src, struct direct_reg *reg,
%type <instruction> instruction unaryinstruction binaryinstruction
%type <instruction> binaryaccinstruction triinstruction sendinstruction
%type <instruction> jumpinstruction branchloopinstruction elseinstruction
-%type <instruction> syncinstruction specialinstruction
+%type <instruction> breakinstruction syncinstruction specialinstruction
%type <instruction> msgtarget
%type <instruction> instoptions instoption_list predicate
%type <program> instrseq
%type <integer> instoption
-%type <integer> unaryop binaryop binaryaccop branchloopop
+%type <integer> unaryop binaryop binaryaccop branchloopop breakop
%type <integer> conditionalmodifier saturate negate abs chansel
%type <integer> writemask_x writemask_y writemask_z writemask_w
%type <integer> regtype srcimmtype execsize dstregion immaddroffset
@@ -141,7 +141,7 @@ void set_direct_src_operand(struct src_operand *src, struct direct_reg *reg,
%type <src_operand> directsrcoperand srcarchoperandex directsrcaccoperand
%type <src_operand> indirectsrcoperand
%type <src_operand> src srcimm imm32reg payload srcacc srcaccimm swizzle
-%type <src_operand> relativelocation relativelocation2
+%type <src_operand> relativelocation relativelocation2 locationstackcontrol
%%
ROOT: instrseq
@@ -185,6 +185,7 @@ instruction: unaryinstruction
| jumpinstruction
| branchloopinstruction
| elseinstruction
+ | breakinstruction
| syncinstruction
| specialinstruction
;
@@ -376,7 +377,32 @@ elseinstruction: ELSE relativelocation
}
;
-breakop: BREAK | CONT | WAIT
+breakinstruction: breakop locationstackcontrol
+ {
+ struct direct_reg dst;
+ struct dst_operand ip_dst;
+ struct src_operand ip_src;
+
+ /* The jump instruction requires that the IP register
+ * be the destination and first source operand, while the
+ * offset is the second source operand. The offset is added
+ * to the IP pre-increment.
+ */
+ dst.reg_file = BRW_ARCHITECTURE_REGISTER_FILE;
+ dst.reg_nr = BRW_ARF_IP;
+ dst.subreg_nr = 0;
+
+ bzero(&$$, sizeof($$));
+ $$.header.opcode = $1;
+ set_direct_dst_operand(&ip_dst, &dst, BRW_REGISTER_TYPE_UD);
+ set_instruction_dest(&$$, &ip_dst);
+ set_direct_src_operand(&ip_src, &dst, BRW_REGISTER_TYPE_UD);
+ set_instruction_src0(&$$, &ip_src);
+ set_instruction_src1(&$$, &$2);
+ }
+;
+
+breakop: BREAK | CONT | HALT
;
maskpushop: MSAVE | PUSH
@@ -1031,7 +1057,7 @@ relativelocation: imm32
{
if ($1 > 32767 || $1 < -32768) {
fprintf(stderr,
- "error: relative offset %d out of range\n");
+ "error: relative offset %d out of range\n", $1);
YYERROR;
}
@@ -1057,6 +1083,15 @@ relativelocation2:
}
;
+locationstackcontrol:
+ imm32
+ {
+ $$.reg_file = BRW_IMMEDIATE_VALUE;
+ $$.reg_type = BRW_REGISTER_TYPE_D;
+ $$.imm32 = $1;
+ }
+;
+
/* 1.4.7: Regions */
dstregion: LANGLE INTEGER RANGLE
{