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

--- Comment #14 from Li Pan <pan2.li at intel dot com> ---
Hi Uroš,

> Please note two new instructions in the second asm dump. These are expanded
> from .SAT_TRUNC and are not present in the first asm dump.

> The problem here is that the presence of ustrunc{m}{n}2 optab in i386.md 
> prevents some optimization involving .MIN_EXPR that would result in better 
> code.

Would like to double confirm with you if vector mode of ustrunc{m}{n}2 has
similar issue like this. If not,  add single_use to match.pd may also effect on
vector.

For example, in RVV we may have a similar insn layout.

<bb 5> [local count: 536870912]:
_18 = MIN_EXPR <left_8, 4294967295>;  // vminu
iftmp.0_11 = (unsigned int) _18;      // vcvt
stream.avail_out = iftmp.0_11;        // vmv
left_37 = left_8 - _18;               // vsub

while .SAT_TRUNC somehow interferes with this optimization to produce:

<bb 5> [local count: 536870912]:
_45 = MIN_EXPR <left_8, 4294967295>;  // vminu
iftmp.0_11 = .SAT_TRUNC (left_8);     // vnclipu
stream.avail_out = iftmp.0_11;        // vmv
left_37 = left_8 - _45;               // vsub

Reply via email to