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

            Bug ID: 52298
           Summary: [AArch64] Optimise xtn+xtn to uzp
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Keywords: beginner
          Severity: enhancement
          Priority: P
         Component: Backend: AArch64
          Assignee: unassignedb...@nondot.org
          Reporter: pavel.il...@arm.com
                CC: arnaud.degrandmai...@arm.com,
                    llvm-bugs@lists.llvm.org, smithp...@googlemail.com,
                    ties.st...@arm.com

Optimise truncate operations with a hi/lo pair into a single permute of half
the bit size of the input and just ignoring the top bits (which are truncated
out).

void d2 (short * restrict a, int *b, int n) {
    for (int i = 0; i < n; i++)
        a[i] = b[i];
}

clang -O3 generates
 ldp q0, q1, [x9, #-16]
 add x9, x9, #32
 subs x8, x8, #8
 xtn v0.4h, v0.4s
 xtn v1.4h, v1.4s
 stur d0, [x10, #-8]
 str d1, [x10], #16
 b.ne .LBB0_2

gcc -O3 combines the two `xtn`s into a `uzp`
 ldp q0, q1, [x1]
 add x1, x1, 32
 uzp1 v0.8h, v0.8h, v1.8h
 str q0, [x0], 16
 cmp x1, x2
 bne .L3
https://godbolt.org/z/dYozq6GPh

gcc commit
https://github.com/gcc-mirror/gcc/commit/52da40ffe2aaf086f622e513cc99a64bc7573a67#diff-e55f82ad6f42cf1df30ab3fffeba1fd00aea748d04e231dda6f247b5c7e1c35a

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to