[LLVMbugs] [Bug 2803] New: using x86.mmx. emms intrinsic can clobber results returned on the fp stack
bugzilla-daemon at cs.uiuc.edu
bugzilla-daemon at cs.uiuc.edu
Wed Sep 17 11:23:43 PDT 2008
http://llvm.org/bugs/show_bug.cgi?id=2803
Summary: using x86.mmx.emms intrinsic can clobber results
returned on the fp stack
Product: libraries
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: Backend: X86
AssignedTo: unassignedbugs at nondot.org
ReportedBy: paul at rapidmind.com
CC: llvmbugs at cs.uiuc.edu
Created an attachment (id=2023)
--> (http://llvm.org/bugs/attachment.cgi?id=2023)
ll file to reproduce bug
To work around bug 1838 (x86 backend doesn't insert emms when it is needed)
I've manually insert calls to x86.mmx.emms before calling functions that use
the floating point stack.
e.g.,
...
%45 = extractelement <2 x float> %39, i32 1 ; <float> [#uses=1]
%46 = extractelement <2 x float> %40, i32 1 ; <float> [#uses=1]
call void @llvm.x86.mmx.emms( )
%47 = call float @fmaxf( float %45, float %46 ) ; <float> [#uses=1]
%48 = insertelement <2 x float> %44, float %47, i32 1 ; <<2 x float>> [#uses=2]
...
and here is a snippet of generated code:
call fmaxf
fstpt 88(%esp)
movss 160(%esp), %xmm0
movss %xmm0, 4(%esp)
movss 144(%esp), %xmm0
movss %xmm0, (%esp)
call fminf
emms
fstps 212(%esp)
movss 212(%esp), %xmm0
movss %xmm0, 128(%esp)
movss %xmm0, 4(%esp)
fldt 100(%esp)
fstps 232(%esp)
movss 232(%esp), %xmm0
movss %xmm0, 112(%esp)
movss %xmm0, (%esp)
call fminf
I'm not exactly sure what's going on but either
1) emms is moving after the call to fminf
2) emms is moving before the result of a previous fminf is popped from the
floating point stack and clobbering it
3) both?
Sorry for providing such a large test program but in the generated code
sometimes the emms is in the right spot and sometimes not.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list