[PATCH] D26357: [SelectionDAG] Add a signed integer absolute intrinsic

James Molloy via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 8 00:45:56 PST 2016


jmolloy added a comment.

I agree with Eli, this should be discussed in an RFC on llvm-dev.

The proposed semantics are quite strange at first sight. I couldn't understand why you'd care that the input is signed and the result is unsigned until I saw the special case for INT_MIN.

What is the purpose of that special case? the usual way of implementing signed integer abs() is `v & (UINT_MAX-1)` (clearing the sign bit), which of course doesn't work for this case. How do you propose other architectures implement it, and why is it needed?

James


Repository:
  rL LLVM

https://reviews.llvm.org/D26357





More information about the llvm-commits mailing list