[PATCH] D11678: [CodeGen] Fixes *absdiff* intrinsic: LangRef doc/test case improvement and corresponding code change

hfinkel@anl.gov via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 18 09:26:09 PDT 2015


hfinkel added inline comments.

================
Comment at: docs/LangRef.rst:10873
@@ +10872,3 @@
+The ``llvm.uabsdiff`` intrinsic returns a vector result of the absolute difference
+of the two operands, treating them both as unsigned integers. The operation of this
+intrinsic will be performed on a larger data type than the given type.
----------------
I'd phrase this differently, and say that the intermediate calculations are computed using infinitely-precise unsigned arithmetic. That's similar to the language we used for inbounds GEPs.

================
Comment at: docs/LangRef.rst:10879
@@ -10877,1 +10878,3 @@
+the two operands, treating them both as signed integers. If the result overflows, the
+behavior is undefined and targets are supposed to define their own behavior.
 
----------------
We cannot have target-defined behavior for target-independent IR intrinsics. You can say only that the result is undefined. If an application wants to rely on target-specific overflow behavior, then it will need to directly use some target-specific intrinsics, inline asm, etc.


================
Comment at: lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp:747
@@ +746,3 @@
+                                                         *DAG.getContext(), VT),
+                  Sub, DAG.getConstant(0, dl, VT), DAG.getCondCode(ISD::SETGE));
+  SDValue Neg = DAG.getNode(ISD::SUB, dl, VT, DAG.getConstant(0, dl, VT), Sub, &Flags);
----------------
Should this be ISD::SETGE for both the signed and unsigned case?


http://reviews.llvm.org/D11678





More information about the llvm-commits mailing list