[PATCH] D35650: [PowerPC] Don't crash on larger splats that can be achieved through 1-byte splats
Nemanja Ivanovic via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 8 06:53:49 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL310358: [PowerPC] Don't crash on larger splats achieved through 1-byte splats (authored by nemanjai).
Changed prior to commit:
https://reviews.llvm.org/D35650?vs=107407&id=110188#toc
Repository:
rL LLVM
https://reviews.llvm.org/D35650
Files:
llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp
llvm/trunk/test/CodeGen/PowerPC/splat-larger-types-as-v16i8.ll
Index: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp
===================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp
+++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp
@@ -7650,6 +7650,15 @@
return DAG.getBitcast(Op.getValueType(), NewBV);
return NewBV;
}
+
+ // BuildVectorSDNode::isConstantSplat() is actually pretty smart. It'll
+ // detect that constant splats like v8i16: 0xABAB are really just splats
+ // of a 1-byte constant. In this case, we need to convert the node to a
+ // splat of v16i8 and a bitcast.
+ if (Op.getValueType() != MVT::v16i8)
+ return DAG.getBitcast(Op.getValueType(),
+ DAG.getConstant(SplatBits, dl, MVT::v16i8));
+
return Op;
}
Index: llvm/trunk/test/CodeGen/PowerPC/splat-larger-types-as-v16i8.ll
===================================================================
--- llvm/trunk/test/CodeGen/PowerPC/splat-larger-types-as-v16i8.ll
+++ llvm/trunk/test/CodeGen/PowerPC/splat-larger-types-as-v16i8.ll
@@ -0,0 +1,20 @@
+; RUN: llc -mcpu=pwr9 -mtriple=powerpc64-unknown-unknown < %s | FileCheck %s
+; RUN: llc -mcpu=pwr9 -mtriple=powerpc64le-unknown-unknown < %s | FileCheck %s
+define <8 x i16> @test1() {
+entry:
+ ret <8 x i16> <i16 257, i16 257, i16 257, i16 257, i16 257, i16 257, i16 257, i16 257>
+; CHECK-LABEL: test1
+; CHECK: xxspltib 34, 1
+}
+define <8 x i16> @testAB() {
+entry:
+; CHECK-LABEL: testAB
+; CHECK: xxspltib 34, 171
+ ret <8 x i16> <i16 43947, i16 43947, i16 43947, i16 43947, i16 43947, i16 43947, i16 43947, i16 43947>
+}
+define <4 x i32> @testAB32() {
+entry:
+; CHECK-LABEL: testAB32
+; CHECK: xxspltib 34, 171
+ ret <4 x i32> <i32 2880154539, i32 2880154539, i32 2880154539, i32 2880154539>
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35650.110188.patch
Type: text/x-patch
Size: 1801 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170808/59755157/attachment.bin>
More information about the llvm-commits
mailing list