[llvm-bugs] [Bug 27573] New: Avoid partial SSE register stall

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Apr 29 08:04:35 PDT 2016


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

            Bug ID: 27573
           Summary: Avoid partial SSE register stall
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: hjl.tools at gmail.com
                CC: david.l.kreitzer at intel.com, llvm-bugs at lists.llvm.org,
                    zia.ansari at intel.com
    Classification: Unclassified

[hjl at gnu-6 pr57954]$ cat x.c
float
foo1 (int x)
{
  return x;
}

double
foo2 (int x)
{
  return x;
}

float
foo3 (long long int x)
{
  return x;
}

double
foo4 (long long int x)
{
  return x;
}
[hjl at gnu-6 pr57954]$  gcc -S -O2 -mtune=haswell x.c    
[hjl at gnu-6 pr57954]$ cat x.s
    .file    "x.c"
    .section    .text.unlikely,"ax", at progbits
.LCOLDB0:
    .text
.LHOTB0:
    .p2align 4,,15
    .globl    foo1
    .type    foo1, @function
foo1:
.LFB0:
    .cfi_startproc
    pxor    %xmm0, %xmm0
    cvtsi2ss    %edi, %xmm0
    ret
    .cfi_endproc
.LFE0:
    .size    foo1, .-foo1
    .section    .text.unlikely
.LCOLDE0:
    .text
.LHOTE0:
    .section    .text.unlikely
.LCOLDB1:
    .text
.LHOTB1:
    .p2align 4,,15
    .globl    foo2
    .type    foo2, @function
foo2:
.LFB1:
    .cfi_startproc
    pxor    %xmm0, %xmm0
    cvtsi2sd    %edi, %xmm0
    ret
    .cfi_endproc
.LFE1:
    .size    foo2, .-foo2
    .section    .text.unlikely
.LCOLDE1:
    .text
.LHOTE1:
    .section    .text.unlikely
.LCOLDB2:
    .text
.LHOTB2:
    .p2align 4,,15
    .globl    foo3
    .type    foo3, @function
foo3:
.LFB2:
    .cfi_startproc
    pxor    %xmm0, %xmm0
    cvtsi2ssq    %rdi, %xmm0
    ret
    .cfi_endproc
.LFE2:
    .size    foo3, .-foo3
    .section    .text.unlikely
.LCOLDE2:
    .text
.LHOTE2:
    .section    .text.unlikely
.LCOLDB3:
    .text
.LHOTB3:
    .p2align 4,,15
    .globl    foo4
    .type    foo4, @function
foo4:
.LFB3:
    .cfi_startproc
    pxor    %xmm0, %xmm0
    cvtsi2sdq    %rdi, %xmm0
    ret
    .cfi_endproc
.LFE3:
    .size    foo4, .-foo4
    .section    .text.unlikely
.LCOLDE3:
    .text
.LHOTE3:
    .ident    "GCC: (GNU) 5.3.1 20160406 (Red Hat 5.3.1-6)"
    .section    .note.GNU-stack,"", at progbits
[hjl at gnu-6 pr57954]$
/export/build/gnu/llvm-clang-x32-bootstrap/stage1/build-x86_64-linux-gnux32/bin/clang
-S -O2  -mtune=haswell x.c
[hjl at gnu-6 pr57954]$ cat x.s
    .text
    .file    "x.c"
    .globl    foo1
    .p2align    4, 0x90
    .type    foo1, at function
foo1:                                   # @foo1
    .cfi_startproc
# BB#0:
    cvtsi2ssl    %edi, %xmm0
    retq
.Lfunc_end0:
    .size    foo1, .Lfunc_end0-foo1
    .cfi_endproc

    .globl    foo2
    .p2align    4, 0x90
    .type    foo2, at function
foo2:                                   # @foo2
    .cfi_startproc
# BB#0:
    cvtsi2sdl    %edi, %xmm0
    retq
.Lfunc_end1:
    .size    foo2, .Lfunc_end1-foo2
    .cfi_endproc

    .globl    foo3
    .p2align    4, 0x90
    .type    foo3, at function
foo3:                                   # @foo3
    .cfi_startproc
# BB#0:
    cvtsi2ssq    %rdi, %xmm0
    retq
.Lfunc_end2:
    .size    foo3, .Lfunc_end2-foo3
    .cfi_endproc

    .globl    foo4
    .p2align    4, 0x90
    .type    foo4, at function
foo4:                                   # @foo4
    .cfi_startproc
# BB#0:
    cvtsi2sdq    %rdi, %xmm0
    retq
.Lfunc_end3:
    .size    foo4, .Lfunc_end3-foo4
    .cfi_endproc


    .ident    "clang version 3.9.0 (http://llvm.org/git/clang.git
3e732e176f38a3cd18520fea2dcda89572736d9d) (http://llvm.org/git/llvm.git
9c55c367aecce3a03ecf8dde49b2d38508ff2640)"
    .section    ".note.GNU-stack","", at progbits
[hjl at gnu-6 pr57954]$ 

Clang should also generate "pxor %xmm0, %xmm0" to avoid partial SSE
register stall.

-- 
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/20160429/e0d97ff2/attachment-0001.html>


More information about the llvm-bugs mailing list