[llvm] r364557 - Recommit [PowerPC] Update P9 vector costs for insert/extract element
Jordan Rupprecht via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 1 16:33:49 PDT 2019
Reverted in r364876. I'm not sure which of Eric or myself is busier, but
I'll also try to get a reproducer.
On Fri, Jun 28, 2019 at 6:32 PM Eric Christopher via llvm-commits <
llvm-commits at lists.llvm.org> wrote:
> Hi Roland,
>
> I'm seeing an instruction selection crash with this on some internal code:
>
> fatal error: error in backend: Cannot select: 0x7fffbabb30d0: v1i128 =
> smin 0x7fffbabb3000, 0x7fffbb233820
> 0x7fffbabb3000: v1i128 = smax 0x7fffbb233f08, 0x7fffbabb3958
> 0x7fffbb233f08: v1i128 = add nsw 0x7fffbabf4820, 0x7fffbabf4a90
> 0x7fffbabf4820: v1i128 = bitcast 0x7fffbb233138
> 0x7fffbb233138: v2i64 = BUILD_VECTOR 0x7fffbabf48f0, 0x7fffbb233750
> 0x7fffbabf48f0: i64 = extract_vector_elt 0x7fffbb233478,
> Constant:i64<0>
> 0x7fffbb233478: v2i64,ch = CopyFromReg 0x7fffbb5c8058,
> Register:v2i64 %1
> 0x7fffbb233410: v2i64 = Register %1
> 0x7fffbb233068: i64 = Constant<0>
> 0x7fffbb233750: i64 = sra 0x7fffbabf48f0, Constant:i32<63>
> 0x7fffbabf48f0: i64 = extract_vector_elt 0x7fffbb233478,
> Constant:i64<0>
> 0x7fffbb233478: v2i64,ch = CopyFromReg 0x7fffbb5c8058,
> Register:v2i64 %1
> 0x7fffbb233410: v2i64 = Register %1
> 0x7fffbb233068: i64 = Constant<0>
> 0x7fffbb233a28: i32 = Constant<63>
> 0x7fffbabf4a90: v1i128 = bitcast 0x7fffbb233af8
> 0x7fffbb233af8: v2i64 = BUILD_VECTOR 0x7fffbabf4958, 0x7fffbabf4750
> 0x7fffbabf4958: i64,ch = CopyFromReg 0x7fffbb5c8058,
> Register:i64 %3
> 0x7fffbb2333a8: i64 = Register %3
> 0x7fffbabf4750: i64 = sra 0x7fffbabf4958, Constant:i32<63>
> 0x7fffbabf4958: i64,ch = CopyFromReg 0x7fffbb5c8058,
> Register:i64 %3
> 0x7fffbb2333a8: i64 = Register %3
> 0x7fffbb233a28: i32 = Constant<63>
> 0x7fffbabb3958: v1i128 = bitcast 0x7fffbabb3618
> 0x7fffbabb3618: v4i32 = BUILD_VECTOR Constant:i32<0>,
> Constant:i32<0>, Constant:i32<0>, Constant:i32<0>
> 0x7fffbb2338f0: i32 = Constant<0>
> 0x7fffbb2338f0: i32 = Constant<0>
> 0x7fffbb2338f0: i32 = Constant<0>
> 0x7fffbb2338f0: i32 = Constant<0>
> 0x7fffbb233820: v1i128 = bitcast 0x7fffbabf44e0
> 0x7fffbabf44e0: v2f64,ch = PPCISD::XXSWAPD 0x7fffbabf4a28:1,
> 0x7fffbabf4a28
> 0x7fffbabf4a28: v2f64,ch = PPCISD::LXVD2X<(load 16 from
> constant-pool)> 0x7fffbb5c8058, 0x7fffbb233340
> 0x7fffbb233340: i64,ch = PPCISD::TOC_ENTRY<(load 8 from got)>
> TargetConstantPool:i64<<2 x i64> <i64 9223372036854775807, i64 0>> 0,
> Register:i64 $x2
> 0x7fffbabb3548: i64 = TargetConstantPool<<2 x i64> <i64
> 9223372036854775807, i64 0>> 0
> 0x7fffbb2330d0: i64 = Register $x2
>
> Working on getting it reduced down so you've got a testcase, but I'd
> like to revert this in the mean time. FWIW once I get a testcase I
> probably will because it's already late on a Friday and you're OoO I'd
> imagine :)
>
> Thanks!
>
> -eric
>
> On Thu, Jun 27, 2019 at 9:20 AM Roland Froese via llvm-commits
> <llvm-commits at lists.llvm.org> wrote:
> >
> > Author: froese
> > Date: Thu Jun 27 09:20:24 2019
> > New Revision: 364557
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=364557&view=rev
> > Log:
> > Recommit [PowerPC] Update P9 vector costs for insert/extract element
> >
> > Recommit patch D60160 after regression fix patch D63463.
> >
> > Modified:
> > llvm/trunk/lib/Target/PowerPC/PPCTargetTransformInfo.cpp
> > llvm/trunk/test/Analysis/CostModel/PowerPC/insert_extract.ll
> >
> > Modified: llvm/trunk/lib/Target/PowerPC/PPCTargetTransformInfo.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCTargetTransformInfo.cpp?rev=364557&r1=364556&r2=364557&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/lib/Target/PowerPC/PPCTargetTransformInfo.cpp (original)
> > +++ llvm/trunk/lib/Target/PowerPC/PPCTargetTransformInfo.cpp Thu Jun 27
> 09:20:24 2019
> > @@ -752,6 +752,35 @@ int PPCTTIImpl::getVectorInstrCost(unsig
> > return 0;
> >
> > return Cost;
> > +
> > + } else if (Val->getScalarType()->isIntegerTy() && Index != -1U) {
> > + if (ST->hasP9Altivec()) {
> > + if (ISD == ISD::INSERT_VECTOR_ELT)
> > + // A move-to VSR and a permute/insert. Assume vector operation
> cost
> > + // for both (cost will be 2x on P9).
> > + return vectorCostAdjustment(2, Opcode, Val, nullptr);
> > +
> > + // It's an extract. Maybe we can do a cheap move-from VSR.
> > + unsigned EltSize = Val->getScalarSizeInBits();
> > + if (EltSize == 64) {
> > + unsigned MfvsrdIndex = ST->isLittleEndian() ? 1 : 0;
> > + if (Index == MfvsrdIndex)
> > + return 1;
> > + } else if (EltSize == 32) {
> > + unsigned MfvsrwzIndex = ST->isLittleEndian() ? 2 : 1;
> > + if (Index == MfvsrwzIndex)
> > + return 1;
> > + }
> > +
> > + // We need a vector extract (or mfvsrld). Assume vector
> operation cost.
> > + // The cost of the load constant for a vector extract is
> disregarded
> > + // (invariant, easily schedulable).
> > + return vectorCostAdjustment(1, Opcode, Val, nullptr);
> > +
> > + } else if (ST->hasDirectMove())
> > + // Assume permute has standard cost.
> > + // Assume move-to/move-from VSR have 2x standard cost.
> > + return 3;
> > }
> >
> > // Estimated cost of a load-hit-store delay. This was obtained
> >
> > Modified: llvm/trunk/test/Analysis/CostModel/PowerPC/insert_extract.ll
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/CostModel/PowerPC/insert_extract.ll?rev=364557&r1=364556&r2=364557&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/test/Analysis/CostModel/PowerPC/insert_extract.ll
> (original)
> > +++ llvm/trunk/test/Analysis/CostModel/PowerPC/insert_extract.ll Thu Jun
> 27 09:20:24 2019
> > @@ -14,15 +14,15 @@ define i32 @insert(i32 %arg) {
> > ; CHECK-P7-NEXT: Cost Model: Found an estimated cost of 0 for
> instruction: ret i32 undef
> > ;
> > ; CHECK-P8LE-LABEL: 'insert'
> > -; CHECK-P8LE-NEXT: Cost Model: Found an estimated cost of 10 for
> instruction: %x = insertelement <4 x i32> undef, i32 %arg, i32 0
> > +; CHECK-P8LE-NEXT: Cost Model: Found an estimated cost of 3 for
> instruction: %x = insertelement <4 x i32> undef, i32 %arg, i32 0
> > ; CHECK-P8LE-NEXT: Cost Model: Found an estimated cost of 0 for
> instruction: ret i32 undef
> > ;
> > ; CHECK-P9BE-LABEL: 'insert'
> > -; CHECK-P9BE-NEXT: Cost Model: Found an estimated cost of 11 for
> instruction: %x = insertelement <4 x i32> undef, i32 %arg, i32 0
> > +; CHECK-P9BE-NEXT: Cost Model: Found an estimated cost of 4 for
> instruction: %x = insertelement <4 x i32> undef, i32 %arg, i32 0
> > ; CHECK-P9BE-NEXT: Cost Model: Found an estimated cost of 0 for
> instruction: ret i32 undef
> > ;
> > ; CHECK-P9LE-LABEL: 'insert'
> > -; CHECK-P9LE-NEXT: Cost Model: Found an estimated cost of 11 for
> instruction: %x = insertelement <4 x i32> undef, i32 %arg, i32 0
> > +; CHECK-P9LE-NEXT: Cost Model: Found an estimated cost of 4 for
> instruction: %x = insertelement <4 x i32> undef, i32 %arg, i32 0
> > ; CHECK-P9LE-NEXT: Cost Model: Found an estimated cost of 0 for
> instruction: ret i32 undef
> > ;
> > %x = insertelement <4 x i32> undef, i32 %arg, i32 0
> > @@ -40,11 +40,11 @@ define i32 @extract(<4 x i32> %arg) {
> > ; CHECK-P8LE-NEXT: Cost Model: Found an estimated cost of 0 for
> instruction: ret i32 %x
> > ;
> > ; CHECK-P9BE-LABEL: 'extract'
> > -; CHECK-P9BE-NEXT: Cost Model: Found an estimated cost of 4 for
> instruction: %x = extractelement <4 x i32> %arg, i32 0
> > +; CHECK-P9BE-NEXT: Cost Model: Found an estimated cost of 2 for
> instruction: %x = extractelement <4 x i32> %arg, i32 0
> > ; CHECK-P9BE-NEXT: Cost Model: Found an estimated cost of 0 for
> instruction: ret i32 %x
> > ;
> > ; CHECK-P9LE-LABEL: 'extract'
> > -; CHECK-P9LE-NEXT: Cost Model: Found an estimated cost of 4 for
> instruction: %x = extractelement <4 x i32> %arg, i32 0
> > +; CHECK-P9LE-NEXT: Cost Model: Found an estimated cost of 2 for
> instruction: %x = extractelement <4 x i32> %arg, i32 0
> > ; CHECK-P9LE-NEXT: Cost Model: Found an estimated cost of 0 for
> instruction: ret i32 %x
> > ;
> > %x = extractelement <4 x i32> %arg, i32 0
> > @@ -83,15 +83,15 @@ define void @test4xi32(<4 x i32> %v1, i3
> > ; CHECK-P7-NEXT: Cost Model: Found an estimated cost of 0 for
> instruction: ret void
> > ;
> > ; CHECK-P8LE-LABEL: 'test4xi32'
> > -; CHECK-P8LE-NEXT: Cost Model: Found an estimated cost of 10 for
> instruction: %v2 = insertelement <4 x i32> %v1, i32 %x1, i32 2
> > +; CHECK-P8LE-NEXT: Cost Model: Found an estimated cost of 3 for
> instruction: %v2 = insertelement <4 x i32> %v1, i32 %x1, i32 2
> > ; CHECK-P8LE-NEXT: Cost Model: Found an estimated cost of 0 for
> instruction: ret void
> > ;
> > ; CHECK-P9BE-LABEL: 'test4xi32'
> > -; CHECK-P9BE-NEXT: Cost Model: Found an estimated cost of 11 for
> instruction: %v2 = insertelement <4 x i32> %v1, i32 %x1, i32 2
> > +; CHECK-P9BE-NEXT: Cost Model: Found an estimated cost of 4 for
> instruction: %v2 = insertelement <4 x i32> %v1, i32 %x1, i32 2
> > ; CHECK-P9BE-NEXT: Cost Model: Found an estimated cost of 0 for
> instruction: ret void
> > ;
> > ; CHECK-P9LE-LABEL: 'test4xi32'
> > -; CHECK-P9LE-NEXT: Cost Model: Found an estimated cost of 11 for
> instruction: %v2 = insertelement <4 x i32> %v1, i32 %x1, i32 2
> > +; CHECK-P9LE-NEXT: Cost Model: Found an estimated cost of 4 for
> instruction: %v2 = insertelement <4 x i32> %v1, i32 %x1, i32 2
> > ; CHECK-P9LE-NEXT: Cost Model: Found an estimated cost of 0 for
> instruction: ret void
> > ;
> > %v2 = insertelement <4 x i32> %v1, i32 %x1, i32 2
> > @@ -114,17 +114,17 @@ define void @vexti32(<4 x i32> %p1) {
> > ; CHECK-P8LE-NEXT: Cost Model: Found an estimated cost of 0 for
> instruction: ret void
> > ;
> > ; CHECK-P9BE-LABEL: 'vexti32'
> > -; CHECK-P9BE-NEXT: Cost Model: Found an estimated cost of 4 for
> instruction: %i1 = extractelement <4 x i32> %p1, i32 0
> > -; CHECK-P9BE-NEXT: Cost Model: Found an estimated cost of 4 for
> instruction: %i2 = extractelement <4 x i32> %p1, i32 1
> > -; CHECK-P9BE-NEXT: Cost Model: Found an estimated cost of 4 for
> instruction: %i3 = extractelement <4 x i32> %p1, i32 2
> > -; CHECK-P9BE-NEXT: Cost Model: Found an estimated cost of 4 for
> instruction: %i4 = extractelement <4 x i32> %p1, i32 3
> > +; CHECK-P9BE-NEXT: Cost Model: Found an estimated cost of 2 for
> instruction: %i1 = extractelement <4 x i32> %p1, i32 0
> > +; CHECK-P9BE-NEXT: Cost Model: Found an estimated cost of 1 for
> instruction: %i2 = extractelement <4 x i32> %p1, i32 1
> > +; CHECK-P9BE-NEXT: Cost Model: Found an estimated cost of 2 for
> instruction: %i3 = extractelement <4 x i32> %p1, i32 2
> > +; CHECK-P9BE-NEXT: Cost Model: Found an estimated cost of 2 for
> instruction: %i4 = extractelement <4 x i32> %p1, i32 3
> > ; CHECK-P9BE-NEXT: Cost Model: Found an estimated cost of 0 for
> instruction: ret void
> > ;
> > ; CHECK-P9LE-LABEL: 'vexti32'
> > -; CHECK-P9LE-NEXT: Cost Model: Found an estimated cost of 4 for
> instruction: %i1 = extractelement <4 x i32> %p1, i32 0
> > -; CHECK-P9LE-NEXT: Cost Model: Found an estimated cost of 4 for
> instruction: %i2 = extractelement <4 x i32> %p1, i32 1
> > -; CHECK-P9LE-NEXT: Cost Model: Found an estimated cost of 4 for
> instruction: %i3 = extractelement <4 x i32> %p1, i32 2
> > -; CHECK-P9LE-NEXT: Cost Model: Found an estimated cost of 4 for
> instruction: %i4 = extractelement <4 x i32> %p1, i32 3
> > +; CHECK-P9LE-NEXT: Cost Model: Found an estimated cost of 2 for
> instruction: %i1 = extractelement <4 x i32> %p1, i32 0
> > +; CHECK-P9LE-NEXT: Cost Model: Found an estimated cost of 2 for
> instruction: %i2 = extractelement <4 x i32> %p1, i32 1
> > +; CHECK-P9LE-NEXT: Cost Model: Found an estimated cost of 1 for
> instruction: %i3 = extractelement <4 x i32> %p1, i32 2
> > +; CHECK-P9LE-NEXT: Cost Model: Found an estimated cost of 2 for
> instruction: %i4 = extractelement <4 x i32> %p1, i32 3
> > ; CHECK-P9LE-NEXT: Cost Model: Found an estimated cost of 0 for
> instruction: ret void
> > ;
> > %i1 = extractelement <4 x i32> %p1, i32 0
> > @@ -146,13 +146,13 @@ define void @vexti64(<2 x i64> %p1) {
> > ; CHECK-P8LE-NEXT: Cost Model: Found an estimated cost of 0 for
> instruction: ret void
> > ;
> > ; CHECK-P9BE-LABEL: 'vexti64'
> > -; CHECK-P9BE-NEXT: Cost Model: Found an estimated cost of 4 for
> instruction: %i1 = extractelement <2 x i64> %p1, i32 0
> > -; CHECK-P9BE-NEXT: Cost Model: Found an estimated cost of 4 for
> instruction: %i2 = extractelement <2 x i64> %p1, i32 1
> > +; CHECK-P9BE-NEXT: Cost Model: Found an estimated cost of 1 for
> instruction: %i1 = extractelement <2 x i64> %p1, i32 0
> > +; CHECK-P9BE-NEXT: Cost Model: Found an estimated cost of 2 for
> instruction: %i2 = extractelement <2 x i64> %p1, i32 1
> > ; CHECK-P9BE-NEXT: Cost Model: Found an estimated cost of 0 for
> instruction: ret void
> > ;
> > ; CHECK-P9LE-LABEL: 'vexti64'
> > -; CHECK-P9LE-NEXT: Cost Model: Found an estimated cost of 4 for
> instruction: %i1 = extractelement <2 x i64> %p1, i32 0
> > -; CHECK-P9LE-NEXT: Cost Model: Found an estimated cost of 4 for
> instruction: %i2 = extractelement <2 x i64> %p1, i32 1
> > +; CHECK-P9LE-NEXT: Cost Model: Found an estimated cost of 2 for
> instruction: %i1 = extractelement <2 x i64> %p1, i32 0
> > +; CHECK-P9LE-NEXT: Cost Model: Found an estimated cost of 1 for
> instruction: %i2 = extractelement <2 x i64> %p1, i32 1
> > ; CHECK-P9LE-NEXT: Cost Model: Found an estimated cost of 0 for
> instruction: ret void
> > ;
> > %i1 = extractelement <2 x i64> %p1, i32 0
> > @@ -172,13 +172,13 @@ define void @vext(<8 x i16> %p1, <16 x i
> > ; CHECK-P8LE-NEXT: Cost Model: Found an estimated cost of 0 for
> instruction: ret void
> > ;
> > ; CHECK-P9BE-LABEL: 'vext'
> > -; CHECK-P9BE-NEXT: Cost Model: Found an estimated cost of 4 for
> instruction: %i1 = extractelement <8 x i16> %p1, i32 0
> > -; CHECK-P9BE-NEXT: Cost Model: Found an estimated cost of 4 for
> instruction: %i2 = extractelement <16 x i8> %p2, i32 0
> > +; CHECK-P9BE-NEXT: Cost Model: Found an estimated cost of 2 for
> instruction: %i1 = extractelement <8 x i16> %p1, i32 0
> > +; CHECK-P9BE-NEXT: Cost Model: Found an estimated cost of 2 for
> instruction: %i2 = extractelement <16 x i8> %p2, i32 0
> > ; CHECK-P9BE-NEXT: Cost Model: Found an estimated cost of 0 for
> instruction: ret void
> > ;
> > ; CHECK-P9LE-LABEL: 'vext'
> > -; CHECK-P9LE-NEXT: Cost Model: Found an estimated cost of 4 for
> instruction: %i1 = extractelement <8 x i16> %p1, i32 0
> > -; CHECK-P9LE-NEXT: Cost Model: Found an estimated cost of 4 for
> instruction: %i2 = extractelement <16 x i8> %p2, i32 0
> > +; CHECK-P9LE-NEXT: Cost Model: Found an estimated cost of 2 for
> instruction: %i1 = extractelement <8 x i16> %p1, i32 0
> > +; CHECK-P9LE-NEXT: Cost Model: Found an estimated cost of 2 for
> instruction: %i2 = extractelement <16 x i8> %p2, i32 0
> > ; CHECK-P9LE-NEXT: Cost Model: Found an estimated cost of 0 for
> instruction: ret void
> > ;
> > %i1 = extractelement <8 x i16> %p1, i32 0
> >
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at lists.llvm.org
> > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190701/0b0d51cb/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4849 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190701/0b0d51cb/attachment.bin>
More information about the llvm-commits
mailing list