[llvm-bugs] [Bug 34271] New: incorrect instruction selected for materializing 4-way add of 0x01010101

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Aug 21 18:40:09 PDT 2017


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

            Bug ID: 34271
           Summary: incorrect instruction selected for materializing 4-way
                    add of 0x01010101
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: richard-llvm at metafoo.co.uk
                CC: llvm-bugs at lists.llvm.org

We miscompile ffmpeg's mjpegenc_common.c due to a bad instruction being
selected to materialize a vector constant. Testcase:

target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

define <4 x i32> @f(<4 x i32> %a) {
  %v = add nuw nsw <4 x i32> %a, <i32 16843009, i32 16843009, i32 16843009, i32
16843009>
  ret <4 x i32> %v
}

This compiles to:

        pcmpeqd %xmm1, %xmm1
        psubd   %xmm1, %xmm0

... which computes %a + {1, 1, 1, 1}, not %a + {0x01010101, 0x01010101,
0x01010101, 0x01010101}.

-- 
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/20170822/3467aa14/attachment.html>


More information about the llvm-bugs mailing list