[PATCH] D101074: [X86] Canonicalize LT/GT compares with constants to use LE/GE to reduce the number of EFLAGs reads. (PR48760)

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 17 07:27:08 PDT 2021


RKSimon added inline comments.


================
Comment at: llvm/test/CodeGen/X86/lack-of-signed-truncation-check.ll:601
 ; X86-NEXT:    addl $8, %eax
-; X86-NEXT:    cmpw $15, %ax
-; X86-NEXT:    seta %al
+; X86-NEXT:    cmpw $16, %ax
+; X86-NEXT:    setae %al
----------------
pengfei wrote:
> RKSimon wrote:
> > pengfei wrote:
> > > Is it possible that we happen to exceed IMM16?
> > No - we check for min/max values before decrementing/incrementing to ensure we don't wrap the value.
> I just saw you check int8 and int32. But I cannot create a case for the int16 boundary value due to its promoted to int32.
Yes i8 and i32 immediates are special cases because the width of the immediate might not match the width of the operand type - but if we're using an i16 immediate on i32/i64 it will always be extended to i32 immediate.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101074



More information about the llvm-commits mailing list