mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 03:02:36 +01:00
f6f0a5745d
We currently miss a number of opportunities to emit single-instruction VMRG[LH][BHW] instructions for shuffles on little endian subtargets. Although this in itself is not a huge performance opportunity since loading the permute vector for a VPERM can always be pulled out of loops, producing such merge instructions is useful to downstream optimizations. Since VPERM is essentially opaque to all subsequent optimizations, we want to avoid it as much as possible. Other permute instructions have semantics that can be reasoned about much more easily in later optimizations. This patch does the following: - Canonicalize shuffles so that the first element comes from the first vector (since that's what most of the mask matching functions want) - Switch the elements that come from splat vectors so that they match the corresponding elements from the other vector (to allow for merges) - Adds debugging messages for when a shuffle is matched to a VPERM so that anyone interested in improving this further can get the info for their code Differential revision: https://reviews.llvm.org/D77448
27 lines
1.1 KiB
LLVM
27 lines
1.1 KiB
LLVM
; RUN: llc -verify-machineinstrs -mcpu=pwr8 -mtriple=powerpc64le-unknown-linux-gnu < %s \
|
|
; RUN: -ppc-vsr-nums-as-vr -ppc-asm-full-reg-names | FileCheck --check-prefix=CHECK-LE \
|
|
; RUN: -implicit-check-not vmrg -implicit-check-not=vperm %s
|
|
; RUN: llc -verify-machineinstrs -mcpu=pwr8 -mtriple=powerpc64-unknown-linux-gnu < %s \
|
|
; RUN: -ppc-vsr-nums-as-vr -ppc-asm-full-reg-names | FileCheck \
|
|
; RUN: -implicit-check-not vmrg -implicit-check-not=vperm %s
|
|
|
|
define <16 x i8> @test(i32* %s, i32* %t) {
|
|
; CHECK-LE-LABEL: test:
|
|
; CHECK-LE: # %bb.0: # %entry
|
|
; CHECK-LE-NEXT: lfiwzx f0, 0, r3
|
|
; CHECK-LE-NEXT: xxspltw v2, vs0, 1
|
|
; CHECK-LE-NEXT: blr
|
|
|
|
; CHECK-LABEL: test:
|
|
; CHECK: # %bb.0: # %entry
|
|
; CHECK-NEXT: lfiwzx f0, 0, r3
|
|
; CHECK-NEXT: xxsldwi vs0, f0, f0, 1
|
|
; CHECK-NEXT: xxspltw v2, vs0, 0
|
|
; CHECK-NEXT: blr
|
|
entry:
|
|
%0 = bitcast i32* %s to <4 x i8>*
|
|
%1 = load <4 x i8>, <4 x i8>* %0, align 4
|
|
%2 = shufflevector <4 x i8> %1, <4 x i8> undef, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 0, i32 1, i32 2, i32 3, i32 0, i32 1, i32 2, i32 3, i32 0, i32 1, i32 2, i32 3>
|
|
ret <16 x i8> %2
|
|
}
|