Skip to content

[X86] Add pass to insert EMMS/FEMMS instructions to separate MMX and X87 states #41664

@RKSimon

Description

@RKSimon
Bugzilla Link 42319
Version trunk
OS Windows NT
Depends On #35330
Blocks #40374
CC @topperc,@efriedma-quic,@gnzlbg,@zmodem,@jyknight,@RKSimon,@nico,@rjmccall,@rnk,@rotateright

Extended Description

As discussed on https://reviews.llvm.org/D59744, we currently have no way to automatically separate MMX and x87 instructions - we rely on manual insertion of _mm_empty() (EMMS) intrinsics.

Ideally we need something like the X86VZeroUpper pass which can recognise when MMX/X87 instructions have been used, insert EMMS/FEMMS instructions where appropriate and ensure that MMX/X87 ops don't cross the barrier (see Bug #​35982).

Given the high cost of EMMS, we may want to make this pass opt-in - for example only enable it by default for the i386 ABI change (see Bug #​41029).

Metadata

Metadata

Assignees

No one assigned

    Labels

    backend:X86bugzillaIssues migrated from bugzillaobsoleteIssues with old (unsupported) versions of LLVM

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions