FS#12013 - Build libmad using mips-sde-elf-gcc 4.5.1:impossible constraint in 'asm'

Attached to Project: Rockbox
Opened by Huan Zhang (victorzhang) - Wednesday, 16 March 2011, 17:00 GMT
Last edited by Frank Gevaerts (fg) - Monday, 11 June 2012, 21:19 GMT
Task Type Patches
Category Codecs
Status Closed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version Rbutil SVN
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


@rockbox/apps/codecs/libmad/fixed.h,line 299
# define MAD_F_MLX(hi, lo, x, y) \
asm ("mult %2,%3" \
: "=l" (lo), "=h" (hi) \
: "%r" (x), "r" (y))
Since gcc 4.4 the MIPS port no longer recognizes the "h" asm constraint.
It was necessary to remove this constraint in order to avoid generating unpredictable code sequences.We can achieve the same effect using 128-bit types:
typedef unsigned int u64_di_t __attribute__ ((mode (DI)));
# define MAD_F_MLX(hi, lo, x, y) \
do { \
u64_di_t __ll = (u64_di_t) (x) * (y); \
hi = __ll >> 32; \
lo = __ll; \

See also:GCC 4.4 release note

This patch is a possible workaround that works on both old and new version of gcc.
This task depends upon

Closed by  Frank Gevaerts (fg)
Monday, 11 June 2012, 21:19 GMT
Reason for closing:  Accepted
Additional comments about closing:  Committed in fbe33e0. Thanks!
Comment by Huan Zhang (victorzhang) - Thursday, 17 March 2011, 04:51 GMT
This patch applys to fixed.h r28532.