[llvm-bugs] [Bug 42983] New: Inefficient 64-bit absolute addresses in Cygwin

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Aug 13 04:45:09 PDT 2019


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

            Bug ID: 42983
           Summary: Inefficient 64-bit absolute addresses in Cygwin
           Product: clang
           Version: 5.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: agner at agner.org
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

Cygwin Clang v. 5.0.1 is using 64-bit absolute addresses when accessing static
data in 64-bit mode. This is inefficient because it requires an extra 10-bytes
long instruction for loading an address into a register every time it needs to
access static data.

Linux Clang v. 6.0.0 with --target=x86_64-win64-windows gives the more
efficient relative addresses, as do all other compilers.

Is this a Cygwin-only issue? I posted it to the cygwin mailing list, but they
advised me to go here.

Test case:

#include <immintrin.h>

__m128d test (__m128d a) {
    __m128d b = _mm_add_pd(a, _mm_set1_pd(1.5));
    __m128d c = _mm_mul_pd(b, _mm_set1_pd(2.5));
    return c;
} 

Cygwin Clang assembly output:

_Z4testDv2_d:
    vmovapd    (%rcx), %xmm0
    movabsq    $.LCPI0_0, %rax
    vaddpd    (%rax), %xmm0, %xmm0
    movabsq    $.LCPI0_1, %rax
    vmulpd    (%rax), %xmm0, %xmm0
    retq 

Linux Clang assembly output with windows target:

"?test@@YAU__m128d@@U1@@Z":             # @"\01?test@@YAU__m128d@@U1@@Z"
# %bb.0:
        vmovapd (%rcx), %xmm0
        vaddpd  __xmm at 3ff80000000000003ff8000000000000(%rip), %xmm0, %xmm0
        vmulpd  __xmm at 40040000000000004004000000000000(%rip), %xmm0, %xmm0
        retq

-- 
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/20190813/c354e90a/attachment.html>


More information about the llvm-bugs mailing list