[LLVMdev] Stange behavior in fp arithmetics on x86 (bug possibly)

Tim Northover t.p.northover at gmail.com
Tue Oct 7 11:26:21 PDT 2014

Hi Dmitry,

On 7 October 2014 10:50, Dmitry Borisenkov <d.borisenkov at samsung.com> wrote:
> fpfail.s:26: Error: invalid instruction suffix for `ret'
> I downloaded Intel manual and haven’t found any mention of retl instruction,

"retl" is the AT&T syntax for the normal "ret" instruction in the
Intel manual, which makes it mostly undocumented.

> The exit code is 0. This is correct for Intel 80-bit floats but wrong for
> doubles. What am I do wrong or this is actually a bug or even worse –
> correct behavior?

I think the default CPU used by llc was changed between 3.4 and 3.5.
Before, we defaulted to the host's CPU (from memory), but now we pick
a lowest common denominator "generic", which doesn't support SSE.

When the IR comes from Clang, I believe we define the
"FLT_EVAL_METHOD" macro to be 2 in this case (see C99,
which signals that operations are performed at "long double" precision
and the outcome you see is permitted.

So I *think* this is OK, unless I'm misunderstanding one of the specs involved.



More information about the llvm-dev mailing list