This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC][LoopVectorize] Extend getRegisterClassForType to consider double and other floating point type
ClosedPublic

Authored by jsji on Dec 27 2019, 12:47 PM.

Details

Summary

In https://reviews.llvm.org/D67148, we use isFloatTy to test floating
point type, otherwise we return GPRRC.
So 'double' will be classified as GPRRC, which is not accurate.

This patch generate different RC for other floating point types.

Diff Detail

Event Timeline

jsji created this revision.Dec 27 2019, 12:47 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 27 2019, 12:47 PM

Unit tests: pass. 61132 tests passed, 0 failed and 728 were skipped.

clang-tidy: pass.

clang-format: pass.

Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml

nemanjai added inline comments.Dec 27 2019, 1:33 PM
llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp
597

It seems perfectly reasonable that we want to return VSX/FPR for f32 and f64 types. However, it is not clear to me what we want to do for ppc_fp128, f128, f16, etc.

Don't get me wrong, I think the existing implementation is definitely wrong, I am just wondering if this is a complete solution.

jsji marked an inline comment as done.Dec 27 2019, 1:50 PM
jsji added inline comments.
llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp
597

Yeah, good point.
Since most operations on ppc_f128 values become calls later, I don't think it matters much here.
While I am not sure whether we really support f16 well on PowerPC right now.

So I am preferring just leave it at it is for now.
But, yes, I am happy to accept any other suggestions.

jsji updated this revision to Diff 235731.Dec 31 2019, 2:27 PM

Handle fp128 and fp16.

jsji marked an inline comment as done.Dec 31 2019, 2:29 PM
jsji added inline comments.
llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp
597

OK. I have updated the code to handle f128 and f16, please have a look. Thanks.

Unit tests: pass. 61144 tests passed, 0 failed and 728 were skipped.

clang-tidy: pass.

clang-format: pass.

Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml

nemanjai accepted this revision.Jan 1 2020, 7:24 PM

LGTM but maybe give the original author a day or two to have a look as well before committing.

This revision is now accepted and ready to land.Jan 1 2020, 7:24 PM
jsji updated this revision to Diff 236127.Jan 3 2020, 1:52 PM

Rebase to show changes related to this change only.

Unit tests: pass. 61237 tests passed, 0 failed and 729 were skipped.

clang-tidy: pass.

clang-format: pass.

Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml

jsji edited the summary of this revision. (Show Details)Jan 6 2020, 10:51 AM
This revision was automatically updated to reflect the committed changes.