x86 nativeGen: Fix test with mask in range [128,255] (#13425)
authorReid Barton <rwbarton@gmail.com>
Fri, 24 Mar 2017 01:02:29 +0000 (21:02 -0400)
committerBen Gamari <ben@smart-cactus.org>
Fri, 24 Mar 2017 14:14:26 +0000 (10:14 -0400)
commitcaf94b062a0e37ffa7048e51447fc9486b658917
treed14fdcbcbdf3844ae80dbe423396d825974bbe4e
parent8429a202ec8aef0af226d3fb5907b47dc9cba155
x86 nativeGen: Fix test with mask in range [128,255] (#13425)

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: harbormaster

Reviewers: trofi, austin, bgamari, dfeuer

Reviewed By: trofi, dfeuer

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D3359
compiler/nativeGen/X86/Ppr.hs
testsuite/tests/codeGen/should_run/T13425.hs [new file with mode: 0644]
testsuite/tests/codeGen/should_run/T13425.stdout [new file with mode: 0644]
testsuite/tests/codeGen/should_run/all.T