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

--- Comment #18 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by hongtao Liu <liuho...@gcc.gnu.org>:

https://gcc.gnu.org/g:9a90b311f22956addaf4f5f9bdb3592afd45083f

commit r12-1253-g9a90b311f22956addaf4f5f9bdb3592afd45083f
Author: liuhongt <hongtao....@intel.com>
Date:   Tue Jun 1 09:09:44 2021 +0800

    Fix _mm256_zeroupper by representing the instructions as call_insns in
which the call has a special vzeroupper ABI.

    When __builtin_ia32_vzeroupper is called explicitly, the corresponding
    vzeroupper pattern does not carry any CLOBBERS or SETs before LRA,
    which leads to incorrect optimization in pass_reload. In order to
    solve this problem, this patch refine instructions as call_insns in
    which the call has a special vzeroupper ABI.

    gcc/ChangeLog:

            PR target/82735
            * config/i386/i386-expand.c (ix86_expand_builtin): Remove
            assignment of cfun->machine->has_explicit_vzeroupper.
            * config/i386/i386-features.c
            (ix86_add_reg_usage_to_vzerouppers): Delete.
            (ix86_add_reg_usage_to_vzeroupper): Ditto.
            (rest_of_handle_insert_vzeroupper): Remove
            ix86_add_reg_usage_to_vzerouppers, add df_analyze at the end
            of the function.
            (gate): Remove cfun->machine->has_explicit_vzeroupper.
            * config/i386/i386-protos.h (ix86_expand_avx_vzeroupper):
            Declared.
            * config/i386/i386.c (ix86_insn_callee_abi): New function.
            (ix86_initialize_callee_abi): Ditto.
            (ix86_expand_avx_vzeroupper): Ditto.
            (ix86_hard_regno_call_part_clobbered): Adjust for vzeroupper
            ABI.
            (TARGET_INSN_CALLEE_ABI): Define as ix86_insn_callee_abi.
            (ix86_emit_mode_set): Call ix86_expand_avx_vzeroupper
            directly.
            * config/i386/i386.h (struct GTY(()) machine_function): Delete
            has_explicit_vzeroupper.
            * config/i386/i386.md (enum unspec): New member
            UNSPEC_CALLEE_ABI.
            (ABI_DEFAULT,ABI_VZEROUPPER,ABI_UNKNOWN): New
            define_constants for insn callee abi index.
            * config/i386/predicates.md (vzeroupper_pattern): Adjust.
            * config/i386/sse.md (UNSPECV_VZEROUPPER): Deleted.
            (avx_vzeroupper): Call ix86_expand_avx_vzeroupper.
            (*avx_vzeroupper): Rename to ..
            (avx_vzeroupper_callee_abi): .. this, and adjust pattern as
            call_insn which has a special vzeroupper ABI.
            (*avx_vzeroupper_1): Deleted.

    gcc/testsuite/ChangeLog:

            PR target/82735
            * gcc.target/i386/pr82735-1.c: New test.
            * gcc.target/i386/pr82735-2.c: New test.
            * gcc.target/i386/pr82735-3.c: New test.
            * gcc.target/i386/pr82735-4.c: New test.
            * gcc.target/i386/pr82735-5.c: New test.

Reply via email to