Hi!

> -----Original Message-----
> From: Segher Boessenkool [mailto:seg...@kernel.crashing.org]
> Sent: Monday, March 23, 2020 8:10 PM
> To: Yangfei (Felix) <felix.y...@huawei.com>
> Cc: gcc-patches@gcc.gnu.org; Zhanghaijian (A) <z.zhanghaij...@huawei.com>
> Subject: Re: [PATCH PR94026] combine missed opportunity to simplify
> comparisons with zero
> 
> Yeah, maybe not in simplify-rtx.c, hrm.  There is SELECT_CC_MODE for these
> things, and combine knows about that (not many passes do).

I modified combine emitting a simple AND operation instead of making one 
zero_extract for this scenario.  
Attached please find the new patch.  Hope this solves both of our concerns.  

gcc
+2020-03-24  Felix Yang  <felix.y...@huawei.com> 
+
+       PR rtl-optimization/94026
+       * combine.c (make_compound_operation_int): If we are have (and
+       (lshiftrt X C) M) and M is a constant that would select a field
+       of bits within an item, but not the entire word, fold this into
+       a simple AND if we are in an equality comparison.

gcc/testsuite
+2020-03-24  Felix Yang  <felix.y...@huawei.com> 
+
+       PR rtl-optimization/94026
+       * gcc.dg/pr94026.c: New test.


Thanks,
Felix

Attachment: pr94026-v1.patch
Description: pr94026-v1.patch

Reply via email to