February 23, 2012 [dmd-internals] Floating point %= clobbering eax | ||||
---|---|---|---|---|
| ||||
With my patch to improve code gen for OPmsw, the compiler can eliminate some useless loads of array lengths to eax. Unfortunately, it doesn't seem to realize that fnstsw modifies EAX, resulting in a crash on the second load.
Does anyone know where/how registers are marked as used? Nothing I've tried seems to affect code generation at all.
The fnstsw instruction is generated around cg87.c:2342
_D5testx6divassFAeeZv PROC NEAR
; COMDEF _D5testx6divassFAeeZv
push ebp ; 0000 _ 55
mov ebp, esp ; 0001 _ 8B. EC
mov eax, offset FLAT:?_007 ; 0003 _ B8,
00000030(segrel)
push eax ; 0008 _ 50
call _system ; 0009 _ E8,
00000000(rel)
add esp, 4 ; 000E _ 83. C4, 04
nop ; 0011 _ 90
fld tbyte ptr [ebp+8H] ; 0012 _ DB. 6D, 08
mov eax, dword ptr [ebp+18H] ; 0015 _ 8B. 45, 18
fld tbyte ptr [eax] ; 0018 _ DB. 28
?_009: fprem ; 001A _ D9. F8
fnstsw ax ; 001C _ DF. E0
sahf ; 001E _ 9E
jpe ?_009 ; 001F _ 7A, F9
fstp st(1) ; 0021 _ DD. D9
fstp tbyte ptr [eax] ; 0023 _ DB. 38
nop ; 0025 _ 90
pop ebp ; 0026 _ 5D
ret 20 ; 0027 _ C2, 0014
_D5testx6divassFAeeZv ENDP
_______________________________________________
dmd-internals mailing list
dmd-internals@puremagic.com
http://lists.puremagic.com/mailman/listinfo/dmd-internals
|
February 23, 2012 Re: [dmd-internals] Floating point %= clobbering eax | ||||
---|---|---|---|---|
| ||||
Posted in reply to Daniel Murphy | Never mind, I think I've got it. On Thu, Feb 23, 2012 at 17:20, Daniel Murphy <yebblies@gmail.com> wrote: > With my patch to improve code gen for OPmsw, the compiler can eliminate some useless loads of array lengths to eax. Unfortunately, it doesn't seem to realize that fnstsw modifies EAX, resulting in a crash on the second load. > > Does anyone know where/how registers are marked as used? Nothing I've tried seems to affect code generation at all. > > The fnstsw instruction is generated around cg87.c:2342 > > _D5testx6divassFAeeZv PROC NEAR > ; COMDEF _D5testx6divassFAeeZv > push ebp ; 0000 _ 55 > mov ebp, esp ; 0001 _ 8B. EC > mov eax, offset FLAT:?_007 ; 0003 _ B8, > 00000030(segrel) > push eax ; 0008 _ 50 > call _system ; 0009 _ E8, > 00000000(rel) > add esp, 4 ; 000E _ 83. C4, 04 > nop ; 0011 _ 90 > fld tbyte ptr [ebp+8H] ; 0012 _ DB. 6D, 08 > mov eax, dword ptr [ebp+18H] ; 0015 _ 8B. 45, 18 > fld tbyte ptr [eax] ; 0018 _ DB. 28 > ?_009: fprem ; 001A _ D9. F8 > fnstsw ax ; 001C _ DF. E0 > sahf ; 001E _ 9E > jpe ?_009 ; 001F _ 7A, F9 > fstp st(1) ; 0021 _ DD. D9 > fstp tbyte ptr [eax] ; 0023 _ DB. 38 > nop ; 0025 _ 90 > pop ebp ; 0026 _ 5D > ret 20 ; 0027 _ C2, 0014 > _D5testx6divassFAeeZv ENDP _______________________________________________ dmd-internals mailing list dmd-internals@puremagic.com http://lists.puremagic.com/mailman/listinfo/dmd-internals |
Copyright © 1999-2021 by the D Language Foundation