summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorArtem Belevich <tra@google.com>2018-04-06 21:10:24 +0000
committerArtem Belevich <tra@google.com>2018-04-06 21:10:24 +0000
commita28e598ebb60b672712da7a8c3b0a4612f8e9e2d (patch)
treee3cfd4213e8b774707adc24ee21cd2ce5f2f3f97 /llvm/lib
parentc1b0e66b586b6898ee73efe445fe6af4125bf998 (diff)
downloadbcm5719-llvm-a28e598ebb60b672712da7a8c3b0a4612f8e9e2d.tar.gz
bcm5719-llvm-a28e598ebb60b672712da7a8c3b0a4612f8e9e2d.zip
[NVPTX] Fixed vectorized LDG for f16.
v2f16 is a special case in NVPTX. v4f16 may be loaded as a pair of v2f16 and that was not previously handled correctly by tryLDGLDU() Differential Revision: https://reviews.llvm.org/D45339 llvm-svn: 329456
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp b/llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp
index 99305440eef..9538d795cc9 100644
--- a/llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp
+++ b/llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp
@@ -1239,6 +1239,12 @@ bool NVPTXDAGToDAGISel::tryLDGLDU(SDNode *N) {
if (EltVT.isVector()) {
NumElts = EltVT.getVectorNumElements();
EltVT = EltVT.getVectorElementType();
+ // vectors of f16 are loaded/stored as multiples of v2f16 elements.
+ if (EltVT == MVT::f16 && N->getValueType(0) == MVT::v2f16) {
+ assert(NumElts % 2 == 0 && "Vector must have even number of elements");
+ EltVT = MVT::v2f16;
+ NumElts /= 2;
+ }
}
// Build the "promoted" result VTList for the load. If we are really loading
OpenPOWER on IntegriCloud