What does it mean 'IT can be omitted'?

Hi,

First of all, I would explain a little with an answer to my previous post. I know the present days compiler is much better than the old days. Assembly code has less usage in practical engineering. But it is required in some p rojects mandatory. My previous job was mainly assembly coding, but not for ARM. Now, I would migrate to ARM assembly code programming.

When I read the following on ARM website, I don't understand the first line . When I change ITTE to TE (as 'IT can be omitted"), the assembler complain s an error of this line.

The comments in the first line is puzzling to me. Could you explain it to me? Thanks, ITTE NE ; IT can be omitted ANDNE r0,r0,r1 ; 16-bit AND, not ANDS ADDSNE r2,r2,#1 ; 32-bit ADDS (16-bit ADDS does not set flags in IT block ) MOVEQ r2,r3 ; 16-bit MOV ITT AL ; emit 2 non-flag setting 16-bit instructions ADDAL r0,r0,r1 ; 16-bit ADD, not ADDS SUBAL r2,r2,#1 ; 16-bit SUB, not SUB ADD r0,r0,r1 ; expands into 32-bit ADD IT NE ADD r0,r0,r1 ; syntax error: no condition code used in IT block ITT EQ MOVEQ r0,r1 BEQ dloop

Reply to
Robert Willy
Loading thread data ...

I found a couple of web pages that seem to explain this. In other versions of the ARM instruction set some instructions can execute conditionally. That is noted by the 'NE' in the ANDNE instruction. The several choices of conditions and polarity chew up a few bits in these opcodes. In the Thumb-2 instruction set, they found another way to handle it. They added the IT instruction for If-Then. This instruction apparently will encode the flag being used for the optional execution for up to four following instructions and can use different polarities for each one.

So the ITTE selects the Not Equal condition code for the use of the next three instructions (I-TTE) with the first two being NE (the THEN parts) and the third being EQ (the ELSE parts).

I didn't verify this, but the individual opcodes then use no flag bits to indicate they are being used for conditional execution with the full control done via the IT instruction. This may use more bits total when comparing the conditional instructions, but the flag bits are also removed from all these instructions including the ones not used for conditional execution.

That said, I can't explain the comment exactly. I think they are just trying to indicate these instructions are executed conditionally.

--

Rick
Reply to
rickman

The explanation can be found on the same page as the example.

-a

Reply to
Anders.Montonen

.

ly code has less usage in practical engineering. But it is required in some projects mandatory. My previous job was mainly assembly coding, but not fo r ARM. Now, I would migrate to ARM assembly code programming.

ne. When I change ITTE to TE (as 'IT can be omitted"), the assembler compla ins an error of this line.

ck)

Yes, theoretically, the first IF line is not necessary. The assembler I use doesn't allow to ignore it. Maybe some other assembler can do without it. Thanks

Reply to
Robert Willy

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.