[LLVMdev] ldmxcsr reordering issue
nrotem at apple.com
Mon Jan 27 16:10:40 PST 2014
At the moment we don’t model MXCSR. We don’t even have explicit dependencies between IR floating point instructions and the instructions that set the rounding mode (like MXCSR), so arithmetic instructions are likely to be moved across calls that change the rounding mode. You can work around this problem by setting artificial barriers, such as placing your arithmetic calculations in external functions that can’t be inlined, etc.
On Jan 27, 2014, at 4:03 PM, Mikhail Lyapunov <mikhaill at microsoft.com> wrote:
> I met troubles with jitting x86 codes when using Intrinsic::x86_sse_ldmxcsr.
> The target code must execute some SSE2 instruction with DAZ/FTZ modes enabled and others with DAZ/FTZ disabled.
> I’m trying to get this by emitting LDMXCSR instructions with proper flag words.
> It appeared however that execution engine sometimes reorders these instructions with computational ones (say with Intrinsic::x86_sse2_min_pd as we have in the scenario).
> As a result, wrong floating point values are produced.
> The issue disappears when using llvm::CodeGenOpt::None instead of Default, but of course this is too big hammer for using as a workaround.
> Is it a bug, or am I missing some smart settings to prohibit reordering?
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev