X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:from:subject:message-id:date:mime-version :content-type:content-transfer-encoding; q=dns; s=default; b=GVr yI8dVvpmoBfyKfR4+T1+z8Dp1zNWLLwdNLs+88tettfGf6sBZZUp4IA+rBSNY9Rz SJ+7DL24OMgP9mGsPgS3jclTtydp6GInrjeymp2A1SK6kf8zbvxOlHwMcC+MFjfk kTS/bkhjsekEKZAaMLHhCd+ywkqNWscErzq7Pw6s= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:from:subject:message-id:date:mime-version :content-type:content-transfer-encoding; s=default; bh=o7gMlNBFO K+oYTTPxrkYNnpUwv0=; b=s1XfYqhznZYOUU0L3pvP3icGHNVn1Ls2DcCvKVspB P1XpCLMPhmTmIOYQOpmkr210BoerPM3Pc/n19+UEHI2g8XYqV7jJ0Lg9JJCyy910 AfVnikiV/Ft3XAiu1CttVYT7OzotVvhwcjz0YMRjIcHZi23Gi6HjHXO3w8su0ojJ OI= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-0.5 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,RCVD_IN_SEMBLACK,SPF_FAIL,SPF_HELO_PASS autolearn=no version=3.3.1 spammy=__m128d, HContent-Transfer-Encoding:8bit X-HELO: gateway30.websitewelcome.com To: "cygwin AT cygwin DOT com" From: Agner Fog Subject: Inefficient use of 64-bit addresses in Clang Message-ID: <578eb489-9391-9009-82ad-676eeb4c1c92@agner.org> Date: Tue, 6 Aug 2019 14:30:36 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-IsSubscribed: yes Note-from-DJ: This may be spam Clang 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. All other compilers use relative addresses. Example: > #include > > __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; > } Assembly output: > .LCPI0_0: >     .quad    4609434218613702656     # double 1.5 >     .quad    4609434218613702656     # double 1.5 > .LCPI0_1: >     .quad    4612811918334230528     # double 2.5 >     .quad    4612811918334230528     # double 2.5 >     .text >     .globl    _Z4testDv2_d >     .p2align    4, 0x90 > _Z4testDv2_d:                           # @_Z4testDv2_d > # BB#0: >     vmovapd    (%rcx), %xmm0 >     movabsq    $.LCPI0_0, %rax >     vaddpd    (%rax), %xmm0, %xmm0 >     movabsq    $.LCPI0_1, %rax >     vmulpd    (%rax), %xmm0, %xmm0 >     retq Linux Clang uses 32-bit relative addresses: >     vaddpd    .LCPI0_0(%rip), %xmm0, %xmm0 >     vmulpd    .LCPI0_1(%rip), %xmm0, %xmm0 >     retq -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple