Re: Fixing failure in popcnt test case for llvm-gcc

2012-08-29 Thread Simon Marlow
On 24/10/2011 15:26, David Peixotto wrote: On Oct 22, 2011, at 5:43 PM, Johan Tibell wrote: On Sat, Oct 22, 2011 at 6:40 AM, David Peixotto d...@rice.edu mailto:d...@rice.edu wrote: Ok, so to do it the quick way would be to change the translation of the PopCnt primop in

Re: Fixing failure in popcnt test case for llvm-gcc

2011-10-24 Thread David Peixotto
On Oct 22, 2011, at 5:43 PM, Johan Tibell wrote: On Sat, Oct 22, 2011 at 6:40 AM, David Peixotto d...@rice.edu wrote: Ok, so to do it the quick way would be to change the translation of the PopCnt primop in compiler/codeGen/CgPrimOp.hs? The change would be to first narrow the argument by

Re: Fixing failure in popcnt test case for llvm-gcc

2011-10-22 Thread David Peixotto
Ok, so to do it the quick way would be to change the translation of the PopCnt primop in compiler/codeGen/CgPrimOp.hs? The change would be to first narrow the argument by generating code for the narrow primop before the code for the PopCnt primop. I actually first tried the route that David

Fixing failure in popcnt test case for llvm-gcc

2011-10-21 Thread David Peixotto
After adding support for building GHC with llvm-gcc I had one new test failure in validate. The failing test is cg071 which tests the popCnt primitive function. The test is failing because a call to hs_popcnt8 is segfaulting. The problem seems to be that the words passed to hs_popcnt8 are not

Re: Fixing failure in popcnt test case for llvm-gcc

2011-10-21 Thread Johan Tibell
Hi, On Fri, Oct 21, 2011 at 1:34 PM, David Peixotto d...@rice.edu wrote: I believe that we should be narrowing the argument before calling the function (and in fact both gcc and llvm-gcc will narrow it before a call to hs_popcnt8). My question is what is the right way to do that in the code

Re: Fixing failure in popcnt test case for llvm-gcc

2011-10-21 Thread David Terei
I think it depends on how much work you want to do. Correct way is probably to do as Johan suggests and have proper types for Word8# and co. It would be really nice to do this as the lower levels of GHC have very little type safety which makes me sad. Easiest is to call of the narrow primops. An