Open LebedevRI opened 2 years ago
@llvm/issue-subscribers-backend-X86
Should we consider the form with min/max intrinsics? (we'll canonicalize to them some day...) https://alive2.llvm.org/ce/z/kCpnF8
We'll need backend optimizations no matter which form we choose in IR. Even within the scalar or vector subsets, x86 may be suboptimal depending on type (for example, no cmov for i8 directly).
CC @RKSimon
https://reviews.llvm.org/D144789 will add the select(icmp_gt(x,y),sub(x,y),sub(y,x)) -> abd(x,y) fold - although we don't support scalars
As being pointed out in https://github.com/halide/Halide/pull/6545 we don't codegen
a < b ? b - a : a - b
as well as we domax(a, b) - min(a, b)
https://godbolt.org/z/MvMj9MPW9 https://alive2.llvm.org/ce/z/pVHePiThe question is, what do we think is more canonical in IR?