VFP advice/tutorial
Steve Drain (222) 1620 posts |
Because the nature of |
Jeffrey Lee (213) 6048 posts |
Link please? The copy of the ARMv8 ARM I’m looking at only has two bits reserved for the condition code, and lots of comments saying “Cannot be conditional” since the instruction does one action if the condition passes and one action if it fails (unlike regular conditional instructions which do no action if the condition fails) |
Steve Drain (222) 1620 posts |
This is where I have been looking: http://infocenter.arm.com/help/It is a confusing situation. ;-) Edit: I am happy to document the instructions either way. Indeed, my first draft does treat them as separate instructions. |
Jeffrey Lee (213) 6048 posts |
I was hoping you’d link to a specific page/section, rather than the entirety of ARM’s documentation website ;-) Searching for the text you quoted leads me to the Cortex-M docs, where it does indeed say that VSEL has an optional condition code. But I think that must be a typo, since it then goes on to list the 4 condition codes supported by the instruction set, and the 4 inverse codes that can be obtained by swapping the arguments. And in neither of those sets is there an “AL” condition code, so if you were to omit the condition code then there’s no telling what would happen (maybe they’re expecting the assembler to replace the instruction with a simple unconditional VMOV?) In any case, the armasm docs show that the condition code is mandatory, and they only list the four main codes – no mention of how you (or the assembler) can swap arguments to get four more, suggesting that the assembler doesn’t support that functionality. |
Steve Drain (222) 1620 posts |
It uses frames, so tricky. ;-)
That is the pertinent question, as well as the other unrecognised conditions. Presumably it would be up to the assembler to flag the omission – which is really treating these as separate instructions.
Those will specify a condition to be matched – what will happen if it is not matched in ASPR? I would assume that will be nothing. It does look like the ARM documentation is at odds with itself. I will document them as separate in the manual. |
Jeffrey Lee (213) 6048 posts |
The copy of the ARMv8 ARM I’m looking at only has two bits reserved for the condition code As I say in my docs:
Or as the armasm manual states:
Or as the ARMv8 ARM states:
i.e. VSELEQ A,B,C is equivalent to VMOVEQ A,B followed by VMOVNE A,C |
Steve Drain (222) 1620 posts |
I had a look at the armasm manual – it is just not the same as the other. As you point out, it also says:
Surely that conflicts with:
The first of these is similar to the way Anyway, I know what to do for the SH manual and I will let ARM look after themselves. ;-) |
Jeffrey Lee (213) 6048 posts |
Hmm, well spotted! So it looks like the armasm manual is wrong as well. FWIW the pseudocode in the ARMv8 ARM is: if dp_operation then D[d] = if ConditionHolds(cond) then D[n] else D[m]; else S[d] = if ConditionHolds(cond) then S[n] else S[m]; ConditionHolds checks the NZCV flags in the PSR, and ‘cond’ is a usual 4-bit condition code that’s been reconstructed from the 2 bits in the instruction.
VS comes from the way that VFP handles comparisons (which I think might not be the same as how FPA handled it). |
Steve Drain (222) 1620 posts |
“I knew that!” – at least, I have documented it. ;-)
Just to be certain, in the light of the confusion: APSR not FPSCR.
While browsing the ARM docs I found the reference that |
Jeffrey Lee (213) 6048 posts |
Correct.
Yes, I’d say so. BASIC assembler supports them (and I’d assume ObjAsm too). Just remember that it’s only the two-register versions which have aliases, not the register-and-zero versions. |
Jeffrey Lee (213) 6048 posts |
VFP Addendum: the R, X & Z forms are conditional instructions. A, M, N & P are unconditional. |
Steve Drain (222) 1620 posts |
I have uploaded version 0.40 of the StrongHelp VFP manual to: http://www.kappa.me.uk/StrongHelp/shVFP040.zipPlease let me know of bugs and mistakes. |