[PATCH] D142345: [X86] Transform `(icmp eq/ne Abs(A), Pow2)` -> `(and/or (icmp eq/ne A,Pow2), (icmp eq/ne A,-Pow2))`

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 27 20:34:36 PST 2023


goldstein.w.n marked an inline comment as done.
goldstein.w.n added inline comments.


================
Comment at: llvm/test/CodeGen/X86/icmp-pow2-logic-npow2.ll:11-30
 define i1 @eq_pow_or(i32 %0) nounwind {
 ; X86-LABEL: eq_pow_or:
 ; X86:       # %bb.0:
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
 ; X86-NEXT:    addl $32, %eax
 ; X86-NEXT:    testl $-65, %eax
 ; X86-NEXT:    sete %al
----------------
pengfei wrote:
> goldstein.w.n wrote:
> > pengfei wrote:
> > > So we may remove these tests instead? We should avoid to add dud tests.
> > > So we may remove these tests instead? We should avoid to add dud tests.
> > 
> > This test is for `D142344` where it is not a dud.
> > Do you mean `abs_eq_pow2_zero` and `abs_ne_pow2_signed_min`?
> Yes. Sorry for the mistake.
> Yes. Sorry for the mistake.




================
Comment at: llvm/test/CodeGen/X86/icmp-pow2-logic-npow2.ll:11-30
 define i1 @eq_pow_or(i32 %0) nounwind {
 ; X86-LABEL: eq_pow_or:
 ; X86:       # %bb.0:
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
 ; X86-NEXT:    addl $32, %eax
 ; X86-NEXT:    testl $-65, %eax
 ; X86-NEXT:    sete %al
----------------
goldstein.w.n wrote:
> pengfei wrote:
> > goldstein.w.n wrote:
> > > pengfei wrote:
> > > > So we may remove these tests instead? We should avoid to add dud tests.
> > > > So we may remove these tests instead? We should avoid to add dud tests.
> > > 
> > > This test is for `D142344` where it is not a dud.
> > > Do you mean `abs_eq_pow2_zero` and `abs_ne_pow2_signed_min`?
> > Yes. Sorry for the mistake.
> > Yes. Sorry for the mistake.
> 
> 
> So we may remove these tests instead? We should avoid to add dud tests.

Removed those, although did add a few other tests for negative cases that were missing.
Unlike the 0/intmin case, they can actually catch a bug, but lmk if I should drop them.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142345



More information about the llvm-commits mailing list