diff options
author | Ben Gamari <ben@smart-cactus.org> | 2019-09-25 16:58:20 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2019-09-25 16:58:20 -0400 |
commit | 9d83a26b8eef6c1e075b89804947b15b1851c30a (patch) | |
tree | e2e511d628e5389747e4c98f0cc4ac4196fbfa99 | |
parent | c8f2cbe93590f0ee7ad3ec2b1b29f4b5d71c9440 (diff) | |
download | haskell-wip/T17247b.tar.gz |
nativeGen: Try fixing popcnt on i386wip/T17247b
Just fall back to C case in the 64-bit case. Another approach would be
to sum the population counts of the top and bottom 32-bits but this is
more complexity than this case warrants.
Fixes #17247.
-rw-r--r-- | compiler/nativeGen/X86/CodeGen.hs | 4 | ||||
-rw-r--r-- | testsuite/tests/codeGen/should_run/all.T | 3 |
2 files changed, 4 insertions, 3 deletions
diff --git a/compiler/nativeGen/X86/CodeGen.hs b/compiler/nativeGen/X86/CodeGen.hs index 9f0af9429d..8bbc9f5dfc 100644 --- a/compiler/nativeGen/X86/CodeGen.hs +++ b/compiler/nativeGen/X86/CodeGen.hs @@ -1940,7 +1940,9 @@ genCCall dflags is32Bit (PrimTarget (MO_PopCnt width)) dest_regs@[dst] args@[src] bid = do sse4_2 <- sse4_2Enabled let platform = targetPlatform dflags - if sse4_2 + -- N.B. 64-bit population count is not supported on 32-bit platforms, even + -- with SSE4.2. Fall back to C implementation in this case + if sse4_2 && not (is32Bit && width == W64) then do code_src <- getAnyReg src src_r <- getNewRegNat format let dst_r = getRegisterReg platform (CmmLocal dst) diff --git a/testsuite/tests/codeGen/should_run/all.T b/testsuite/tests/codeGen/should_run/all.T index 7e5ed24a7d..2a777f4c9d 100644 --- a/testsuite/tests/codeGen/should_run/all.T +++ b/testsuite/tests/codeGen/should_run/all.T @@ -79,8 +79,7 @@ test('cgrun069', ['cgrun069', [('cgrun069_cmm.cmm', '')], '']) test('cgrun070', normal, compile_and_run, ['']) test('cgrun071', - [when(have_cpu_feature('sse4_2'), extra_hc_opts('-msse4.2')), - when(arch('i386'), expect_broken(17247))], + [when(have_cpu_feature('sse4_2'), extra_hc_opts('-msse4.2'))], compile_and_run, ['']) test('cgrun072', normal, compile_and_run, ['']) test('cgrun075', normal, compile_and_run, ['']) |