Steven,
The LLVM IR does not specify the rounding mode. On X86/SSE, the rounding mode of
FP operations is controlled by the mxcsr register. You can use the set/get mxcsr
intrinsic to control it (declaration below). However, there is an old bug
(#6393) which makes the LLVM scheduler schedule fp instructions past this call.
To get around this bug you will have to place the 'stmxcsr' call in an
external function, thus forcing a full barrier.
Cheers,
Nadav
Bug report:
http://llvm.org/bugs/show_bug.cgi?id=6393
Intrinsics:
declare void @llvm.x86.sse.stmxcsr(i32*) nounwind
declare void @llvm.x86.sse.ldmxcsr(i32*) nounwind
-----Original Message-----
From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On
Behalf Of Steven Obua
Sent: Saturday, July 09, 2011 20:57
To: llvmdev at cs.uiuc.edu
Subject: [LLVMdev] LLVM floating point rounding modes
Hi,
I am not sure if this is the right mailing list to ask my question, if not,
please refer me to the proper one.
Is there any support for rounding modes in LLVM floating point? I looked in the
assembler reference manual, and it doesn't seem so. I am thinking about
choosing LLVM as one of the backends for my programming language Babel-17
(www.babel-17.com). Babel-17 features interval arithmetic, which can be
implemented sub-optimally without proper rounding modes, but it would be so much
better and faster if rounding modes were provided. Are there any plans of
introducing this in LLVM or of making any IEEE guarantees concerning floating
point arithmetic?
Cheers,
Steven
_______________________________________________
LLVM Developers mailing list
LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
---------------------------------------------------------------------
Intel Israel (74) Limited
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.