blob: a42ea4f2e1e9faa4b18e040e2b12750c62a6be90 [file] [edit]
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6
; RUN: opt -passes=slp-vectorizer -S -mtriple=amdgpu9.0a-amd-amdhsa -slp-vectorize-hor=false -pass-remarks-output=%t < %s | FileCheck %s
; RUN: FileCheck --input-file=%t --check-prefix=YAML %s
; Pairs of lanes from both halves of eight loads need strided shuffles.
; YAML: --- !Passed
; YAML-NEXT: Pass: slp-vectorizer
; YAML-NEXT: Name: VectorizedList
; YAML-NEXT: Function: two_accumulators_f32
; YAML-NEXT: Args:
; YAML-NEXT: - String: 'SLP vectorized with cost '
; YAML-NEXT: - Cost: '-16'
; YAML-NEXT: - String: ' and with tree size '
; YAML-NEXT: - TreeSize: '17'
define float @two_accumulators_f32(ptr addrspace(1) noalias %a, ptr addrspace(1) noalias %b) {
; CHECK-LABEL: define float @two_accumulators_f32(
; CHECK-SAME: ptr addrspace(1) noalias [[A:%.*]], ptr addrspace(1) noalias [[B:%.*]]) {
; CHECK-NEXT: [[PA0:%.*]] = getelementptr float, ptr addrspace(1) [[A]], i64 0
; CHECK-NEXT: [[PB0:%.*]] = getelementptr float, ptr addrspace(1) [[B]], i64 0
; CHECK-NEXT: [[TMP1:%.*]] = load <8 x float>, ptr addrspace(1) [[PA0]], align 4
; CHECK-NEXT: [[TMP2:%.*]] = load <8 x float>, ptr addrspace(1) [[PB0]], align 4
; CHECK-NEXT: [[TMP3:%.*]] = shufflevector <8 x float> [[TMP1]], <8 x float> poison, <2 x i32> <i32 0, i32 4>
; CHECK-NEXT: [[TMP4:%.*]] = shufflevector <8 x float> [[TMP2]], <8 x float> poison, <2 x i32> <i32 0, i32 4>
; CHECK-NEXT: [[TMP5:%.*]] = fmul contract <2 x float> [[TMP3]], [[TMP4]]
; CHECK-NEXT: [[TMP6:%.*]] = shufflevector <8 x float> [[TMP1]], <8 x float> poison, <2 x i32> <i32 1, i32 5>
; CHECK-NEXT: [[TMP7:%.*]] = shufflevector <8 x float> [[TMP2]], <8 x float> poison, <2 x i32> <i32 1, i32 5>
; CHECK-NEXT: [[TMP8:%.*]] = fmul contract <2 x float> [[TMP6]], [[TMP7]]
; CHECK-NEXT: [[TMP9:%.*]] = fadd contract <2 x float> [[TMP5]], [[TMP8]]
; CHECK-NEXT: [[TMP10:%.*]] = shufflevector <8 x float> [[TMP1]], <8 x float> poison, <2 x i32> <i32 2, i32 6>
; CHECK-NEXT: [[TMP11:%.*]] = shufflevector <8 x float> [[TMP2]], <8 x float> poison, <2 x i32> <i32 2, i32 6>
; CHECK-NEXT: [[TMP12:%.*]] = fmul contract <2 x float> [[TMP10]], [[TMP11]]
; CHECK-NEXT: [[TMP13:%.*]] = fadd contract <2 x float> [[TMP9]], [[TMP12]]
; CHECK-NEXT: [[TMP14:%.*]] = shufflevector <8 x float> [[TMP1]], <8 x float> poison, <2 x i32> <i32 3, i32 7>
; CHECK-NEXT: [[TMP15:%.*]] = shufflevector <8 x float> [[TMP2]], <8 x float> poison, <2 x i32> <i32 3, i32 7>
; CHECK-NEXT: [[TMP16:%.*]] = fmul contract <2 x float> [[TMP14]], [[TMP15]]
; CHECK-NEXT: [[TMP17:%.*]] = fadd contract <2 x float> [[TMP13]], [[TMP16]]
; CHECK-NEXT: [[TMP18:%.*]] = extractelement <2 x float> [[TMP17]], i64 0
; CHECK-NEXT: [[TMP19:%.*]] = extractelement <2 x float> [[TMP17]], i64 1
; CHECK-NEXT: [[J1:%.*]] = fadd contract float [[TMP18]], [[TMP19]]
; CHECK-NEXT: ret float [[J1]]
;
%pa0 = getelementptr float, ptr addrspace(1) %a, i64 0
%a0 = load float, ptr addrspace(1) %pa0, align 4
%pb0 = getelementptr float, ptr addrspace(1) %b, i64 0
%b0 = load float, ptr addrspace(1) %pb0, align 4
%m0 = fmul contract float %a0, %b0
%pa1 = getelementptr float, ptr addrspace(1) %a, i64 4
%a1 = load float, ptr addrspace(1) %pa1, align 4
%pb1 = getelementptr float, ptr addrspace(1) %b, i64 4
%b1 = load float, ptr addrspace(1) %pb1, align 4
%m1 = fmul contract float %a1, %b1
%pa2 = getelementptr float, ptr addrspace(1) %a, i64 1
%a2 = load float, ptr addrspace(1) %pa2, align 4
%pb2 = getelementptr float, ptr addrspace(1) %b, i64 1
%b2 = load float, ptr addrspace(1) %pb2, align 4
%m2 = fmul contract float %a2, %b2
%s2 = fadd contract float %m0, %m2
%pa3 = getelementptr float, ptr addrspace(1) %a, i64 5
%a3 = load float, ptr addrspace(1) %pa3, align 4
%pb3 = getelementptr float, ptr addrspace(1) %b, i64 5
%b3 = load float, ptr addrspace(1) %pb3, align 4
%m3 = fmul contract float %a3, %b3
%s3 = fadd contract float %m1, %m3
%pa4 = getelementptr float, ptr addrspace(1) %a, i64 2
%a4 = load float, ptr addrspace(1) %pa4, align 4
%pb4 = getelementptr float, ptr addrspace(1) %b, i64 2
%b4 = load float, ptr addrspace(1) %pb4, align 4
%m4 = fmul contract float %a4, %b4
%s4 = fadd contract float %s2, %m4
%pa5 = getelementptr float, ptr addrspace(1) %a, i64 6
%a5 = load float, ptr addrspace(1) %pa5, align 4
%pb5 = getelementptr float, ptr addrspace(1) %b, i64 6
%b5 = load float, ptr addrspace(1) %pb5, align 4
%m5 = fmul contract float %a5, %b5
%s5 = fadd contract float %s3, %m5
%pa6 = getelementptr float, ptr addrspace(1) %a, i64 3
%a6 = load float, ptr addrspace(1) %pa6, align 4
%pb6 = getelementptr float, ptr addrspace(1) %b, i64 3
%b6 = load float, ptr addrspace(1) %pb6, align 4
%m6 = fmul contract float %a6, %b6
%s6 = fadd contract float %s4, %m6
%pa7 = getelementptr float, ptr addrspace(1) %a, i64 7
%a7 = load float, ptr addrspace(1) %pa7, align 4
%pb7 = getelementptr float, ptr addrspace(1) %b, i64 7
%b7 = load float, ptr addrspace(1) %pb7, align 4
%m7 = fmul contract float %a7, %b7
%s7 = fadd contract float %s5, %m7
%j1 = fadd contract float %s6, %s7
ret float %j1
}