[PATCH] D21372: [ARM] Lower (select_cc k k (select_cc ~k ~k x)) into (SSAT l_k x)

Pablo Barrio via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 22 08:48:00 PDT 2016


pbarrio marked an inline comment as done.

================
Comment at: lib/Target/ARM/ARMISelLowering.cpp:3837
@@ +3836,3 @@
+  uint64_t Val2 = cast<ConstantSDNode>(*K2)->getSExtValue();
+  uint64_t PosVal = Val1 < Val2 ? Val1 : Val2;
+
----------------
rengolin wrote:
> Wait, this looks backwards...
> 
> Shouldn't the positive value be something like:
> 
>     std::max(Val1, Val2);
> 
> but you seem to be getting the lowest of both sign extended values.
I'm comparing two unsigned integers, so effectively the "negative" numbers are bigger than the positive ones because the most significant bit is always 1.

I'm doing this because getSExtValue() returns a uint64_t. I could cast Val1 and Val2 to signed and therefore do a signed integer compare. Let me know if you prefer that.


http://reviews.llvm.org/D21372





More information about the llvm-commits mailing list