https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89372
Bug ID: 89372 Summary: Incorrect PMULHRSW Product: gcc Version: 9.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 sse.md has (define_mode_iterator PMULHRSW [V4HI V8HI (V16HI "TARGET_AVX2")]) (define_expand "<ssse3_avx2>_pmulhrsw<mode>3_mask" [(set (match_operand:PMULHRSW 0 "register_operand") (vec_merge:PMULHRSW (truncate:PMULHRSW (lshiftrt:<ssedoublemode> (plus:<ssedoublemode> (lshiftrt:<ssedoublemode> (mult:<ssedoublemode> (sign_extend:<ssedoublemode> (match_operand:PMULHRSW 1 "nonimmediate_operand")) (sign_extend:<ssedoublemode> (match_operand:PMULHRSW 2 "nonimmediate_operand"))) (const_int 14)) (match_dup 5)) (const_int 1))) (match_operand:PMULHRSW 3 "register_operand") (match_operand:<avx512fmaskmode> 4 "register_operand")))] "TARGET_AVX512BW && TARGET_AVX512VL" { operands[5] = CONST1_RTX(<MODE>mode); ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands); }) But AVX512BW doesn't support V4HI. (define_expand "<ssse3_avx2>_pmulhrsw<mode>3" [(set (match_operand:PMULHRSW 0 "register_operand") (truncate:PMULHRSW (lshiftrt:<ssedoublemode> (plus:<ssedoublemode> (lshiftrt:<ssedoublemode> (mult:<ssedoublemode> (sign_extend:<ssedoublemode> (match_operand:PMULHRSW 1 "nonimmediate_operand")) (sign_extend:<ssedoublemode> (match_operand:PMULHRSW 2 "nonimmediate_operand"))) (const_int 14)) (match_dup 3)) (const_int 1))))] "TARGET_AVX2" { operands[3] = CONST1_RTX(<MODE>mode); ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands); }) But V4HI V8HI doesn't require AVX2.