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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]

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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to