Skip to content
  1. Dec 23, 2010
    • Jim Grosbach's avatar
      Trailing whitespace. · 8c48503b
      Jim Grosbach authored
      llvm-svn: 122456
      8c48503b
    • Benjamin Kramer's avatar
      DAGCombine add (sext i1), X into sub X, (zext i1) if sext from i1 is illegal. ... · 1f4dfbbc
      Benjamin Kramer authored
      DAGCombine add (sext i1), X into sub X, (zext i1) if sext from i1 is illegal.  The latter usually compiles into smaller code.
      
      example code:
      unsigned foo(unsigned x, unsigned y) {
        if (x != 0) y--;
        return y;
      }
      
      before:
        _foo:                           ## @foo
          cmpl  $1, 4(%esp)             ## encoding: [0x83,0x7c,0x24,0x04,0x01]
          sbbl  %eax, %eax              ## encoding: [0x19,0xc0]
          notl  %eax                    ## encoding: [0xf7,0xd0]
          addl  8(%esp), %eax           ## encoding: [0x03,0x44,0x24,0x08]
          ret                           ## encoding: [0xc3]
      
      after:
        _foo:                           ## @foo
          cmpl  $1, 4(%esp)             ## encoding: [0x83,0x7c,0x24,0x04,0x01]
          movl  8(%esp), %eax           ## encoding: [0x8b,0x44,0x24,0x08]
          adcl  $-1, %eax               ## encoding: [0x83,0xd0,0xff]
          ret                           ## encoding: [0xc3]
      
      llvm-svn: 122455
      1f4dfbbc
    • Benjamin Kramer's avatar
    • 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
  2. Dec 22, 2010
  3. Dec 21, 2010
Loading