On Wednesday, 23 October 2019 at 13:08:34 UTC, Per Nordlöw wrote:
The ASM- and IR-output from the following code is pretty messy for

You call this messy?!

cmpq    %rdi, %rdx
        jae     .LBB0_2
        xorl    %eax, %eax
        retq
.LBB0_2:
        movq    %rdi, %rax
        testq   %rdi, %rdi
        je      .LBB0_3
        pushq   %rax
        .cfi_def_cfa_offset 16
        movq    %rcx, %rdi
        movq    %rax, %rdx
        callq   memcmp@PLT
        testl   %eax, %eax
        sete    %al
        addq    $8, %rsp
        .cfi_def_cfa_offset 8
        retq
.LBB0_3:
        movb    $1, %al
        retq

Anyway, clearly no bounds checks, LLVM's optimizer works as it should.

Reply via email to