Hello. This is Dr Miller and this episode 12.12 of assembly
Today we're gonna again talk about conditional execution, but we're going to talk about I t blocks.
So some i t conditional execution.
So thumb to does not have the bits for standalone, conditional instructions,
but in order to compensate for that a little bit, it does have I t blocks.
And so these are gonna be available for both thumb to and our moon.
And then when you get into arm version eight, it actually deprecate this functionality and removes it.
So what are I t blocks?
So I t blocks our if then blocks and they allow up to four different instructions to be conditionally executed
when they run an arm thumb to mood.
So we have this set of instructions I t t e Q. And then we have three instructions that follow this particular example.
So an I t block. So it's I t. And then it's followed the then by X, y and Z,
and then some flag that we care about.
And so X, y and Z can be either tea or E. So they're one of the two letters to your E
and then the number of them is optional. So we can have 012 or three,
and then the conditions must be ordered correctly based on what you're doing with them.
So the tea is then s O that must match our condition. The e is an else, and it must be the opposite of our condition. And then the flag is one of those conditional suffixes that we have seen.
So again, we have seen the suffixes like equal, not equal, greater than or equal to less than greater than less than equal are typically the ones that you're going to see.
So here are some example I T blocks.
And so one of the things that you're going to see is that if I have to tease, then those will have to match this condition. So e que e que e que
um and then our else is something that is not a Q or the opposite of U Q is not equal.
So this I t block has I t t e e. And so we got I then then and then and else, Or
if then else So I gotta then so we got a negative M I is
negative and pl is positive. And so these conditions have to match what's in our I t block?
Are we gonna have an I t t t
So we got three then, right? So if negative here, I got three different negative instructions that I can use for that
or i t and then e So I got one then and to else's so one then,
um g t. And then we got less than able to lessen equal two in that one.
So here's an example using the if then blocks so we can see that we have a function here and it says dot be aligned to So we're relying on to buy boundaries and then this is a thumb function.
And then our function bar is going to move our zero into our one and then compare are zero to the number 10 and then it's got it. If then
that if then then else So we've got to then is two equals and then are not equal.
So we can movinto are zero the number one and then subtract the number one from r zero
or we do move. Are 0 100 And so this one. If you type
a 10 it will give you the number zero. And if you,
um cyp something that's not equal to 10 it will give you the value. 100 right? And so this was around. What about way of doing it? I could have just done the move zero for it. But I wanted to show the if then block inside of there.
Oh, and again, you're doing a branch of Lincoln Exchange, right? So I'm setting the link register, and then I'm also exchanging instruction sets to jump into bar because this is a regular armed function, and then this is a film function,
but we can see that this is also useful for not doing some mood. So it works both ways. So all I did in this is I just did a branch in a link and I didn't do an exchange. And then I removed the header from my thumb code, and I can use the exact same code if this is an arm block or if this is a thumb block.
So today we talked about some conditional execution using I t blocks
looking forward, we will given I t block example.
And then here's our quiz. So for an I t block, what does the T in the east and for
so t stands for, then an e stands for else.
If you have questions, you can email me Miller MJ at you and k dot edu You can find me on Twitter at Milhouse 30.