GBE: fixed the out-of-range JMPI.
authorZhigang Gong <zhigang.gong@intel.com>
Mon, 27 Jan 2014 01:26:21 +0000 (09:26 +0800)
committerZhigang Gong <zhigang.gong@intel.com>
Tue, 28 Jan 2014 03:09:20 +0000 (11:09 +0800)
commitbef2feeef4fbc797261fffebcb4f542348218e65
treec62cc9fd0fc7b21a17c13ded4bd5a9c728982028
parent7af96c50fca37129d9d6a7cef2ee9c89e0fe0458
GBE: fixed the out-of-range JMPI.

For the conditional jump distance out of S15 range [-32768, 32767],
we need to use an inverted jmp followed by a add ip, ip, distance
to implement. A little hacky as we need to change the nop instruction
to add instruction manually.

There is an optimization method which we can insert a
ADD instruction on demand. But that will need some extra analysis
for all the branching instruction. And need to adjust the distance
for those branch instruction's start point and end point contains
this instruction.

After this patch, the luxrender's slg4 could render the scene "alloy"
correctly.

v2:
fix the unconditional branch too.

Signed-off-by: Zhigang Gong <zhigang.gong@intel.com>
Reviewed-by: Yang, Rong R <rong.r.yang@intel.com>
backend/src/backend/gen_context.cpp
backend/src/backend/gen_encoder.cpp