[PATCH] D142090: [InstCombine] precommit tests for D140666

chenglin.bi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 31 21:16:50 PST 2023


bcl5980 added a comment.

In D142090#4095523 <https://reviews.llvm.org/D142090#4095523>, @inclyc wrote:

>> But we may need some more negative tests. At least one more for
>
> Add:
>
>   define i1 @masked_not_subset_notoptimized(i32 %A) {
>   ; CHECK-LABEL: @masked_not_subset_notoptimized(
>   ; CHECK-NEXT:    [[MASK1:%.*]] = and i32 [[A:%.*]], 254
>   ; CHECK-NEXT:    [[TST1:%.*]] = icmp ne i32 [[MASK1]], 252
>   ; CHECK-NEXT:    [[MASK2:%.*]] = and i32 [[A]], 253
>   ; CHECK-NEXT:    [[TST2:%.*]] = icmp ne i32 [[MASK2]], 252
>   ; CHECK-NEXT:    [[RES:%.*]] = and i1 [[TST1]], [[TST2]]
>   ; CHECK-NEXT:    ret i1 [[RES]]
>   ;
>     %mask1 = and i32 %A, 254 ; 0xfe
>     %tst1 = icmp ne i32 %mask1, 252 ; 0xfc
>     %mask2 = and i32 %A, 253 ; 0xfd
>     %tst2 = icmp ne i32 %mask2, 252 ; 0xfc
>     %res = and i1 %tst1, %tst2
>     ret i1 %res
>   }
>
>
>
>> And we need at least 1 vector test.
>
> I may not understand what you mean :(. We are doing an optimization on scalar right now?

Take a look @masked_and_notallzeroes_splat in this file.
And it's better to add a test that replace one of the value to poison for splat constant also.
Another example in recent patch D142783 <https://reviews.llvm.org/D142783>:
@dec_zext_add_nonzero_vec , @dec_zext_add_nonzero_vec_poison1


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D142090/new/

https://reviews.llvm.org/D142090



More information about the llvm-commits mailing list