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: unassignedclangb...@nondot.org
          Reporter: ag...@agner.org
                CC: blitzrak...@gmail.com, dgre...@apple.com,
                    erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
                    richard-l...@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@3ff80000000000003ff8000000000000(%rip), %xmm0, %xmm0
        vmulpd  __xmm@40040000000000004004000000000000(%rip), %xmm0, %xmm0
        retq

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to