Skip to content

No vzeroupper/vzeroall at end of x86-64 asm instructions. #1772

Description

@divVerent

Describe the bug
None of the asm files here use vzeroupper (or vzeroall), but they use ymm registers for AVX2.

Platform: e.g., x86_64 Linux
Any x86-64.

Compiler: e.g., gcc 13.2.0 (installed through nix)
Any.

mlkem-native version: e.g., v1.0.0 or main-branch
main-branch

How to reproduce
Steps to reproduce the behavior:

$ git grep vzero
$ git grep %ymm

Expected behavior
Any function that contains %ymm use needs to have a vzeroupper near its return (ideally right before restoring %rsp and %rbp).

Additional context
Without this, subsequent SSE/SSE2 operations (using %xmm registers) incur a massive performance penalty for all Intel CPUs without AVX-512. See https://community.intel.com/t5/Intel-ISA-Extensions/What-is-the-status-of-VZEROUPPER-use/m-p/1098386

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions