Zhao, Weiming
2012-Nov-17 02:43 UTC
[LLVMdev] Question about lowering clamp function to bic/usat on ARM
Hi, Given a function like x < 0 ? 0 : x We can lower it to bic x, x, asr 31 because we can test if CC==LT && RHS==TrueVal==0 && LHS==FalseVal Further, give a function x > 255 ? 255 : (x < 0 ? 0 :x), we should lower it to: usat x, #8 However, things become more complicated if we have ((x < 0 ? 0 :x) << n ) & mask ... Because it will first be converted to x < 0 ? 0 : ((x << n) & mask) Now, it's hard to match the pattern. (Doable but nasty) Any suggestions? Thanks in advance. Weiming Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121117/968cfd3b/attachment.html>