[Bug target/96246] [AVX512] unefficient code generatation for vpblendm*

crazylht at gmail dot com gcc-bugzilla@gcc.gnu.org
Mon Jul 20 07:55:25 GMT 2020


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

--- Comment #2 from Hongtao.liu <crazylht at gmail dot com> ---
(In reply to Richard Biener from comment #1)
> With -mavx2 it works:
> 
>         vpcmpgtd        %ymm1, %ymm0, %ymm0
>         vpblendvb       %ymm0, %ymm2, %ymm3, %ymm0
> 
> not sure how _load<mode> comes into play - we expand from
<avx512>_load<mode>_mask have same rtx pattern as <avx512>_blendm<mode>_, the
only difference is constraint(_load<mode>_mask has '0C' for second constraint)

---
1057 (define_insn "<avx512>_load<mode>_mask"
 1058   [(set (match_operand:V48_AVX512VL 0 "register_operand" "=v,v")
 1059         (vec_merge:V48_AVX512VL
 1060           (match_operand:V48_AVX512VL 1 "nonimmediate_operand" "v,m")
 1061           (match_operand:V48_AVX512VL 2 "nonimm_or_0_operand" "0C,0C")
 1062           (match_operand:<avx512fmaskmode> 3 "register_operand"
"Yk,Yk")))]

...


 1159 (define_insn "<avx512>_blendm<mode>"
 1160   [(set (match_operand:V48_AVX512VL 0 "register_operand" "=v")
 1161         (vec_merge:V48_AVX512VL
 1162           (match_operand:V48_AVX512VL 2 "nonimmediate_operand" "vm")
 1163           (match_operand:V48_AVX512VL 1 "register_operand" "v")
 1164           (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")))]

---
because <avx512>_load<mode>_mask existed early(in line 1057) than
<avx512>_blendm<mode> (in line 1159) in md file, after expand, the pattern is
always recognized as <avx512>_load<mode>_mask, and pass_reload will only match
'0' constraint and missed for 'v' constraint.
> 
> 
>   <bb 2> [local count: 1073741824]:
>   _6 = .VCOND (a_2(D), b_3(D), c_4(D), d_5(D), 109);
>   return _6;


More information about the Gcc-bugs mailing list