[llvm-bugs] [Bug 45628] New: PPC vector fails to optimize shift (used bits)

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Apr 21 03:34:23 PDT 2020


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

            Bug ID: 45628
           Summary: PPC vector fails to optimize shift (used bits)
           Product: new-bugs
           Version: trunk
          Hardware: Macintosh
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: slandden at gmail.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

https://godbolt.org/z/KZwVRg

// Type your code here, or load an example.
#include <altivec.h>

typedef vector unsigned __int128 block;
typedef vector unsigned long long vector2_u64;

block swap_with_shift(block num) {
    return num << 64 | num >> 64;
}

block swap_without_shift(block num) {
    vector unsigned long long ret;
    ret[0] = ((vector2_u64)num)[1];
    ret[1] = ((vector2_u64)num)[0];
    return (block)ret;
}

typedef unsigned __int128 u128;

u128 swap_scalar(u128 in) {
    return in << 64 | in >> 64;
}

swap_with_shift:                        # @swap_with_shift
        xxspltd 35, 34, 1
        xxswapd 34, 34
        xxlxor 0, 0, 0
        xxpermdi 35, 35, 0, 1
        xxpermdi 34, 0, 34, 1
        xxlor 34, 35, 34
        blr
        .long   0
        .quad   0
swap_without_shift:                     # @swap_without_shift
        xxswapd 34, 34
        blr
        .long   0
        .quad   0
swap_scalar:                            # @swap_scalar
        mr 5, 3
        mr 3, 4
        mr 4, 5
        blr
        .long   0
        .quad   0

-- 
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/20200421/25225a2f/attachment.html>


More information about the llvm-bugs mailing list