Hi all,<br><br>I am using LLVM compiler and CodeGen  for generating ARM binaries. <br><br>I was going through the code for ARM backend. I noticed that the ARM Condition field( Bits 31-28) is generated by converting the conditions used in icmp and branch. For example, if I have following C Code<br>
<br>int a,b,c,d;<br>c = a+b;<br><br>if(c==0)<br>     d = a + 10;<br><br><br>Then I get ( Assembly Instructions with opcodes only)<br><br>add <br><b>cmp</b><br>addeq<br><br><br>( basically converting branch to the predicate condition field)<br>
<br>I have a few questions regarding the above operation.<br>1. If I use GCC on above code, then I get following .s output:<br>   adds<br>   addeq<br><br>I don't  get the intermediate compare instruction, which I got when I used LLVM. So, does LLVM ARM Backend assume that only "cmp" and "test" instructions can set the Status flags and not the usual arithmetic instructions. Is there any way of specifying to Backend that add can also modify status flag through "s" bit.<br>
<br>2. Also, when I looked at ISelLowering file, I noticed that conditions used in "icmp" instructions are converted to ARM Predicate Condition fields. Icmp has only "10" conditions, which map to corresponding "10" conditions in ARM Condition field but ARM can have fourteen conditions. If we consider the mapping shown in ISelLowering File, then following four conditions are left:<br>
"VS": Overflow Set<br>"VC" : Overflow Clear<br>"MI" : Minus<br>"PL": Plus<br><br>So, does this mean that it is not possible to obtain the above conditions are predicate if we use LLVM Compiler framework.<br>
<br>Thanks<br><br>Regards,<br>Kapil Anand<br><br><br>