summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHomer Hsing <homer.xing@intel.com>2012-09-28 13:43:44 +0800
committerDamien Lespiau <damien.lespiau@intel.com>2013-03-04 15:54:34 +0000
commit397e1ccccbd00fcf2ec763f9d6f8c82db8d395ee (patch)
tree58179facd5daa61e42bd7e5190746e81bc9f34b6
parentc91bd8c76ffb3a5098791a7d9c8b45a789f77cc2 (diff)
Fix JIP position for Gen6 JMPI
-rw-r--r--assembler/src/main.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/assembler/src/main.c b/assembler/src/main.c
index 7284d45d..b897ad4b 100644
--- a/assembler/src/main.c
+++ b/assembler/src/main.c
@@ -419,12 +419,17 @@ int main(int argc, char **argv)
offset --;
offset = jump_distance(offset);
- if(gen_level <= 5 && entry->instruction.header.opcode == BRW_OPCODE_ELSE)
- entry->instruction.bits3.branch_2_offset.UIP = 1; /* Set the istack pop count, which must always be 1. */
- else if(gen_level == 6) {
- /* TODO: position of JIP for endif is not written down in Gen6 spec, may be bits1 */
- entry->instruction.bits1.branch.JIP = offset; // for CASE,ELSE,FORK,IF,WHILE
- entry->instruction.bits3.JIP = offset; // for CALL
+ if(gen_level <= 5) {
+ entry->instruction.bits3.JIP = offset;
+ if(entry->instruction.header.opcode == BRW_OPCODE_ELSE)
+ entry->instruction.bits3.branch_2_offset.UIP = 1; /* Set the istack pop count, which must always be 1. */
+ } else if(gen_level == 6) {
+ /* TODO: endif JIP pos is not in Gen6 spec. may be bits1 */
+ int opcode = entry->instruction.header.opcode;
+ if(opcode == BRW_OPCODE_CALL || opcode == BRW_OPCODE_JMPI)
+ entry->instruction.bits3.JIP = offset; // for CALL, JMPI
+ else
+ entry->instruction.bits1.branch.JIP = offset; // for CASE,ELSE,FORK,IF,WHILE
} else if(gen_level >= 7)
entry->instruction.bits3.branch_2_offset.JIP = offset;
}