cc: assembler failed for tmp-divrem_2.s
Dennis Clarke
dclarke at blastwave.org
Mon Mar 29 11:42:43 CEST 2010
I know that I can build gmp 5.0.1 neatly with GCC but I had to try with
Studio 11 again.
Everything was going well until :
/opt/studio/SOS11/SUNWspro/bin/cc -c -DHAVE_CONFIG_H -I.
-I../../gmp-5.0.1/mpn -I.. -D__GMP_WITHIN_GMP -I../../gmp-5.0.1
-DOPERATION_divrem_2 -I/usr/local/include -fast -xstrconst -xildoff
-xarch=pentium_pro -xnolibmil -Xa -Kpic -xregs=no%frameptr -xlibmieee -Qy
-xdebugformat=dwarf -xs -D_TS_ERRNO tmp-divrem_2.s -KPIC -DPIC -o
.libs/divrem_2.o
Assembler:
"tmp-divrem_2.s", line 115 : Syntax error
Near line: " or %dl, %al"
"tmp-divrem_2.s", line 210 : Syntax error
Near line: " or %dl, %al"
cc: assembler failed for tmp-divrem_2.s
make[2]: *** [divrem_2.lo] Error 1
make[2]: Leaving directory `/opt/csw/src/GNU/gmp-5.0.1-try1/mpn'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/opt/csw/src/GNU/gmp-5.0.1-try1'
*** Error code 2
make: Fatal error: Command failed for target `all'
$
This looks to be something that was taken from one of these :
../gmp-5.0.1/tune/divrem1inv.c
../gmp-5.0.1/tune/divrem2div.c
../gmp-5.0.1/tune/pre_divrem_1.c
../gmp-5.0.1/tune/divrem2inv.c
../gmp-5.0.1/tune/divrem1div.c
../gmp-5.0.1/tests/mpn/t-divrem_1.c
../gmp-5.0.1/tests/devel/divrem.c
../gmp-5.0.1/mpn/alpha/divrem_2.asm
../gmp-5.0.1/mpn/x86_64/divrem_1.asm
../gmp-5.0.1/mpn/x86_64/divrem_2.asm
../gmp-5.0.1/mpn/generic/divrem_2.c
../gmp-5.0.1/mpn/generic/divrem_1.c
../gmp-5.0.1/mpn/generic/pre_divrem_1.c
../gmp-5.0.1/mpn/generic/divrem.c
../gmp-5.0.1/mpn/sparc64/divrem_1.c
../gmp-5.0.1/mpn/ia64/divrem_1.asm
../gmp-5.0.1/mpn/ia64/divrem_2.asm
../gmp-5.0.1/mpn/powerpc64/mode64/divrem_1.asm
../gmp-5.0.1/mpn/powerpc64/mode64/divrem_2.asm
../gmp-5.0.1/mpn/powerpc32/divrem_2.asm
../gmp-5.0.1/mpn/x86/divrem_2.asm
../gmp-5.0.1/mpn/x86/k6/divrem_1.asm
../gmp-5.0.1/mpn/x86/pentium4/sse2/divrem_1.asm
../gmp-5.0.1/mpn/x86/p6/mmx/divrem_1.asm
../gmp-5.0.1/mpn/x86/k7/mmx/divrem_1.asm
../gmp-5.0.1/mpn/x86/divrem_1.asm
Here is the whole assembler source with blank lines removed :
$ grep -v "^$" ./mpn/tmp-divrem_2.s | cat -n -
1 .text
2 .align 16
3 .globl __gmpn_divrem_2
4 .type __gmpn_divrem_2, at function
5
6 __gmpn_divrem_2:
7 push %ebp
8 push %edi
9 push %esi
10 push %ebx
11 sub $36, %esp
12 mov 68(%esp), %ecx
13 mov 72(%esp), %esi
14 movl $0, 32(%esp)
15 lea 0(,%ecx,4), %edi
16 add 64(%esp), %edi
17 mov (%esi), %ebx
18 mov 4(%esi), %eax
19 mov %ebx, 20(%esp)
20 sub $12, %edi
21 mov %eax, 24(%esp)
22 mov %edi, 12(%esp)
23 mov 8(%edi), %ebx
24 mov 4(%edi), %ebp
25 cmp %eax, %ebx
26 jb .L8
27 seta %dl
28 cmp 20(%esp), %ebp
29 setae %al
30 or %dl, %al
31 jne .L35
32 .L8:
33 mov 60(%esp), %esi
34 lea -3(%esi,%ecx), %edi
35 test %edi, %edi
36 js .L9
37 mov 24(%esp), %edx
38 mov $-1, %esi
39 mov %esi, %eax
40 mov %esi, %ecx
41 not %edx
42 divl 24(%esp)
43 mov %eax, %esi
44 imul 24(%esp), %eax
45 mov %eax, (%esp)
46 mov %esi, %eax
47 mull 20(%esp)
48 mov (%esp), %eax
49 add 20(%esp), %eax
50 adc $0, %ecx
51 add %eax, %edx
52 adc $0, %ecx
53 mov %ecx, %eax
54 js .L32
55 .L36: dec %esi
56 sub 24(%esp), %edx
57 sbb $0, %eax
58 jns .L36
59 .L32:
60 mov %esi, 16(%esp)
61 mov %edi, %ecx
62 mov 12(%esp), %esi
63 mov 24(%esp), %eax
64 neg %eax
65 mov %eax, 4(%esp)
66 .align 16
67 nop
68 .Lloop:
69 mov 16(%esp), %eax
70 mul %ebx
71 add %ebp, %eax
72 mov %eax, (%esp)
73 adc %ebx, %edx
74 mov %edx, %edi
75 imul 4(%esp), %edx
76 mov 20(%esp), %eax
77 lea (%edx, %ebp), %ebx
78 mul %edi
79 xor %ebp, %ebp
80 cmp 60(%esp), %ecx
81 jl .L19
82 mov (%esi), %ebp
83 sub $4, %esi
84 .L19: sub 20(%esp), %ebp
85 sbb 24(%esp), %ebx
86 sub %eax, %ebp
87 sbb %edx, %ebx
88 mov 20(%esp), %eax
89 inc %edi
90 xor %edx, %edx
91 cmp (%esp), %ebx
92 adc $-1, %edx
93 add %edx, %edi
94 and %edx, %eax
95 and 24(%esp), %edx
96 add %eax, %ebp
97 adc %edx, %ebx
98 cmp 24(%esp), %ebx
99 jae .Lfix
100 .Lbck: mov 56(%esp), %edx
101 mov %edi, (%edx, %ecx, 4)
102 dec %ecx
103 jns .Lloop
104 .L9: mov 64(%esp), %esi
105 mov %ebp, (%esi)
106 mov %ebx, 4(%esi)
107 mov 32(%esp), %eax
108 add $36, %esp
109 pop %ebx
110 pop %esi
111 pop %edi
112 pop %ebp
113 ret
114 .Lfix: seta %dl
115 cmp 20(%esp), %ebp
116 setae %al
117 or %dl, %al
118 je .Lbck
119 inc %edi
120 sub 20(%esp), %ebp
121 sbb 24(%esp), %ebx
122 jmp .Lbck
123 .L35: sub 20(%esp), %ebp
124 sbb 24(%esp), %ebx
125 movl $1, 32(%esp)
126 jmp .L8
127 .size __gmpn_divrem_2,.-__gmpn_divrem_2
Looking at the above the issue is at lines 30 and 117 which both look
identical :
setae %al
or %dl, %al
Seems harmless enough.
--
Dennis
More information about the gmp-bugs
mailing list