[PATCH] D100491: [X86] combineCMP - fold cmpEQ/NE(TRUNC(X),0) -> cmpEQ/NE(X,0)

Pengfei Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 15 05:24:06 PDT 2021


pengfei accepted this revision.
pengfei added a comment.
This revision is now accepted and ready to land.

LGTM.



================
Comment at: llvm/test/CodeGen/X86/and-with-overflow.ll:66
 ; X86-NEXT:    andl $-17, %ecx
 ; X86-NEXT:    testw %cx, %cx
 ; X86-NEXT:    je .LBB2_2
----------------
RKSimon wrote:
> pengfei wrote:
> > Why is this test still kept?
> Because i686 hasn't made use of the zeroext %0 tag, its become:
> 
> i32,ch = load<(load 2 from %fixed-stack.1, align 4), anyext from i16> t0, FrameIndex:i32<-1>, undef:i32
> 
> so known bits doesn't know the upper i16 should be zero.
I see, sounds like an optimization. By the way, PR49028 can generate a movzwl under i686.
Anyway, here the `testw` is necessary in this circumstances.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100491



More information about the llvm-commits mailing list