[LLVMbugs] [Bug 23857] New: [AArch64] Sutraction interferes with umin generation

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jun 16 04:39:32 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=23857

            Bug ID: 23857
           Summary: [AArch64] Sutraction interferes with umin generation
           Product: tools
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: opt
          Assignee: unassignedbugs at nondot.org
          Reporter: silviu.baranga at arm.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 14478
  --> https://llvm.org/bugs/attachment.cgi?id=14478&action=edit
IR reproducer

The following code will not generate umin/umax instructions because of the
subtract used to compute a.

void test(unsigned char *in0,
          unsigned char *in1,
          unsigned char *out,
          unsigned n) {
  unsigned i;
  unsigned char a, b;

  for (i = 0; i < n; i++) 
  {
      a = 255 - in0[i]; // Replacing with a = in0[i] allows us to generate umin
      b = in1[i];
      out[i] = (unsigned char) (a < b ? a : b);
  }
}

Reproduce with:

clang -cc1 -triple aarch64--linux-gnueabi test.c -S -o out.s -mllvm
-force-vector-width=16 -O3 -vectorize-loops

I've also attached a.ll which contains two similar functions obtained from this
code. This shows that removing the xor (sub) operation allows us to generate
umin:

opt -O3 aa.ll -o aa1.ll -S -force-vector-width=16
bin/llc -O3 aa1.ll -o aa1.s

Found on trunk (4a867c7a05bd0560cc16b3c16286e1c76073334e), Mon Jun 15 09:19:41
2015.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150616/9bb589d9/attachment.html>


More information about the llvm-bugs mailing list