Go Back   Project64 Forums > General Discussion > Open Discussion

Thread Tools Display Modes
Prev Previous Post   Next Post Next
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

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

All times are GMT. The time now is 08:40 AM.

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2023, Jelsoft Enterprises Ltd.