[Issue 6829] Unsigned rotate standard function in Phobos

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jul 12 08:13:18 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=6829



--- Comment #25 from hsteoh at quickfur.ath.cx 2013-07-12 08:13:16 PDT ---
Nope, it's still not working. I copied-n-pasted exactly the code posted above,
and compiled with gdc -frelease -O3 test.d, and here is the disassembly output:

00000000004042d0 <_D4test10__T3rolThZ3rolFNaNbNfxhxkZh>:
  4042d0:    40 0f b6 ff              movzbl %dil,%edi
  4042d4:    b9 08 00 00 00           mov    $0x8,%ecx
  4042d9:    29 f1                    sub    %esi,%ecx
  4042db:    89 f8                    mov    %edi,%eax
  4042dd:    d3 f8                    sar    %cl,%eax
  4042df:    89 f1                    mov    %esi,%ecx
  4042e1:    d3 e7                    shl    %cl,%edi
  4042e3:    09 f8                    or     %edi,%eax
  4042e5:    c3                       retq   
  4042e6:    66 2e 0f 1f 84 00 00     nopw   %cs:0x0(%rax,%rax,1)
  4042ed:    00 00 00 

00000000004042f0 <_D4test10__T3rorThZ3rorFNaNbNfxhxkZh>:
  4042f0:    40 0f b6 ff              movzbl %dil,%edi
  4042f4:    b9 08 00 00 00           mov    $0x8,%ecx
  4042f9:    29 f1                    sub    %esi,%ecx
  4042fb:    89 f8                    mov    %edi,%eax
  4042fd:    d3 e0                    shl    %cl,%eax
  4042ff:    89 f1                    mov    %esi,%ecx
  404301:    d3 ff                    sar    %cl,%edi
  404303:    09 f8                    or     %edi,%eax
  404305:    c3                       retq   
  404306:    66 2e 0f 1f 84 00 00     nopw   %cs:0x0(%rax,%rax,1)
  40430d:    00 00 00 

0000000000404310 <_D4test10__T3rolTtZ3rolFNaNbNfxtxkZt>:
  404310:    0f b7 ff                 movzwl %di,%edi
  404313:    b9 10 00 00 00           mov    $0x10,%ecx
  404318:    29 f1                    sub    %esi,%ecx
  40431a:    89 f8                    mov    %edi,%eax
  40431c:    d3 f8                    sar    %cl,%eax
  40431e:    89 f1                    mov    %esi,%ecx
  404320:    d3 e7                    shl    %cl,%edi
  404322:    09 f8                    or     %edi,%eax
  404324:    c3                       retq   
  404325:    66 2e 0f 1f 84 00 00     nopw   %cs:0x0(%rax,%rax,1)
  40432c:    00 00 00 
  40432f:    90                       nop

0000000000404330 <_D4test10__T3rorTtZ3rorFNaNbNfxtxkZt>:
  404330:    0f b7 ff                 movzwl %di,%edi
  404333:    b9 10 00 00 00           mov    $0x10,%ecx
  404338:    29 f1                    sub    %esi,%ecx
  40433a:    89 f8                    mov    %edi,%eax
  40433c:    d3 e0                    shl    %cl,%eax
  40433e:    89 f1                    mov    %esi,%ecx
  404340:    d3 ff                    sar    %cl,%edi
  404342:    09 f8                    or     %edi,%eax
  404344:    c3                       retq   
  404345:    66 2e 0f 1f 84 00 00     nopw   %cs:0x0(%rax,%rax,1)
  40434c:    00 00 00 
  40434f:    90                       nop

0000000000404350 <_D4test10__T3rolTkZ3rolFNaNbNfxkxkZk>:
  404350:    b9 20 00 00 00           mov    $0x20,%ecx
  404355:    89 f8                    mov    %edi,%eax
  404357:    29 f1                    sub    %esi,%ecx
  404359:    d3 e8                    shr    %cl,%eax
  40435b:    89 f1                    mov    %esi,%ecx
  40435d:    d3 e7                    shl    %cl,%edi
  40435f:    09 f8                    or     %edi,%eax
  404361:    c3                       retq   
  404362:    66 2e 0f 1f 84 00 00     nopw   %cs:0x0(%rax,%rax,1)
  404369:    00 00 00 
  40436c:    0f 1f 40 00              nopl   0x0(%rax)

0000000000404370 <_D4test10__T3rorTkZ3rorFNaNbNfxkxkZk>:
  404370:    b9 20 00 00 00           mov    $0x20,%ecx
  404375:    89 f8                    mov    %edi,%eax
  404377:    29 f1                    sub    %esi,%ecx
  404379:    d3 e0                    shl    %cl,%eax
  40437b:    89 f1                    mov    %esi,%ecx
  40437d:    d3 ef                    shr    %cl,%edi
  40437f:    09 f8                    or     %edi,%eax
  404381:    c3                       retq   
  404382:    66 2e 0f 1f 84 00 00     nopw   %cs:0x0(%rax,%rax,1)
  404389:    00 00 00 
  40438c:    0f 1f 40 00              nopl   0x0(%rax)

0000000000404390 <_D4test10__T3rolTmZ3rolFNaNbNfxmxkZm>:
  404390:    b9 40 00 00 00           mov    $0x40,%ecx
  404395:    48 89 f8                 mov    %rdi,%rax
  404398:    29 f1                    sub    %esi,%ecx
  40439a:    48 d3 e8                 shr    %cl,%rax
  40439d:    89 f1                    mov    %esi,%ecx
  40439f:    48 d3 e7                 shl    %cl,%rdi
  4043a2:    48 09 f8                 or     %rdi,%rax
  4043a5:    c3                       retq   
  4043a6:    66 2e 0f 1f 84 00 00     nopw   %cs:0x0(%rax,%rax,1)
  4043ad:    00 00 00 

00000000004043b0 <_D4test10__T3rorTmZ3rorFNaNbNfxmxkZm>:
  4043b0:    b9 40 00 00 00           mov    $0x40,%ecx
  4043b5:    48 89 f8                 mov    %rdi,%rax
  4043b8:    29 f1                    sub    %esi,%ecx
  4043ba:    48 d3 e0                 shl    %cl,%rax
  4043bd:    89 f1                    mov    %esi,%ecx
  4043bf:    48 d3 ef                 shr    %cl,%rdi
  4043c2:    48 09 f8                 or     %rdi,%rax
  4043c5:    c3                       retq   
  4043c6:    66 2e 0f 1f 84 00 00     nopw   %cs:0x0(%rax,%rax,1)
  4043cd:    00 00 00 


It's still using shift + bitwise OR instead of substituting a rotate
instruction. I'm also on Linux x86_64 (so says uname -m), so I've no idea what
I'm doing wrong. And gdc --version says it's gdc (GCC) 4.8.1. Did something go
wrong/missing in my gdc build??

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list