[LLVMdev] Generate assembly without sqrt.d

Tim Northover t.p.northover at gmail.com
Wed Jun 27 13:29:41 PDT 2012


> Is there a fast way to generate MIPS assembly from llc without using a
> specific instruction like sqrt.d (I want it to use the software call
> to Math.sqrt instead)?

It's rather a hack, but LLVM will only deduce a square-root operation
in limited circumstances:
  + a call to the intrinsic version (e.g. @llvm.sqrt.f32)
  + a call to one of "sqrt", "sqrtf", "sqrtl" which obeys certain
constraints (most non-obviously it only reads memory, see
SelectionDAGBuilder.cpp line 5586).

If you change your .ll files you can fairly easily prevent that from triggering.

There are no "don't use this single instruction" or "don't look for
sqrt" options for llc.

Tim.



More information about the llvm-dev mailing list