Re: Bug#598615: plt-scheme: FTBFS on mips/mipsel (error: impossible constraint in 'asm')
On Thu, Sep 30, 2010 at 9:22 AM, Julien Cristau <jcristau@debian.org> wrote:
> plt-scheme FTBFS on mipsen in testing:
>> [...]
>> gcc -I./.. -I/build/buildd-plt-scheme_4.2.1-1+b1-mips-JD2ADc/plt-scheme-4.2.1/src/mzscheme/src/../include -Wall -c /build/buildd-plt-scheme_4.2.1-1+b1-mips-JD2ADc/plt-scheme-4.2.1/src/mzscheme/src/gmp/gmp.c -o gmp.o
>> /build/buildd-plt-scheme_4.2.1-1+b1-mips-JD2ADc/plt-scheme-4.2.1/src/mzscheme/src/gmp/gmp.c: In function 'mpn_sb_get_str':
>> /build/buildd-plt-scheme_4.2.1-1+b1-mips-JD2ADc/plt-scheme-4.2.1/src/mzscheme/src/gmp/gmp.c:1858: error: impossible constraint in 'asm'
>> /build/buildd-plt-scheme_4.2.1-1+b1-mips-JD2ADc/plt-scheme-4.2.1/src/mzscheme/src/gmp/gmp.c:1863: error: impossible constraint in 'asm'
>> /build/buildd-plt-scheme_4.2.1-1+b1-mips-JD2ADc/plt-scheme-4.2.1/src/mzscheme/src/gmp/gmp.c:1915: error: impossible constraint in 'asm'
>> make[7]: *** [gmp.o] Error 1
These are instances of the umul_ppmm macro being called. It's defined
in src/mzscheme/src/gmp/gmplonglong.h as follows:
620 #if defined (__mips) && W_TYPE_SIZE == 32
621 #if __GNUC__ > 2 || __GNUC_MINOR__ >= 7
622 #define umul_ppmm(w1, w0, u, v) \
623 __asm__ ("multu %2,%3" : "=l" (w0), "=h" (w1) : "d" (u), "d" (v))
624 #else
625 #define umul_ppmm(w1, w0, u, v) \
626 __asm__ ("multu %2,%3\n\tmflo %0\n\tmfhi %1" \
627 : "=d" (w0), "=d" (w1) : "d" (u), "d" (v))
628 #endif
629 #define UMUL_TIME 10
630 #define UDIV_TIME 100
631 #endif /* __mips */
632
633 #if (defined (__mips) && __mips >= 3) && W_TYPE_SIZE == 64
634 #if __GNUC__ > 2 || __GNUC_MINOR__ >= 7
635 #define umul_ppmm(w1, w0, u, v) \
636 __asm__ ("dmultu %2,%3" : "=l" (w0), "=h" (w1) : "d" (u), "d" (v))
637 #else
638 #define umul_ppmm(w1, w0, u, v) \
639 __asm__ ("dmultu %2,%3\n\tmflo %0\n\tmfhi %1" \
640 : "=d" (w0), "=d" (w1) : "d" (u), "d" (v))
641 #endif
642 #define UMUL_TIME 20
643 #define UDIV_TIME 140
644 #endif /* __mips */
As you can see, for GCC >= 2.7 it's trying to use the l and h
constraints. The h constraint specifically is not supported[0] as of
GCC 4.4, so it looks like the mfhi command should be used[1] instead.
For older GCC versions, the macro is already defined to use mfhi/mflo
(lines 627-629 and 638-640) so I can only assume they're preferring not
to use that due to it calling more commands.
Is there anything I've missed or mistakes in my analysis?
I'll try to get some time this weekend to test a patch that simply
always uses the mfhi/mflo macros, but I'm a bit busy. So if someone
else has some spare cycles to test it, I'd appreciate it.
[0]: http://gcc.gnu.org/onlinedocs/gcc-4.4.4/gcc/Machine-Constraints.html#Machine-Constraints
[1]: https://secure.wikimedia.org/wikipedia/en/wiki/MIPS_architecture#Compiler_register_usage
--
James
GPG Key: 1024D/61326D40 2003-09-02 James Vega <jamessan@debian.org>
Reply to: