OK, here is the assembler listing...

# nim c -d:release t.nim

# gcc.options.speed = "-save-temps -march=native -O3 -fno-strict-aliasing"
    
    
    $ cat t.nim
    proc t(a, b: string) : bool =
      a == b
    
    proc main =
      var a = "Rust"
      var b = "Nim"
      echo t(a, b)
    
    main()
    
    
    
    Run
    
    
    t_IxGYsz1VoA2HIiGBY5mgGw:
    .LFB20:
            .cfi_startproc
            movl        $1, %eax
            cmpq        %rsi, %rdi
            je  .L32
            testq       %rdi, %rdi
            je  .L35
            movq        (%rdi), %rdx
            testq       %rsi, %rsi
            je  .L36
            xorl        %eax, %eax
            cmpq        (%rsi), %rdx
            je  .L37
    .L32:
            ret
            .p2align 4,,10
            .p2align 3
    .L35:
            testq       %rsi, %rsi
            je  .L32
            cmpq        $0, (%rsi)
            sete        %al
            ret
            .p2align 4,,10
            .p2align 3
    .L37:
            testq       %rdx, %rdx
            je  .L28
            subq        $8, %rsp
            .cfi_def_cfa_offset 16
            addq        $16, %rsi
            addq        $16, %rdi
            call        memcmp@PLT
            testl       %eax, %eax
            sete        %al
            addq        $8, %rsp
            .cfi_def_cfa_offset 8
            ret
            .p2align 4,,10
            .p2align 3
    .L36:
            testq       %rdx, %rdx
            sete        %al
            ret
    .L28:
    .L21:
    .L24:
            movl        $1, %eax
            ret
            .cfi_endproc
    
    
    Run

Reply via email to