Issue 185244
Summary [InstCombine] Missed optimization: `trunc(smax(zext(a) - zext(b), 0)) -> usub.sat(a, b)`
Labels llvm:instcombine, missed-optimization
Assignees
Reporter sweiglbosker
    Possible folds

- `trunc(smax(zext(a) - zext(b), 0)) -> usub.sat(a, b)`
- `trunc(umin(zext(a) + zext(b), MAX)) -> uadd.sat(a, b)`

where a and b have the same type as the trunc result, the zext is to any wider type, and MAX is wrt the narrow type

https://llvm.godbolt.org/z/hnfnf5EK3
https://alive2.llvm.org/ce/z/vEhHH- (noundef on vector case to avoid timeout on ce, but it validates quickly locally with i4)
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to