Orion_ Posted August 24, 2006 Report Share Posted August 24, 2006 I had a problem with negative value using some gpu code, and I came to the conclusion that one of my routine didn't work, actually this was the GT Turbo's routine (not surprised ? ^^) we complained about the missing shalq instruction in gpu instruction set, we have sharq, but not shalq, so why ? because we simply don't need it ... let's see, here is the GT Turbo's routine for SHALQ: MACRO SHALQ a,b ; by GT_Turbo shlq \a,\b jr NC,.pasign\~ nop neg \b .pasign\~: ENDM what shalq does ? it will shift the register to left, so let's take 2 numbers: (decimal) 25 -> (binary) 00000000000000000000000000011001 (decimal) -25 -> (binary) 11111111111111111111111111100111 if you shift both of the binary number of 1 to left, you have: 00000000000000000000000000110010 -> 50 11111111111111111111111111001110 -> -50 and this can be achieved using a simple shlq, that's why we don't need shalq but we do need sharq, because if you shift using a simple shrq a zero will be introduced in bit 31 of the number and it will screw up the negative value. so correct me If I'm wrong, but I replaced all the SHALQ of my routine by shlq and the bug was gone ! Link to comment Share on other sites More sharing options...
SCPCD Posted August 24, 2006 Report Share Posted August 24, 2006 Strange... I don't know why GT have made and used this function because this things as already said somewhere on jagware that a simple shlq is the same as shalq... EDIT : Link Link to comment Share on other sites More sharing options...
Zerosquare Posted August 24, 2006 Report Share Posted August 24, 2006 I don't know why GT have made and used this functionBecause he hates maths, and likes bugs Maybe he simply forgot ? Link to comment Share on other sites More sharing options...
GT Turbo Posted August 24, 2006 Report Share Posted August 24, 2006 A little problem Orion, it's not mine, because i don't use macro, i think that come from Macronator (SebRmv) no ? GT Link to comment Share on other sites More sharing options...
Orion_ Posted August 24, 2006 Author Report Share Posted August 24, 2006 SCPCD > oops sorry, I didn't looked the end of this topic, so this one is useless I'm sorry ^^ GT Turbo > yes that's me who converted it to macro ^^ Link to comment Share on other sites More sharing options...
Azrael Posted August 24, 2006 Report Share Posted August 24, 2006 I agree with SCPCD's answer, SHLQ is the same than a SHALQ. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now