diff --git a/assembler/src/gram.y b/assembler/src/gram.y index 3fcfa52a..f3fbed46 100644 --- a/assembler/src/gram.y +++ b/assembler/src/gram.y @@ -115,7 +115,8 @@ void set_direct_src_operand(struct src_operand *src, struct direct_reg *reg, %type instruction unaryinstruction binaryinstruction %type binaryaccinstruction triinstruction sendinstruction -%type jumpinstruction branchloopinstruction specialinstruction +%type jumpinstruction branchloopinstruction elseinstruction +%type specialinstruction %type msgtarget %type instoptions instoption_list predicate %type instrseq @@ -183,6 +184,7 @@ instruction: unaryinstruction | triinstruction | jumpinstruction | branchloopinstruction + | elseinstruction | specialinstruction ; @@ -339,6 +341,28 @@ branchloopinstruction: branchloopop: IF | IFF | WHILE ; +elseinstruction: ELSE relativelocation + { + 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. + */ + + 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 | WAIT ;