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

            Bug ID: 89229
           Summary: [7/8/9 Regression] Unnecessary ZMM in
                    movoi_internal_avx/movti_internal
           Product: gcc
           Version: 8.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hjl.tools at gmail dot com
                CC: ubizjak at gmail dot com
  Target Milestone: ---
            Target: i386,x86-64

movoi_internal_avx and movti_internal have

   (set (attr "mode")
        (cond [(ior (match_operand 0 "ext_sse_reg_operand")
                    (match_operand 1 "ext_sse_reg_operand"))
                 (const_string "XI")
               (and (eq_attr "alternative" "1")
                    (match_test "TARGET_AVX512VL"))
                 (const_string "XI")
               (ior (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL")
                    (and (eq_attr "alternative" "3")
                         (match_test "TARGET_SSE_TYPELESS_STORES")))
                 (const_string "V8SF")
              ]
              (const_string "OI")))])

But

              (and (eq_attr "alternative" "1")
                    (match_test "TARGET_AVX512VL"))
                 (const_string "XI")

is unnecessary.  As the result, we are generating

        vpternlogd      $0xFF, %zmm0, %zmm0, %zmm0

which is only needed for %xmm16 - %xmm31/%ymm16 - %ymm31, when

        vpcmpeqd        %ymm0, %ymm0, %ymm0

or

       vpcmpeqd        %xmm0, %xmm0, %xmm0

are sufficient.

Reply via email to