[PATCH] D77387: [ARM] Fix conditions for lowering to S[LR]I

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 19 11:45:19 PDT 2020


mstorsjo added a comment.

This seems to cause misoptimizations for me:

  $ cat test.c
  void rgb16to24(const unsigned char *src, unsigned char *dst, int src_size) {
      unsigned char *d = dst;
      const unsigned short *s = (const unsigned short *)src;
      const unsigned short *end = s + src_size / 2;
  
      while (s < end) {
          unsigned short bgr = *s++;
          *d++ = ((bgr&0xF800)>>8) | ((bgr&0xF800)>>13);
          *d++ = ((bgr&0x07E0)>>3) | ((bgr&0x07E0)>> 9);
          *d++ = ((bgr&0x001F)<<3) | ((bgr&0x001F)>> 2);
      }
  }
  $ clang -target aarch64-linux-gnu -S -O3 test.c -o test.s

There's quite a bit of difference in the output of the compiler for this function caused by this patch - I haven't yet traced it and tracked down exactly which bit of it is wrong, but the testsuite that contains this code reports unexpected values.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77387





More information about the llvm-commits mailing list