Frank Heckenbach wrote:
Waldek Hebisch wrote:
I just noticed that hammer backend can not pass Pascal sets as arguments to functions (procedures). The problem should be easy to solve, but first somebody must decide how sets should be treated on hammer. Currently frontend treats sets as a sequence of longs, that should work, but on hammer SSE2 instructions would double efficiency for moderate and large sets. So the question is if we should just teach backend about our current strategy or should we try something more fancy?
If someone wants to optimize things using these special instructions, that can always be done (though it might be quite some work, since probably all of the routines in rts/sets.pas and the corresponding compiler support will have to be rewritten).
However, as you say, the current mechanism treats them as arrays of unsigned long (in C terms), so it should also work. (There's not so much special about it.) I don't know how it fails, but it might be a more general problem.
My point was that we must make an API decision. Easy one is to stick to current scheme. Hard one is to try to use SSE2. SSE2 requires 128 bit alignment and means that when passing set to functions they should go in SSE register.
I was thinking a bit about it and I am not sure whether using SSE registers is a win here. From my (limited) experience with Pascal programming the sets used are often very small and used for conditionals. SSE is very poor when used to test specific bits, so perhaps integer is better.
--- gcc-3.3.orig/gcc/config/i386/i386.c Thu Apr 3 00:01:58 2003 +++ gcc-3.3/gcc/config/i386/i386.c Thu Jun 12 20:30:48 2003 @@ -1853,6 +1853,18 @@ } } }
else if (TREE_CODE (type) == SET_TYPE)
{
if (mode == DImode)
{
classes[0] = X86_64_INTEGER_CLASS;
return 1;
}
else if (mode == BLKmode)
return 0;
else
abort();
}
What happens for very small sets - will these get QImode or so?
Honza
else abort ();
-- Waldek Hebisch hebisch@math.uni.wroc.pl or hebisch@hera.math.uni.wroc.pl