Page MenuHomePhabricator

[X86] Allow _MM_FROUND_CUR_DIRECTION and _MM_FROUND_NO_EXC to be used together on instructions that only support SAE and not embedded rounding.
ClosedPublic

Authored by craig.topper on Fri, Sep 6, 10:19 AM.

Details

Summary

Current for SAE instructions we only allow _MM_FROUND_CUR_DIRECTION(bit 2) or _MM_FROUND_NO_EXC(bit 3) to be used as the immediate passed to the inrinsics. But these instructions don't perform rounding so _MM_FROUND_CUR_DIRECTION is just sort of a default placeholder when you don't want to suppress exceptions. Using _MM_FROUND_NO_EXC by itself is really bit equivalent to (_MM_FROUND_NO_EXC | _MM_FROUND_TO_NEAREST_INT) since _MM_FROUND_TO_NEAREST_INT is 0. Since we aren't rounding on these instructions we should also accept (_MM_FROUND_CUR_DIRECTION | _MM_FROUND_NO_EXC) as equivalent to (_MM_FROUND_NO_EXC). icc allows this, but gcc does not.

Diff Detail

Repository
rL LLVM

Event Timeline

craig.topper created this revision.Fri, Sep 6, 10:19 AM
Herald added a project: Restricted Project. · View Herald TranscriptFri, Sep 6, 10:19 AM
RKSimon accepted this revision.Mon, Sep 9, 4:46 AM

LGTM

clang/test/Sema/builtins-x86.c
84 ↗(On Diff #219132)

Add comments explaining what these values represent

This revision is now accepted and ready to land.Mon, Sep 9, 4:46 AM
This revision was automatically updated to reflect the committed changes.