[PATCH] D57359: [GlobalISel] Introduce a G_FSQRT generic instruction
Jessica Paquette via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 28 14:59:01 PST 2019
paquette marked an inline comment as done.
paquette added inline comments.
================
Comment at: include/llvm/Target/GenericOpcodes.td:572-577
+// Floating point square root of a value.
+def G_FSQRT : GenericInstruction {
+ let OutOperandList = (outs type0:$dst);
+ let InOperandList = (ins type0:$src1);
+ let hasSideEffects = 0;
+}
----------------
arsenm wrote:
> arsenm wrote:
> > Needs a comment about the < 0 behavior. One particularly awful detail of SelectionDAG is ISD::FSQRT 's behavior differs from the llvm.sqrt intrinsic.
> To be more specific, the IR claims this is undefined, which is the wrong answer. This should return a NAN
Hmm, actually, I'm thinking maybe this should be G_INTRINSIC_SQRT, so that we can be clear which cases in which this ought to be used.
Reading up on this a bit more, I found this (12-year-old) thread: http://lists.llvm.org/pipermail/llvm-dev/2007-August/010253.html
"Also, this makes llvm.sqrt side-effect free, where sqrt potentially has side-effects (making it harder to CSE, hoist out of loops etc)."
If that's true today, then I guess the llvm.sqrt case should be handled separately.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D57359/new/
https://reviews.llvm.org/D57359
More information about the llvm-commits
mailing list