<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Missing xxswapd before a stxvd2x"
   href="https://llvm.org/bugs/show_bug.cgi?id=28130">28130</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Missing xxswapd before a stxvd2x
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Backend: PowerPC
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>timshen91@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=16542" name="attach_16542" title="reduced test">attachment 16542</a> <a href="attachment.cgi?id=16542&action=edit" title="reduced test">[details]</a></span>
reduced test

The problem is in generated assembly, for the only stxvd2x, there isn't a
preceding xxswapd instruction to recover the "endianness" for a VSX register.
Suppose the attached file is a.ll:

~ % llc --version
LLVM (<a href="http://llvm.org/">http://llvm.org/</a>):
  LLVM version 3.9.0svn
  Optimized build with assertions.
  Default target: x86_64-unknown-linux-gnu
  Host CPU: haswell

~ % llc -O0 < a.ll
    .text
    .abiversion 2
    .file    "<stdin>"
    .section    .rodata.cst4,"aM",@progbits,4
    .p2align    2
.LCPI0_0:
    .long    1178406912              # float 12100
.LCPI0_1:
    .long    1120403456              # float 100
.LCPI0_5:
    .long    1180762112              # float 14400
    .section    .rodata.cst16,"aM",@progbits,16
    .p2align    4
.LCPI0_2:
    .quad    4667272928281231360     # double 11000
    .quad    4637440978796412928     # double 110
.LCPI0_3:
    .quad    4607182418800017408     # double 1
    .quad    4666723172467343360     # double 1.0E+4
.LCPI0_4:
    .quad    4667822684095119360     # double 12000
    .quad    4638144666238189568     # double 120
    .text
    .globl    Test
    .p2align    4
    .type    Test,@function
Test:                                   # @Test
.Lfunc_begin0:
.Lfunc_gep0:
    addis 2, 12, .TOC.-.Lfunc_gep0@ha
    addi 2, 2, .TOC.-.Lfunc_gep0@l
.Lfunc_lep0:
    .localentry    Test, .Lfunc_lep0-.Lfunc_gep0
# BB#0:                                 # %bb
    lxsdx 0, 0, 3
    li 4, 40
    lxsdx 1, 3, 4
    li 4, 32
    lxsdx 2, 3, 4
    addis 5, 2, .LCPI0_0@toc@ha
    addi 5, 5, .LCPI0_0@toc@l
    lxsspx 3, 0, 5
    xssubdp 3, 3, 2
    xsmuldp 3, 0, 3
    xsadddp 2, 2, 3
    li 5, 48
    lxsdx 3, 3, 5
    addis 6, 2, .LCPI0_1@toc@ha
    addi 6, 6, .LCPI0_1@toc@l
    lxsspx 4, 0, 6
    xssubdp 5, 4, 3
    xsmuldp 5, 0, 5
    xsadddp 3, 3, 5
    li 6, 56
    lxsdx 5, 3, 6
    fmr 6, 1
    xxspltd     6, 6, 0
    fmr 7, 5
    xxspltd     7, 7, 0
    xxmrgld     6, 7, 6
    addis 7, 2, .LCPI0_2@toc@ha
    addi 7, 7, .LCPI0_2@toc@l
    lxvd2x 7, 0, 7
    xxswapd     7, 7
    xvsubdp 7, 7, 6
    fmr 8, 0
    xxspltd     8, 8, 0
    xxspltd     8, 8, 1
    xvmuldp 7, 8, 7
    xvadddp 6, 6, 7
    li 7, 16
    lxvd2x 7, 3, 7
    xxswapd     7, 7
    addis 8, 2, .LCPI0_3@toc@ha
    addi 8, 8, .LCPI0_3@toc@l
    lxvd2x 9, 0, 8
    xxswapd     9, 9
    xvsubdp 10, 9, 7
    xvmuldp 10, 8, 10
    xvadddp 7, 7, 10
    xvsubdp 9, 9, 7
    xvmuldp 9, 8, 9
    xvadddp 7, 7, 9
    addis 8, 2, .LCPI0_4@toc@ha
    addi 8, 8, .LCPI0_4@toc@l
    lxvd2x 9, 0, 8
    xxswapd     9, 9
    xvsubdp 9, 9, 6
    xvmuldp 8, 8, 9
    xvadddp 6, 6, 8
    addis 8, 2, .LCPI0_5@toc@ha
    addi 8, 8, .LCPI0_5@toc@l
    lxsspx 1, 0, 8
    xssubdp 1, 1, 2
    xsmuldp 1, 0, 1
    xsadddp 1, 2, 1
    stxsdx 1, 3, 4
    xssubdp 1, 4, 3
    xsmuldp 0, 0, 1
    xsadddp 0, 3, 0
    stxsdx 0, 3, 5
    fmr 0, 6
    stxsdx 0, 3, 6   
                         # <== expect `xxswapd 7, 7` here
    stxvd2x 7, 3, 7  # <== vsr[7] should be "endianness" swapped.
    blr
    .long    0
    .quad    0
.Lfunc_end0:
    .size    Test, .Lfunc_end0-.Lfunc_begin0


    .section    ".note.GNU-stack","",@progbits

Investigation progress:
Disabling the call to DAGCombiner::findBetterNeighborChains() makes the problem
go away. I'm not sure if it's DAGCombiner::findBetterNeighborChains's fault and
I'm still looking.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>