Problems building 64-bit 4.2.1 on IRIX 6.5

Albert Chin gmp-bugs at mlists.thewrittenword.com
Sat Aug 12 07:08:43 CEST 2006


I attempted to build a 64-bit gmp-4.2.1 on IRIX 6.5 with the SGI C
compiler:
  $ /opt/build/china
  $ gtar jxf gmp-4.2.1.tar.bz2
  $ cd gmp-4.2.1
  $ ./configure CC=cc CFLAGS="-64 -mips4 -g" ABI=64 \
  --disable-shared --enable-static
  ...
  $ gmake
  ...
  $ gmake check
  ...
  gmake[4]: Entering directory `/opt/build/china/gmp-4.2.1/tests/mpn'
  PASS: t-asmtype
  PASS: t-aors_1
  /bin/sh: 6939375 Bus error(coredump)
  FAIL: t-divrem_1
  /bin/sh: 7007925 Bus error(coredump)
  FAIL: t-fat
  PASS: t-get_d
  PASS: t-instrument
  PASS: t-iord_u
  PASS: t-mp_bases
  PASS: t-perfsqr
  PASS: t-scan
  ==================================
  2 of 10 tests failed
  Please report to gmp-bugs at swox.com
  ==================================

  $ cd /opt/build/china/gmp-4.2.1/tests/mpn
  $ ./t-divrem_1
  $ dbx t-divrem_1 core
  dbx version 7.3.3 (81666_Apr26 patchSG0004530) Apr 26 2002 13:49:54
  Core from signal SIGBUS: Bus error
  (dbx) where
  >  0 __gmpn_divrem_1(0x0, 0x0, 0x10038530, 0x1, 0x0, 0x0, 0xfffffffffffcde10, 0x0) ["/opt/build/china/gmp-4.2.1/mpn/tmp-divrem_1.s":254, 0x100134d0]
     1 check_data() ["/opt/build/china/gmp-4.2.1/tests/mpn/t-divrem_1.c":74, 0x10005dfc]

  $ ./t-fat
  $ dbx t-fat core
  dbx version 7.3.3 (81666_Apr26 patchSG0004530) Apr 26 2002 13:49:54
  Core from signal SIGBUS: Bus error
  (dbx) where
  >  0 __gmpn_divrem_1(0x2, 0x1, 0xfffffcddd8, 0x1, 0x11f, 0x0, 0xfffffffffffcde00, 0x1) ["/opt/build/china/gmp-4.2.1/mpn/tmp-divrem_1.s":249, 0x1001283c]
     1 check_functions() ["/opt/build/china/gmp-4.2.1/tests/mpn/t-fat.c":148, 0x10005b74]


$ uname -a
IRIX64 [hostname] 6.5 10060437 IP30
$ uname -R
6.5 6.5.26m
$ cc -version
MIPSpro Compilers: Version 7.4.4m
$ ./config.guess
mips64-sgi-irix6.5
$ ./configfsf.guess 
mips-sgi-irix6.5

I've attached a copy of /opt/build/china/gmp-4.2.1/mpn/tmp-divrem_1.s.
  $ cd mpn
  $ ls -ld divrem_1.asm
  lrwxrwxr-x    1 china    src           28 Aug 11 23:28 divrem_1.asm -> .././mpn/mips64/divrem_1.asm

Note, while building /opt/build/china/gmp-4.2.1/mpn/divrem_1.o I get
the following:
/bin/sh ../libtool --mode=compile --tag=CC ../mpn/m4-ccas --m4="/opt/TWWfsw/m4/bin/gm4" cc -c -DHAVE_CONFIG_H -I. -I. -I.. -D__GMP_WITHIN_GMP -I.. -DOPERATION_`echo divrem_1 | sed 's/_$//'`    -64 -mips4 -g `test -f 'divrem_1.asm' || echo './'`divrem_1.asm
 ../mpn/m4-ccas --m4=/opt/TWWfsw/m4/bin/gm4 cc -c -DHAVE_CONFIG_H -I. -I. -I.. -D__GMP_WITHIN_GMP -I.. -DOPERATION_divrem_1 -64 -mips4 -g divrem_1.asm -o divrem_1.o
/opt/TWWfsw/m4/bin/gm4  -DHAVE_CONFIG_H -D__GMP_WITHIN_GMP -DOPERATION_divrem_1 divrem_1.asm >tmp-divrem_1.s
 cc -c -DHAVE_CONFIG_H -I. -I. -I.. -D__GMP_WITHIN_GMP -I.. -DOPERATION_divrem_1 -64 -mips4 -g tmp-divrem_1.s -o divrem_1.o
as: Warning: /tmp-divrem_1.s, line 69: Used $at without .set noat: operand 1
      lui $1,%hi(%neg(%gp_rel(__gmpn_divrem_1)))
as: Warning: /tmp-divrem_1.s, line 70: Used $at without .set noat: operand 1
      addiu $1,$1,%lo(%neg(%gp_rel(__gmpn_divrem_1)))
as: Warning: /tmp-divrem_1.s, line 70: Used $at without .set noat: operand 2
as: Warning: /tmp-divrem_1.s, line 71: Used $at without .set noat: operand 2
      daddu $gp,$1,$25
as: Warning: /tmp-divrem_1.s, line 268: Should use dla rather than la for 64-bit addresses
      la $3,__gmpn_clz_tab
as: Warning: /tmp-divrem_1.s, line 85: Macro instruction used
as: Warning: /tmp-divrem_1.s, line 112: Macro instruction used
as: Warning: /tmp-divrem_1.s, line 122: Macro instruction used
as: Warning: /tmp-divrem_1.s, line 150: Macro instruction used
as: Warning: /tmp-divrem_1.s, line 164: Macro instruction used
as: Warning: /tmp-divrem_1.s, line 303: Macro instruction used
as: Warning: /tmp-divrem_1.s, line 313: Macro instruction used
as: Warning: /tmp-divrem_1.s, line 341: Macro instruction used
as: Warning: /tmp-divrem_1.s, line 355: Macro instruction used

The "Used $at without .set noat" warning can be resolved by adding
".set noat" to ASM_START() in mpn/mips32/mips-defs.m4. And the "Should
use dla rather than la" warning can be resolved by replacing the "la"
op-code with "dla". I don't know MIPS assembly so don't know if this
is advisable. I don't know how to resolve the "Macro instruction used"
warnings.

-- 
albert chin (china at thewrittenword.com)
-------------- next part --------------



























































	.set noreorder
	.set nomacro
	.text
	.align	4
	.globl	__gmpn_divrem_1
	.ent	__gmpn_divrem_1
__gmpn_divrem_1:
	dsubu	$sp,$sp,32
	sd	$28,16($sp)
	lui	$1,%hi(%neg(%gp_rel(__gmpn_divrem_1)))
	addiu	$1,$1,%lo(%neg(%gp_rel(__gmpn_divrem_1)))
	daddu	$gp,$1,$25
	move	$14,$4
	move	$15,$5
	addu	$4,$7,$15
	bne	$4,$0,.L176
	move	$13,$0
	b	.L490
	move	$2,$0
.L491:
	b	.L229
	dli	$5,-1
.L176:
	sll	$2,$4,3
	addu	$2,$2,-8
	dli	$3,0x8000000000000000
	and	$3,$8,$3
	beq	$3,$0,.L177
	addu	$14,$14,$2
	beq	$7,$0,.L494
	dsll	$2,$8,1
	sll	$2,$7,3
	addu	$2,$2,$6
	ld	$13,-8($2)
	addu	$7,$7,-1
	sltu	$2,$13,$8
	xori	$2,$2,0x1
	dsll	$2,$2,32
	dsra	$2,$2,32
	dsll	$2,$2,32
	dsrl	$2,$2,32
	sd	$2,0($14)
	addu	$14,$14,-8
	dsubu	$2,$0,$2
	and	$2,$8,$2
	dsubu	$13,$13,$2
	dsll	$2,$8,1
.L494:
	beq	$2,$0,.L491
	dsrl	$9,$8,32
	dsubu	$4,$0,$8
	ddivu	$0,$4,$9
	dli	$2,0xffffffff
	and	$12,$8,$2
	mflo	$5
	move	$11,$5
	dmult	$11,$9
	mflo	$3
	nop
	nop
	dmult	$11,$12
	mflo	$10
	dli	$2,0x100000000
	dsubu	$4,$4,$3
	dmult	$4,$2
	mflo	$4
	sltu	$3,$4,$10
	beql	$3,$0,.L495
	dsubu	$4,$4,$10
	daddu	$4,$4,$8
	sltu	$2,$4,$8
	bne	$2,$0,.L248
	dsubu	$11,$11,1
	sltu	$2,$4,$10
	beql	$2,$0,.L495
	dsubu	$4,$4,$10
	dsubu	$11,$11,1
	daddu	$4,$4,$8
.L248:
	dsubu	$4,$4,$10
.L495:
	ddivu	$0,$4,$9
	mflo	$2
	move	$5,$2
	dmult	$5,$9
	mflo	$3
	nop
	nop
	dmult	$5,$12
	mflo	$10
	dli	$2,0x100000000
	dsubu	$4,$4,$3
	dmult	$4,$2
	mflo	$4
	sltu	$3,$4,$10
	beq	$3,$0,.L504
	daddu	$4,$4,$8
	sltu	$2,$4,$8
	bne	$2,$0,.L251
	dsubu	$5,$5,1
	sltu	$2,$4,$10
	bnel	$2,$0,.L251
	dsubu	$5,$5,1
.L251:
	dli	$2,0x100000000
.L504:
	dmult	$11,$2
	mflo	$2
	or	$5,$2,$5
.L229:
	addu	$7,$7,-1
	bltz	$7,.L257
	addu	$25,$15,-1
	sll	$2,$7,3
	addu	$6,$2,$6
.Loop1:
	ld	$11,0($6)
	dmultu	$13,$5
	mfhi	$10
	daddu	$10,$10,$13
	nop
	dmultu	$10,$8
	mflo	$2
	mfhi	$9
	dsubu	$2,$11,$2
	dsubu	$3,$13,$9
	sltu	$9,$11,$2
	dsubu	$9,$3,$9
	beq	$9,$0,.L271
	move	$4,$2
	dsubu	$2,$4,$8
	sltu	$3,$4,$2
	move	$4,$2
	beq	$9,$3,.L271
	daddu	$10,$10,1
	dsubu	$4,$4,$8
	daddu	$10,$10,1
.L271:	sltu	$2,$4,$8
	bne	$2,$0,.L496
	move	$13,$4
	dsubu	$4,$4,$8
	daddu	$10,$10,1
	move	$13,$4
.L496:	sd	$10,0($14)
	addu	$14,$14,-8
	addu	$7,$7,-1
	bgez	$7,.Loop1
	addu	$6,$6,-8
.L257:
	move	$7,$25
	bltz	$7,.L490
	move	$2,$13
.Loop2:
	dmultu	$13,$5
	mfhi	$9
	daddu	$9,$9,$13
	nop
	dmultu	$9,$8
	mflo	$2
	mfhi	$6
	dsubu	$2,$0,$2
	dsubu	$3,$13,$6
	sltu	$6,$0,$2
	dsubu	$6,$3,$6
	beq	$6,$0,.L295
	move	$4,$2
	dsubu	$2,$4,$8
	sltu	$3,$4,$2
	move	$4,$2
	beq	$6,$3,.L295
	daddu	$9,$9,1
	dsubu	$4,$4,$8
	daddu	$9,$9,1
.L295:	sltu	$2,$4,$8
	bne	$2,$0,.L497
	move	$13,$4
	dsubu	$4,$4,$8
	daddu	$9,$9,1
	move	$13,$4
.L497:	sd	$9,0($14)
	addu	$7,$7,-1
	bgez	$7,.Loop2
	addu	$14,$14,-8
	b	.L490
	move	$2,$13
.L177:
	beq	$7,$0,.L308
	sll	$2,$7,3
	addu	$2,$2,$6
	ld	$12,-8($2)
	sltu	$3,$12,$8
	beq	$3,$0,.L308
	addu	$4,$4,-1
	move	$13,$12
	sd	$0,0($14)
	bne	$4,$0,.L307
	addu	$14,$14,-8
	b	.L490
	move	$2,$13
.L492:
	b	.L395
	dli	$5,-1
.L307:
	addu	$7,$7,-1
.L308:
	dli	$5,0x38
	dsrl	$2,$8,56
	andi	$2,$2,0xff
	la	$3,__gmpn_clz_tab
	bne	$2,$0,.L321
	addu	$25,$15,-1
	dsubu	$5,$5,8
.L499:
	beql	$5,$0,.L498
	daddu	$5,$5,1
	dsll	$2,$5,32
	dsra	$2,$2,32
	dsrl	$2,$8,$2
	andi	$2,$2,0xff
	beql	$2,$0,.L499
	dsubu	$5,$5,8
.L321:
	daddu	$5,$5,1
.L498:
	dsll	$2,$5,32
	dsra	$2,$2,32
	dsrl	$2,$8,$2
	dsll	$2,$2,32
	dsra	$2,$2,32
	addu	$2,$2,$3
	lbu	$4,0($2)
	dli	$3,0x41
	dsubu	$3,$3,$4
	dsubu	$3,$3,$5
	dsll	$24,$3,32
	dsra	$24,$24,32
	dsll	$8,$8,$24
	dsll	$2,$8,1
	beq	$2,$0,.L492
	dsll	$13,$13,$24
	dsrl	$9,$8,32
	dsubu	$4,$0,$8
	ddivu	$0,$4,$9
	dli	$2,0xffffffff
	and	$12,$8,$2
	mflo	$5
	move	$11,$5
	dmult	$11,$9
	mflo	$3
	nop
	nop
	dmult	$11,$12
	mflo	$10
	dli	$2,0x100000000
	dsubu	$4,$4,$3
	dmult	$4,$2
	mflo	$4
	sltu	$3,$4,$10
	beql	$3,$0,.L500
	dsubu	$4,$4,$10
	daddu	$4,$4,$8
	sltu	$2,$4,$8
	bne	$2,$0,.L414
	dsubu	$11,$11,1
	sltu	$2,$4,$10
	beql	$2,$0,.L500
	dsubu	$4,$4,$10
	dsubu	$11,$11,1
	daddu	$4,$4,$8
.L414:
	dsubu	$4,$4,$10
.L500:
	ddivu	$0,$4,$9
	mflo	$2
	move	$5,$2
	dmult	$5,$9
	mflo	$3
	nop
	nop
	dmult	$5,$12
	mflo	$10
	dli	$2,0x100000000
	dsubu	$4,$4,$3
	dmult	$4,$2
	mflo	$4
	sltu	$3,$4,$10
	beq	$3,$0,.L505
	daddu	$4,$4,$8
	sltu	$2,$4,$8
	bne	$2,$0,.L417
	dsubu	$5,$5,1
	sltu	$2,$4,$10
	bnel	$2,$0,.L417
	dsubu	$5,$5,1
.L417:
	dli	$2,0x100000000
.L505:
	dmult	$11,$2
	mflo	$2
	or	$5,$2,$5
.L395:
	beq	$7,$0,.L422
	sll	$2,$7,3
	addu	$2,$2,$6
	ld	$12,-8($2)
	addu	$7,$7,-2
	li	$2,64
	subu	$2,$2,$24
	dsrl	$3,$12,$2
	bltz	$7,.L424
	or	$13,$13,$3
	move	$15,$2
	sll	$2,$7,3
	addu	$6,$2,$6
.Loop3:
	ld	$11,0($6)
	dmultu	$13,$5
	mfhi	$9
	daddu	$9,$9,$13
	nop
	dmultu	$9,$8
	mflo	$4
	mfhi	$10
	dsll	$3,$12,$24
	dsrl	$2,$11,$15
	or	$3,$3,$2
	dsubu	$4,$3,$4
	dsubu	$2,$13,$10
	sltu	$10,$3,$4
	dsubu	$10,$2,$10
	beq	$10,$0,.L438
	dsubu	$2,$4,$8
	sltu	$3,$4,$2
	move	$4,$2
	beq	$10,$3,.L438
	daddu	$9,$9,1
	dsubu	$4,$4,$8
	daddu	$9,$9,1
.L438:	sltu	$2,$4,$8
	bne	$2,$0,.L501
	move	$13,$4
	dsubu	$4,$4,$8
	daddu	$9,$9,1
	move	$13,$4
.L501:	sd	$9,0($14)
	addu	$14,$14,-8
	move	$12,$11
	addu	$7,$7,-1
	bgez	$7,.Loop3
	addu	$6,$6,-8
.L424:
	dmultu	$13,$5
	mfhi	$7
	daddu	$7,$7,$13
	nop
	dmultu	$7,$8
	mflo	$2
	mfhi	$6
	dsll	$3,$12,$24
	dsubu	$2,$3,$2
	dsubu	$4,$13,$6
	sltu	$6,$3,$2
	dsubu	$6,$4,$6
	beq	$6,$0,.L458
	move	$4,$2
	dsubu	$2,$4,$8
	sltu	$3,$4,$2
	move	$4,$2
	beq	$6,$3,.L458
	daddu	$7,$7,1
	dsubu	$4,$4,$8
	daddu	$7,$7,1
.L458:
	sltu	$2,$4,$8
	bne	$2,$0,.L502
	move	$13,$4
	dsubu	$4,$4,$8
	daddu	$7,$7,1
	move	$13,$4
.L502:
	sd	$7,0($14)
	addu	$14,$14,-8
.L422:
	move	$7,$25
	bltz	$7,.L490
	dsrl	$2,$13,$24
.Loop4:
	dmultu	$13,$5
	mfhi	$9
	daddu	$9,$9,$13
	nop
	dmultu	$9,$8
	mflo	$2
	mfhi	$6
	dsubu	$2,$0,$2
	dsubu	$3,$13,$6
	sltu	$6,$0,$2
	dsubu	$6,$3,$6
	beq	$6,$0,.L481
	move	$4,$2
	dsubu	$2,$4,$8
	sltu	$3,$4,$2
	move	$4,$2
	beq	$6,$3,.L481
	daddu	$9,$9,1
	dsubu	$4,$4,$8
	daddu	$9,$9,1
.L481:	sltu	$2,$4,$8
	bne	$2,$0,.L503
	move	$13,$4
	dsubu	$4,$4,$8
	daddu	$9,$9,1
	move	$13,$4
.L503:	sd	$9,0($14)
	addu	$7,$7,-1
	bgez	$7,.Loop4
	addu	$14,$14,-8
	dsrl	$2,$13,$24
.L490:
	ld	$28,16($sp)
	j	$31
	daddu	$sp,$sp,32
	.end	__gmpn_divrem_1


More information about the gmp-bugs mailing list