Replies: 4 comments 2 replies
-
I think some VMs do implement operations of the sort. Can I ask what is your use case? What are you trying to implement? |
Beta Was this translation helpful? Give feedback.
-
I used to work with a stack based calculator and it indeed had the ROT operation. Running into this from times to times. Lately it is this scenario:
to compute the capacity I need to do (max - low), length with (high - low) and save the values to dest and (dest + 8). Without ROT
With ROT
1 less instruction and no need for a local to store dest. Not a big deal, but I find the second one easier to reason about. NB. changing the order in which the values are produced would be cumbersome. |
Beta Was this translation helpful? Give feedback.
-
Thank you for investigating this. Using a temp register is what I am currently doing. Will see if this can be ridden of by re organising my code. |
Beta Was this translation helpful? Give feedback.
-
Thanks!! |
Beta Was this translation helpful? Give feedback.
-
Not sure if this is the best name, but I wish the stack implemented a rotation on 3 values on the stack:
ROT would yields:
Beta Was this translation helpful? Give feedback.
All reactions