<div dir="ltr">I'm trying to find a way to emulate a floating point instruction, say a floating point add. My understanding is that in order to do that I need to execute <div><br><div>setOperationAction(ISD::FADD, (MVT::f32, Expand);</div><div>setOperationAction(ISD::FADD, (MVT::f64, Expand);</div><div><br></div><div>in MyTargetISelLowering.cpp, MyTargetLowering::MyTargetLowering(...).</div><div><br></div><div>However for some reason I'm still seeing a floating point add in the final assembly. I tried running my test code (provided below) on MSP430 and can see it execute a jump instruction to a label that is clearly located in the library code. </div><div><br></div><div>Here is my test code:</div><div><br></div><div><div>; ModuleID = 'simple-fadd.c'</div><div>target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"</div><div>target triple = "x86_64-pc-linux-gnu"</div><div><br></div><div>; Function Attrs: nounwind readnone uwtable</div><div>define float @fadd(float %a, float %b) #0 {</div><div>  %1 = fadd float %a, %b</div><div>  ret float %1</div><div>}</div><div><br></div><div>attributes #0 = { nounwind readnone uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }</div><div><br></div><div>!llvm.ident = !{!0}</div><div><br></div><div>!0 = metadata !{metadata !"Ubuntu clang version 3.4.0-2ubuntu1~trusty1 (tags/RELEASE_340/final) (based on LLVM 3.4.0)"}</div></div><div><br></div><div><br></div><div>And here is what I see in MSP430</div><div><br></div><div><div><span class="" style="white-space:pre">   </span>.text</div><div><span class="" style="white-space:pre">      </span>.syntax unified</div><div><span class="" style="white-space:pre">    </span>.cpu<span class="" style="white-space:pre">      </span>msp430</div><div><span class="" style="white-space:pre">     </span>.eabi_attribute<span class="" style="white-space:pre">   </span>6, 1<span class="" style="white-space:pre">      </span>@ Tag_CPU_arch</div><div><span class="" style="white-space:pre">     </span>.eabi_attribute<span class="" style="white-space:pre">   </span>8, 1<span class="" style="white-space:pre">      </span>@ Tag_ARM_ISA_use</div><div><span class="" style="white-space:pre">  </span>.eabi_attribute<span class="" style="white-space:pre">   </span>20, 1<span class="" style="white-space:pre">     </span>@ Tag_ABI_FP_denormal</div><div><span class="" style="white-space:pre">      </span>.eabi_attribute<span class="" style="white-space:pre">   </span>21, 1<span class="" style="white-space:pre">     </span>@ Tag_ABI_FP_exceptions</div><div><span class="" style="white-space:pre">    </span>.eabi_attribute<span class="" style="white-space:pre">   </span>23, 3<span class="" style="white-space:pre">     </span>@ Tag_ABI_FP_number_model</div><div><span class="" style="white-space:pre">  </span>.eabi_attribute<span class="" style="white-space:pre">   </span>24, 1<span class="" style="white-space:pre">     </span>@ Tag_ABI_align_needed</div><div><span class="" style="white-space:pre">     </span>.eabi_attribute<span class="" style="white-space:pre">   </span>25, 1<span class="" style="white-space:pre">     </span>@ Tag_ABI_align_preserved</div><div><span class="" style="white-space:pre">  </span>.file<span class="" style="white-space:pre">     </span>"simple-fadd.ll"</div><div><span class="" style="white-space:pre"> </span>.globl<span class="" style="white-space:pre">    </span>fadd</div><div><span class="" style="white-space:pre">       </span>.align<span class="" style="white-space:pre">    </span>2</div><div><span class="" style="white-space:pre">  </span>.type<span class="" style="white-space:pre">     </span>fadd,%function</div><div>fadd:                                   @ @fadd</div><div><span class="" style="white-space:pre">      </span>.fnstart</div><div>.Leh_func_begin0:</div><div>@ BB#0:</div><div><span class="" style="white-space:pre">     </span>push<span class="" style="white-space:pre">      </span>{lr}</div><div><span class="" style="white-space:pre">       </span>bl<span class="" style="white-space:pre">        </span>__addsf3</div><div><span class="" style="white-space:pre">   </span>pop<span class="" style="white-space:pre">       </span>{lr}</div><div><span class="" style="white-space:pre">       </span>mov<span class="" style="white-space:pre">       </span>pc, lr</div><div>.Ltmp0:</div><div><span class="" style="white-space:pre">       </span>.size<span class="" style="white-space:pre">     </span>fadd, .Ltmp0-fadd</div><div>.Leh_func_end0:</div><div><span class="" style="white-space:pre">    </span>.fnend</div><div><br></div><div><br></div><div><span class="" style="white-space:pre">   </span>.ident<span class="" style="white-space:pre">    </span>"Ubuntu clang version 3.6.0-2ubuntu1~trusty1 (tags/RELEASE_360/final) (based on LLVM 3.6.0)"</div><div><br></div><div>One can clearly see a bl __addsf3 instruction. However for some reason my target produces a lf.add.s (which is a floating point add) instead of branching to a library code. Clearly I'm missing something, but I can't figure out what exactly. Would anyone care to help?</div><div><br></div><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>Rail Shafigulin<br></div>Software Engineer <br>Esencia Technologies<br></div></div></div></div>
</div></div></div>