We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi,
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 complains an error of this line.
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
In Thumb mode ITNE is a variant of the IT instruction - but all the information to generate the instruction is there in the NE and EQ conditions on the following three instructions and the assembler can generate it from that. So one can leave the entire line out. Have a look at the IT instruction. The condition NE in the operand field is the same as the NE at the end of ANDNE, the T (then) following IT means the same code NE isapplies in the ADDSNE instruction and the E (else) at the end of ITTE applies the opposite code EQ to MOVEQ.
Hello,
is your information from ARM Information Center?
If it is true, I think the meaning of 'IT can be omitted' is the statements in the document.
You do not need to write IT instructions in your code, because the assembler generates them for you automatically according to the conditions specified on the following instructions. However, if you do write IT instructions, the assembler validates the conditions specified in the IT instructions against the conditions specified in the following instructions.
That is, for exsample, 'ANDNE' stands for 'ANDITNE', and so on.
Best regards,
Yasuhiko Koumoto.
Yes, thanks.
The words are clear, but the assembler I use does not tolerate without the If line. Maybe ARM's assembler can accept no If line block.
let me a little correct my answer.
The meaning of 'IT can be omitted' is that the armasm of the RealView tool-chains will generate automatically IT instruction on condition there are instructions which are added execution conditions.
That is,
the instruction sequence of
ANDNE r0,r0,r1
ADDSNE r2,r2,#1
MOVEQ r2,r3
will be interpreted as
ITTE NE
MOVEQ r2,r3.
However, GCC seems not to have such features.