• pierre.langlois's avatar
    [arm] Optimize vcmp when lhs operand is #0.0 · d1472d65
    pierre.langlois authored
    This patch checks the type of the lhs operand of a floating point
    comparison for ARM, and commutes the operands if it is #0.0.  It allows
    us to optimize a comparison with zero, as the vcmp instruction
    accepts #0.0 as rhs operand.
    
    Code before for "0.0 < 0.123":
    ------------------------------
    movw ip, #29360
    movt ip, #37224
    movw r9, #31981
    movt r9, #16319
    vmov d0, ip, r9
    mov ip, #0
    vmov d1, ip, ip
    vcmp.f64 d1, d0
    vmrs APSR, FPSCR
    bcc +12
    
    Code after:
    -----------
    movw ip, #29360
    movt ip, #37224
    movw r9, #31981
    movt r9, #16319
    vmov d0, ip, r9
    vcmp.f64 d0, #0.0
    vmrs APSR, FPSCR
    bgt +12
    
    BUG=
    
    Review URL: https://codereview.chromium.org/1361913003
    
    Cr-Commit-Position: refs/heads/master@{#30911}
    d1472d65
instruction-selector-arm-unittest.cc 101 KB