x86 nativeGen: Fix test with mask in range [128,255] (#13425)

Authored by rwbarton on Mar 17 2017, 3:11 PM.



My commit bdb0c43c7 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


Diff Detail

rGHC Glasgow Haskell Compiler
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
rwbarton created this revision.Mar 17 2017, 3:11 PM
dfeuer accepted this revision.Mar 17 2017, 4:39 PM
This revision is now accepted and ready to land.Mar 17 2017, 4:39 PM
trofi accepted this revision.Mar 17 2017, 5:03 PM

Nice catch!

This revision was automatically updated to reflect the committed changes.