Expand the horizontal reduction during the instruction selection phase, but only if the target doesn't support the full fp16 instruction set.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/test/CodeGen/AArch64/vecreduce-fmax-legalization.ll | ||
---|---|---|
3 | Hi, instead of having two RUN lines here would it be better to just use function attributes, i.e. for test_v4f16 have a function attribute that adds "fullfp16" support? That way you only need one RUN line and can avoid all the additional FP16 check lines too, since most of them seem to be the same as the first RUN line. | |
llvm/test/CodeGen/AArch64/vecreduce-fmin-legalization.ll | ||
69 | It looks like you've added FP16 checks here without the additional RUN line. Similar to my comment in the fmax case perhaps you can just use function attributes instead? |
llvm/test/CodeGen/AArch64/vecreduce-fmax-legalization.ll | ||
---|---|---|
3 | You could also use multiple check prefixes to avoid having repeated check for both RUN lines, if they are equal, e.g. FileCheck %s --check-prefix=CHECK --check-prefix=NOFP16 ..., FileCheck %s --check-prefix=CHECK --check-prefix=FP16 ... With that, we should only need separate FP16/NOFP16 check lines for functions where there is a difference. |
llvm/test/CodeGen/AArch64/vecreduce-fmax-legalization.ll | ||
---|---|---|
3 | The main idea is to check the expanded reduction is emitted when fullfp16 is not specified, I guess the FP16 check can be removed altogether if we don't care about checking the case where the intrinsic can be lowered. | |
llvm/test/CodeGen/AArch64/vecreduce-fmin-legalization.ll | ||
69 | Good catch, I keep forgetting pieces when I git add. |
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp | ||
---|---|---|
10489 | Might be better to not mark them Custom in the first place? https://github.com/llvm/llvm-project/blob/3b47bd32f9df4a57db98db5f35e680c7bd9fde3e/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp#L1019-L1023 |
llvm/test/CodeGen/AArch64/vecreduce-fmax-legalization.ll | ||
---|---|---|
3 |
That's also a good point. I'm not sure how things will shake out with more tests for half; I think we should have fp16 tests both with and without fullfp16, as long we have that and can avoid must of the redundant check lines, I am happy whichever way we go :) | |
49 | can you also throw in a test with vectors that are not directly legal, regardless of fullfp16? |
Don't mark the fmin/fmax ops as legal if fullfp16 is not available.
Update test cases.
Might be better to not mark them Custom in the first place? https://github.com/llvm/llvm-project/blob/3b47bd32f9df4a57db98db5f35e680c7bd9fde3e/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp#L1019-L1023