Okay, let me preface this by saying it is, in large part, directly because of my current work project, so it feels a bit self-serving. (One of the reasons I haven't just put them in)

But...

Right now the only good way to find out if a value is true or not is to do something like:

 $I0 = 1
 if $P0, done
 $I0 = 0
 done:

and look in $I0 for the result. This is OK, but if you're dealing with a language with relatively primitive views of logical operations (i.e they return 0 or 1) you end up with a *lot* of these little code snippets when evaluating something like:

if ((foo or bar) and ((x1 >= 12) or (x2 < 15) or (x5 and x6 and x7)) goto somewhere

(And yes, that's close to a real code snippet. Feel my pain here :) Not a huge deal to translate, but once you hit 30K basic blocks in a sub the register coloring algorithm really gets unhappy and dies an unpleasant death after an hour or so.

Anyway, because of it I'm pondering non-flowcontrol logical ops. That is, something like:

   istrue I0, P5        # I0 = 1 if P5 is true
   isgt I0, P5, P6      # I0 = i if P5 > P6

The or/and/xor/not ops don't really need alternate versions, since:

   isor I0, P5, P6

can be done with

   or P4, P5, P6
   istrue P4

so there doesn't seem to be much pressure there.

Given the semi-self-serving nature of these I think some discussion's in order first.
--
Dan


--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to