llvm.org GIT mirror llvm / 41ede3a
Merging r372606: ------------------------------------------------------------------------ r372606 | spatel | 2019-09-23 06:30:23 -0700 (Mon, 23 Sep 2019) | 3 lines [x86] fix assert with horizontal math + broadcast of vector (PR43402) https://bugs.llvm.org/show_bug.cgi?id=43402 ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_90@374633 91177308-0d34-0410-b5e6-96231b3b80d8 Tom Stellard 1 year, 1 month ago
3 changed file(s) with 26 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
3365033650
3365133651 // When the operands of a horizontal math op are identical, the low half of
3365233652 // the result is the same as the high half. If a target shuffle is also
33653 // replicating low and high halves, we don't need the shuffle.
33653 // replicating low and high halves (and without changing the type/length of
33654 // the vector), we don't need the shuffle.
3365433655 if (Opcode == X86ISD::MOVDDUP || Opcode == X86ISD::VBROADCAST) {
33655 if (HOp.getScalarValueSizeInBits() == 64) {
33656 if (HOp.getScalarValueSizeInBits() == 64 && HOp.getValueType() == VT) {
3365633657 // movddup (hadd X, X) --> hadd X, X
3365733658 // broadcast (extract_vec_elt (hadd X, X), 0) --> hadd X, X
3365833659 assert((HOp.getValueType() == MVT::v2f64 ||
33659 HOp.getValueType() == MVT::v4f64) && HOp.getValueType() == VT &&
33660 "Unexpected type for h-op");
33660 HOp.getValueType() == MVT::v4f64) && "Unexpected type for h-op");
3366133661 return updateHOp(HOp, DAG);
3366233662 }
3366333663 return SDValue();
421421 // Tests Types Of a FP Values for scalar types.
422422 VFPCLASSS,
423423
424 // Broadcast scalar to vector.
424 // Broadcast (splat) scalar or element 0 of a vector. If the operand is
425 // a vector, this node may change the vector length as part of the splat.
425426 VBROADCAST,
426427 // Broadcast mask to vector.
427428 VBROADCASTM,
0 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
1 ; RUN: llc < %s -mtriple=i686-- -mattr=avx2 | FileCheck %s
2
3 ; The broadcast node takes a vector operand as input and changes its length.
4
5 define <4 x double> @PR43402(i64 %x) {
6 ; CHECK-LABEL: PR43402:
7 ; CHECK: # %bb.0:
8 ; CHECK-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
9 ; CHECK-NEXT: vunpcklps {{.*#+}} xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
10 ; CHECK-NEXT: vsubpd {{\.LCPI.*}}, %xmm0, %xmm0
11 ; CHECK-NEXT: vhaddpd %xmm0, %xmm0, %xmm0
12 ; CHECK-NEXT: vbroadcastsd %xmm0, %ymm0
13 ; CHECK-NEXT: retl
14 %conv = uitofp i64 %x to double
15 %t2 = insertelement <4 x double> undef, double %conv, i32 0
16 %t3 = shufflevector <4 x double> %t2, <4 x double> undef, <4 x i32> zeroinitializer
17 ret <4 x double> %t3
18 }
19