https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128283

--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-15 branch has been updated by Uros Bizjak <[email protected]>:

https://gcc.gnu.org/g:90857bebc50a228b121f817d5efac6ed0bfd2573

commit r15-11716-g90857bebc50a228b121f817d5efac6ed0bfd2573
Author: Uros Bizjak <[email protected]>
Date:   Mon Nov 2 22:05:48 2026 +0100

    i386: Add "memory" clobber to SGX and PCONFIG intrinsics [PR128283]

    The ENCLS, ENCLU, ENCLV and PCONFIG inline asm wrappers pass pointers
    to buffers in general registers, but do not declare that the
    instructions access memory.  As a result, DSE can remove stores that
    initialize the input structures and FRE can fold loads from the output
    buffers.  Add "memory" to the clobber list of all of them.

    Also add the missing "cc" clobber to __encls_edbgrd, since EDBGRD
    modifies the status flags, and remove the superfluous "\n\t" from the
    end of the asm templates.

            PR target/128283

    gcc/ChangeLog:

            * config/i386/sgxintrin.h (__encls_bc, __encls_bcd, __encls_c)
            (__encls_edbgrd, __encls_generic, __enclu_bc, __enclu_bcd)
            (__enclu_eenter, __enclu_eexit, __enclu_generic, __enclv_bc)
            (__enclv_cd, __enclv_generic): Add "memory" clobber.
            Remove "\n\t" from asm template.
            (__encls_edbgrd): Also add "cc" clobber.
            * config/i386/pconfigintrin.h (__pconfig_b, __pconfig_generic):
            Add "memory" clobber.  Remove "\n\t" from asm template.

    gcc/testsuite/ChangeLog:

            * gcc.target/i386/pr128283-1.c: New test.
            * gcc.target/i386/pr128283-2.c: Ditto.

    (cherry picked from commit 79cd72f94d73ccc5095a9291c10a32b9965d0f77)

Reply via email to