[PATCH] D45720: [X86] Lowering PACK*S (pack with saturation) intrinsics to native IR (clang side)
Mikhail Dvoretckii via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 18 01:15:33 PDT 2018
mike.dvoretsky added inline comments.
================
Comment at: lib/CodeGen/CGBuiltin.cpp:8443
+ Value *MaxVec = llvm::ConstantInt::get(RTy, MaxVal);
+ Res = EmitX86MinMax(CGF, ICmpInst::ICMP_SLT, {Res, MaxVec});
+ Res = EmitX86MinMax(CGF, ICmpInst::ICMP_SGT, {Res, MinVec});
----------------
craig.topper wrote:
> Why arent' these unsigned compares for Unsigned?
The compares are signed on purpose. PACKUS assumes that the input elements are signed, then uses unsigned saturation. So, for instance, an 0xffff value must be evaluated as -1 and saturated to 0, rather than to 0xff as it would be with unsigned comparisons.
Repository:
rC Clang
https://reviews.llvm.org/D45720
More information about the cfe-commits
mailing list