[llvm-bugs] [Bug 28130] New: Missing xxswapd before a stxvd2x

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jun 14 11:51:46 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=28130

            Bug ID: 28130
           Summary: Missing xxswapd before a stxvd2x
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: PowerPC
          Assignee: unassignedbugs at nondot.org
          Reporter: timshen91 at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 16542
  --> https://llvm.org/bugs/attachment.cgi?id=16542&action=edit
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 (http://llvm.org/):
  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", at 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", at 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, at function
Test:                                   # @Test
.Lfunc_begin0:
.Lfunc_gep0:
    addis 2, 12, .TOC.-.Lfunc_gep0 at ha
    addi 2, 2, .TOC.-.Lfunc_gep0 at 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 at toc@ha
    addi 5, 5, .LCPI0_0 at 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 at toc@ha
    addi 6, 6, .LCPI0_1 at 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 at toc@ha
    addi 7, 7, .LCPI0_2 at 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 at toc@ha
    addi 8, 8, .LCPI0_3 at 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 at toc@ha
    addi 8, 8, .LCPI0_4 at 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 at toc@ha
    addi 8, 8, .LCPI0_5 at 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","", at 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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160614/cfb247ac/attachment.html>


More information about the llvm-bugs mailing list