On Fri, 4 Aug 2017, Ralf Baechle wrote: > Chances are it's something specific to MIPS64 R6. Before trying your > config file I also tried a number of other defconfigs and all built > well. > > Here's a test case which generates a reference to __multi3: > > unsigned long func(unsigned long a, unsigned long b) > { > return a > (~0UL) / b; > } > > GCC rearanges above statement to: > > return (unsigned __int128)a * (unsigned __int128) b > 0xffffffff; > > computing which requires 128 bit intermediate results. This is the > code generated for MIPS64 R2: > > dmultu $4,$5 > mfhi $2 > sltu $2,$0,$2 > > And this is for R6: > > move $2,$4 > move $7,$5 # $6/$7 contain the second op > move $6,$0 > move $4,$0 > move $5,$2 # $4/$5 contain the first op > sd $31,8($sp) > balc __multi3 > sltu $2,$0,$2 This looks silly. Why doesn't GCC simply emit: dmuhu $2,$4,$5 sltu $2,$0,$2 instead? It's even shorter than the R2 equivalent. Maciej