View Single Post
Old 18th April 2013, 10:59 PM
HatCat's Avatar
HatCat HatCat is offline
Alpha Tester
Project Supporter
Senior Member
Join Date: Feb 2007
Location: In my hat.
Posts: 16,236

Been trying to get z64gl w/ GLEW32 dev building on GNU GCC and having issues with all the libraries. Took a break from that and overlooked some legacy statements in the current plugin.. seems there is a more direct approach to decode sign-extended immediate offsets for the transactions between data memory and the vector register file.

The old method (not current, but used in most applications) was the if-else scan:
offset = inst & 0x0000FFFF;
if (offset & 0x0040)
    offset |= ~0x007F;
Since neg(x) is not(x) + 1,
-0x0040 = ~0x0040 + 1 = 0xFFBF + 1 = 0xFFC0,

it would be much faster to say:
offset  = inst & 0x0000FFFF;
offset |= -(inst &= 0x0040);
...instead of applying the `setne` opcode as such:
offset  = inst & 0x0000FFFF;
offset |= -1 * !!(inst &= 0x0040); /* ((inst &= 0x0040) != 0x0000 */
One somewhat blatantly missed speed-oriented change I will have put into the next release, if I ever see enough information in this thread to put one up.

Last edited by HatCat; 18th April 2013 at 11:02 PM.
Reply With Quote