Skip to content
  • rwbarton's avatar
    x86 nativeGen: Fix test with mask in range [128,255] (#13425) · caf94b06
    rwbarton authored and Ben Gamari's avatar Ben Gamari committed
    My commit bdb0c43c optimized the encoding of instructions to test
    tag bits, but it did not always set exactly the same condition codes
    since the testb instruction does a single-byte comparison, rather
    than a full-word comparison.
    
    It would be correct to optimize the expression `x .&. 128 > 0` to
    the sequence
    
        testb $128, %al
        seta %al         ; note: 'a' for unsigned comparison,
                         ; not 'g' for signed comparison
    
    but the pretty-printer is not the right place to make this kind of
    context-sensitive optimization.
    
    Test Plan: harbormaster
    
    Reviewers: trofi, austin, bgamari, dfeuer
    
    Reviewed By: trofi, dfeuer
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D3359
    caf94b06