This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Is there a way to get the high half of a DImode on a 32-bit machine?
- To: gcc-bugs at gcc dot gnu dot org
- Subject: Is there a way to get the high half of a DImode on a 32-bit machine?
- From: gcc at horizon dot com
- Date: 11 Sep 2001 02:47:44 -0000
Some parts of GCC's 64-bit code generation handling on 32-bit machines are
still a bit weak, and I'd like to insert some asm functions to help
the shifts and rotates that are part of 64-bit CRC generation.
However, I am stymied by my inability to address the high word of
a DImode value in registers. There's no obvious way to make, say,
an x86 assemble code like
unsigned long long x = get_64_bits();
asm("shrdl %2,%H0,%0" : "=r" (x) : "0" (x), "cI" (s));
asm("shrl %2,%H0" : "=r" (x) : "0" (x), "cI" (s));
(Where H is the missing "high-half" specifier.)
I realize that gcc can produce this code by itself, but attempting
a rotate produces a godawful mess instead of using 3 registers
like like:
temp = (unsigned)x;
asm("shrdl %2,%H0,%0" : "=r" (x) : "0" (x), "cI" (s));
asm("shrdl %2,%3,%H0" : "=r" (x) : "0" (x), "cI" (s), "r" (temp));
A scan over 2.95.3 and a 3.0.2 snapshot doesn't reveal any output
format specifier akin to my (hypothetical) %Hx, however.
And referring to (unnsigned)(x>>32) produces a copy of the high
half rather than referencing the high half that's already loaded.
The only saving grace is that at least gcc 3.0 doesn't make a 64-bit
temporary to evaluate "(unsigned)(x>>32)".
I don't even mind he extra instructions as much as I mind the extra
register pressure on the lousy x86.