[PATCH] D10867: [Codegen] Added intrinsics 'absdiff' and corresponding SDNodes for absolute difference operation
James Molloy
james.molloy at arm.com
Fri Jul 10 03:32:08 PDT 2015
jmolloy added inline comments.
================
Comment at: lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:2935
@@ +2934,3 @@
+ Results.push_back(Tmp1);
+ break;
+ }
----------------
hfinkel wrote:
> ashahid wrote:
> > hfinkel wrote:
> > > Both ISD::UABSDIFF and ISD::SABSDIFF are the same?
> > >
> > Correct me if I am wrong, I think with respect to expansion here both are same as the signedness of 'absolute diff' operation depends on the 1st 'SUB' operation.
> Ah, I see what you mean. The difference at the IR level is that SABSDIFF has NSW on the SUBs, and the unsigned version does not. The nice thing is that we can now do this at the SDAG level too..
>
> SDNodeFlags Flags;
> Flags.setNoSignedWrap(true);
>
> Tmp1 = DAG.getNode(ISD::SUB, dl, VT, Tmp2, Tmp3, &Flags);
>
> (and similar for the other nodes)
>
I think ISD::SETLT should also change to ISD::SETULT depending on signedness.
Repository:
rL LLVM
http://reviews.llvm.org/D10867
More information about the llvm-commits
mailing list