[llvm-bugs] [Bug 40032] New: instcombine forms illegal <2 x i64> multiply with trunc/zext

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Dec 14 14:36:18 PST 2018


            Bug ID: 40032
           Summary: instcombine forms illegal <2 x i64> multiply with
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: efriedma at codeaurora.org
                CC: husseydevin at gmail.com, llvm-bugs at lists.llvm.org,
                    spatel+llvm at rotateright.com

C testcase:

#include <arm_neon.h>
typedef int64x2_t U64x2;
typedef int32x2_t U32x2;
typedef int32x4_t U32x4;
U64x2 f(U64x2 top, U64x2 bot) {
        U32x2 d2 = vmovn_u64(bot);
        U32x2 d5 = vmovn_u64(top);
        d5 = vmla_u32(d5, d2, d2);
        return vshll_n_u32(d5, 0);

On ARM, we currently end up scalarizing the multiply, instead of using the
vector operation written in the source.  (Even if we improve the expansion of
general <2 x i64 multiplies on ARM, it'll still be more expensive than the
original code. Other targets have similar issues.)

I think instcombine is being too aggressive here; I'm not sure the backend can
reasonably recover the original multiply in general.

IR testcase (for opt -instcombine):
define <2 x i64> @f(<2 x i64> %top, <2 x i64> %bot) {
  %vmovn.i = trunc <2 x i64> %bot to <2 x i32>
  %vmovn.i9 = trunc <2 x i64> %top to <2 x i32>
  %mul.i = mul <2 x i32> %vmovn.i, %vmovn.i
  %add.i = add <2 x i32> %mul.i, %vmovn.i9
  %0 = zext <2 x i32> %add.i to <2 x i64>
  ret <2 x i64> %0

Filing based on discussion in bug 39967.

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/20181214/231241a2/attachment.html>

More information about the llvm-bugs mailing list