[PATCH] D145540: [InstCombine] Reduce absolute diff from min+max+sub
Jun Zhang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 8 07:47:13 PST 2023
junaire added inline comments.
================
Comment at: llvm/test/Transforms/InstCombine/sub-minmax.ll:1035
+ %min = call i8 @llvm.smin.i8(i8 %b, i8 %a)
+ %max = call i8 @llvm.smax.i8(i8 %b, i8 %a)
+ %ab = sub nsw i8 %max, %min
----------------
RKSimon wrote:
> shouldn't this be:
> ```
> %max = call i8 @llvm.smax.i8(i8 %a, i8 %b)
> ```
> shouldn't this be:
> ```
> %max = call i8 @llvm.smax.i8(i8 %a, i8 %b)
> ```
IIUC, we should test all the following cases?
1. max(a, b) - min(a, b)
2. max(b, a) - min(b, a)
3. max(a, b) - min(b, a)
4. max(b, a) - min(a, b)
However, I'm not certain it is worth doing so. I'll pick case 1 and case 3 then.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D145540/new/
https://reviews.llvm.org/D145540
More information about the llvm-commits
mailing list