[PATCH] D67087: [X86] Override BuildSDIVPow2 for X86.

Dávid Bolvanský via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 4 03:49:04 PDT 2019


xbolva00 added a comment.

Playing with chars,  I think there is a way to improve -Oz codesize for this case too.

foo(char):                                # @foo(char)

  mov     eax, edi
  mov     cl, 4
  cbw
  idiv    cl
  ret

gcc with -Os
foo(char):

  mov     dl, 4
  movsx   ax, dil
  idiv    dl
  ret

with short, -Oz
foo(long):                                # @foo(long)

  mov     rax, rdi
  push    4
  pop     rcx
  cqo
  idiv    rcx
  ret


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

https://reviews.llvm.org/D67087





More information about the llvm-commits mailing list