[PATCH] D28722: [NVPTX] Lower integer absolute value idiom to abs instruction.

Artem Belevich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 17 13:47:16 PST 2017


tra accepted this revision.
tra added inline comments.
This revision is now accepted and ready to land.


================
Comment at: llvm/lib/Target/NVPTX/NVPTXInstrInfo.td:490
+// Integer absolute value.  NumBits should be one minus the bit width of RC.
+multiclass ABS<RegisterClass RC, int NumBits, string SizeName> {
+  def : NVPTXInst<(outs RC:$dst), (ins RC:$a),
----------------
Perhaps add a link describing this way of calculating abs().
http://graphics.stanford.edu/~seander/bithacks.html#IntegerAbs



https://reviews.llvm.org/D28722





More information about the llvm-commits mailing list