Skip to content
  • Benjamin Kramer's avatar
    X86: Lower a select directly to a setcc_carry if possible. · 6020ed9d
    Benjamin Kramer authored
      int test(unsigned long a, unsigned long b) { return -(a < b); }
    compiles to
      _test:                              ## @test
        cmpq  %rsi, %rdi                  ## encoding: [0x48,0x39,0xf7]
        sbbl  %eax, %eax                  ## encoding: [0x19,0xc0]
        ret                               ## encoding: [0xc3]
    instead of
      _test:                              ## @test
        xorl  %ecx, %ecx                  ## encoding: [0x31,0xc9]
        cmpq  %rsi, %rdi                  ## encoding: [0x48,0x39,0xf7]
        movl  $-1, %eax                   ## encoding: [0xb8,0xff,0xff,0xff,0xff]
        cmovael %ecx, %eax                ## encoding: [0x0f,0x43,0xc1]
        ret                               ## encoding: [0xc3]
    
    llvm-svn: 122451
    6020ed9d
Loading