From: rick.c.hodgin@nospicedham.gmail.com   
      
   On Monday, June 26, 2017 at 8:23:30 PM UTC-4, Rod Pemberton wrote:   
   > On Mon, 26 Jun 2017 01:45:25 -0700 (PDT)   
   > "Rick C. Hodgin" wrote:   
   >   
   > > Oh my ... AT&T syntax.   
   >   
   > With -O2, 32-bit GCC (DJGPP for DOS) generates:   
   >   
   > .globl _rp_stricmp   
   > _rp_stricmp:   
   > push ebp   
   > mov ecx, 1   
   > mov ebp, esp   
   > push esi   
   > push ebx   
   > mov edx, DWORD PTR [ebp+12]   
   > mov ebx, DWORD PTR [ebp+8]   
   > L10:   
   > test ecx, ecx   
   > je L3   
   > movsx ecx, BYTE PTR [ebx]   
   > movsx esi, BYTE PTR [edx]   
   > inc ebx   
   > inc edx   
   > cmp ecx, esi   
   > je L10   
   > mov al, BYTE PTR _lower[esi]   
   > cmp BYTE PTR _lower[ecx], al   
   > je L10   
   > L3:   
   > sub ecx, esi   
   > pop ebx   
   > mov eax, ecx   
   > pop esi   
   > pop ebp   
   > ret   
      
   That is nice code. Some savings could be made by removing the need   
   for saving the registers, and by using global variables or registers   
   for the passed parameters, which would also free up ebp as well (not   
   really useful here, but in other cases).   
      
   > With -O2, 64-bit GCC (for Linux) generates:   
   >   
   > .globl rp_stricmp   
   > .type rp_stricmp, @function   
   > rp_stricmp:   
   > .LFB15:   
   > .cfi_startproc   
   > push rbx   
   > .cfi_def_cfa_offset 16   
   > .cfi_offset 3, -16   
   > .L2:   
   > movsx eax, BYTE PTR [rdi]   
   > movsx edx, BYTE PTR [rsi]   
   > add rdi, 1   
   > add rsi, 1   
   > cmp eax, edx   
   > je .L4   
   > movsx rcx, edx   
   > movsx r8, eax   
   > movzx ebx, BYTE PTR lower[rcx]   
   > cmp BYTE PTR lower[r8], bl   
   > je .L4   
   > .L3:   
   > sub eax, edx   
   > pop rbx   
   > .cfi_remember_state   
   > .cfi_def_cfa_offset 8   
   > ret   
   > .p2align 4,,10   
   > .p2align 3   
   > .L4:   
   > .cfi_restore_state   
   > test eax, eax   
   > jne .L2   
   > .p2align 4,,7   
   > jmp .L3   
   > .cfi_endproc   
      
   I am unfamiliar with the .cfi_ forms. What are they?   
      
   Thank you,   
   Rick C. Hodgin   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|