; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \
; RUN:   -disable-auto-paired-vec-st=false -ppc-asm-full-reg-names \
; RUN:   -ppc-vsr-nums-as-vr -mcpu=future < %s | FileCheck %s
; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-aix \
; RUN:   -disable-auto-paired-vec-st=false -ppc-asm-full-reg-names \
; RUN:   -ppc-vsr-nums-as-vr -mcpu=future < %s | FileCheck %s --check-prefix=AIX
; RUN: llc -verify-machineinstrs -mtriple=powerpc-unknown-aix \
; RUN:   -disable-auto-paired-vec-st=false -ppc-asm-full-reg-names \
; RUN:   -ppc-vsr-nums-as-vr -mcpu=future < %s | FileCheck %s --check-prefix=AIX32

declare void @dummy_func()
declare <2048 x i1> @llvm.ppc.mma.dmsha3hash(<2048 x i1>, i32)

define dso_local void @test_dmsha3hash(ptr %vopp, ptr %resp) nounwind {
; CHECK-LABEL: test_dmsha3hash:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    mflr r0
; CHECK-NEXT:    std r0, 16(r1)
; CHECK-NEXT:    stdu r1, -304(r1)
; CHECK-NEXT:    std r30, 288(r1) # 8-byte Folded Spill
; CHECK-NEXT:    lxvp vsp34, 0(r3)
; CHECK-NEXT:    lxvp vsp36, 32(r3)
; CHECK-NEXT:    lxvp vsp32, 64(r3)
; CHECK-NEXT:    lxvp vsp38, 96(r3)
; CHECK-NEXT:    lxvp vsp40, 128(r3)
; CHECK-NEXT:    lxvp vsp42, 160(r3)
; CHECK-NEXT:    lxvp vsp44, 192(r3)
; CHECK-NEXT:    lxvp vsp46, 224(r3)
; CHECK-NEXT:    dmxxinstdmr512 wacc_hi1, vsp36, vsp34, 1
; CHECK-NEXT:    dmxxinstdmr512 wacc1, vsp38, vsp32, 0
; CHECK-NEXT:    dmxxinstdmr512 wacc_hi0, vsp42, vsp40, 1
; CHECK-NEXT:    dmxxinstdmr512 wacc0, vsp46, vsp44, 0
; CHECK-NEXT:    dmsha3hash dmrp0, 5
; CHECK-NEXT:    dmxxextfdmr512 vsp36, vsp34, wacc1, 0
; CHECK-NEXT:    stxvp vsp36, 128(r1)
; CHECK-NEXT:    stxvp vsp34, 96(r1)
; CHECK-NEXT:    dmxxextfdmr512 vsp36, vsp34, wacc_hi1, 1
; CHECK-NEXT:    stxvp vsp36, 64(r1)
; CHECK-NEXT:    stxvp vsp34, 32(r1)
; CHECK-NEXT:    dmxxextfdmr512 vsp36, vsp34, wacc0, 0
; CHECK-NEXT:    stxvp vsp36, 256(r1)
; CHECK-NEXT:    stxvp vsp34, 224(r1)
; CHECK-NEXT:    dmxxextfdmr512 vsp36, vsp34, wacc_hi0, 1
; CHECK-NEXT:    mr r30, r4
; CHECK-NEXT:    stxvp vsp36, 192(r1)
; CHECK-NEXT:    stxvp vsp34, 160(r1)
; CHECK-NEXT:    bl dummy_func@notoc
; CHECK-NEXT:    lxvp vsp34, 128(r1)
; CHECK-NEXT:    lxvp vsp36, 96(r1)
; CHECK-NEXT:    dmxxinstdmr512 wacc1, vsp34, vsp36, 0
; CHECK-NEXT:    lxvp vsp34, 64(r1)
; CHECK-NEXT:    lxvp vsp36, 32(r1)
; CHECK-NEXT:    dmxxinstdmr512 wacc_hi1, vsp34, vsp36, 1
; CHECK-NEXT:    lxvp vsp34, 256(r1)
; CHECK-NEXT:    lxvp vsp36, 224(r1)
; CHECK-NEXT:    dmxxinstdmr512 wacc0, vsp34, vsp36, 0
; CHECK-NEXT:    lxvp vsp34, 192(r1)
; CHECK-NEXT:    lxvp vsp36, 160(r1)
; CHECK-NEXT:    dmxxinstdmr512 wacc_hi0, vsp34, vsp36, 1
; CHECK-NEXT:    dmxxextfdmr512 vsp34, vsp36, wacc0, 0
; CHECK-NEXT:    stxvp vsp34, 224(r30)
; CHECK-NEXT:    stxvp vsp36, 192(r30)
; CHECK-NEXT:    dmxxextfdmr512 vsp34, vsp36, wacc_hi0, 1
; CHECK-NEXT:    stxvp vsp34, 160(r30)
; CHECK-NEXT:    stxvp vsp36, 128(r30)
; CHECK-NEXT:    dmxxextfdmr512 vsp34, vsp36, wacc1, 0
; CHECK-NEXT:    stxvp vsp34, 96(r30)
; CHECK-NEXT:    stxvp vsp36, 64(r30)
; CHECK-NEXT:    dmxxextfdmr512 vsp34, vsp36, wacc_hi1, 1
; CHECK-NEXT:    stxvp vsp34, 32(r30)
; CHECK-NEXT:    stxvp vsp36, 0(r30)
; CHECK-NEXT:    ld r30, 288(r1) # 8-byte Folded Reload
; CHECK-NEXT:    addi r1, r1, 304
; CHECK-NEXT:    ld r0, 16(r1)
; CHECK-NEXT:    mtlr r0
; CHECK-NEXT:    blr
;
; AIX-LABEL: test_dmsha3hash:
; AIX:       # %bb.0: # %entry
; AIX-NEXT:    mflr r0
; AIX-NEXT:    std r0, 16(r1)
; AIX-NEXT:    stdu r1, -384(r1)
; AIX-NEXT:    std r31, 376(r1) # 8-byte Folded Spill
; AIX-NEXT:    lxvp vsp34, 224(r3)
; AIX-NEXT:    lxvp vsp36, 192(r3)
; AIX-NEXT:    lxvp vsp32, 160(r3)
; AIX-NEXT:    lxvp vsp38, 128(r3)
; AIX-NEXT:    lxvp vsp40, 96(r3)
; AIX-NEXT:    lxvp vsp42, 64(r3)
; AIX-NEXT:    lxvp vsp44, 32(r3)
; AIX-NEXT:    lxvp vsp46, 0(r3)
; AIX-NEXT:    dmxxinstdmr512 wacc_hi1, vsp36, vsp34, 1
; AIX-NEXT:    dmxxinstdmr512 wacc1, vsp38, vsp32, 0
; AIX-NEXT:    dmxxinstdmr512 wacc_hi0, vsp42, vsp40, 1
; AIX-NEXT:    dmxxinstdmr512 wacc0, vsp46, vsp44, 0
; AIX-NEXT:    dmsha3hash dmrp0, 5
; AIX-NEXT:    dmxxextfdmr512 vsp36, vsp34, wacc1, 0
; AIX-NEXT:    stxvp vsp36, 112(r1)
; AIX-NEXT:    stxvp vsp34, 144(r1)
; AIX-NEXT:    dmxxextfdmr512 vsp36, vsp34, wacc_hi1, 1
; AIX-NEXT:    stxvp vsp36, 176(r1)
; AIX-NEXT:    stxvp vsp34, 208(r1)
; AIX-NEXT:    dmxxextfdmr512 vsp36, vsp34, wacc0, 0
; AIX-NEXT:    stxvp vsp36, 240(r1)
; AIX-NEXT:    stxvp vsp34, 272(r1)
; AIX-NEXT:    dmxxextfdmr512 vsp36, vsp34, wacc_hi0, 1
; AIX-NEXT:    mr r31, r4
; AIX-NEXT:    stxvp vsp36, 304(r1)
; AIX-NEXT:    stxvp vsp34, 336(r1)
; AIX-NEXT:    bl .dummy_func[PR]
; AIX-NEXT:    nop
; AIX-NEXT:    lxvp vsp34, 112(r1)
; AIX-NEXT:    lxvp vsp36, 144(r1)
; AIX-NEXT:    dmxxinstdmr512 wacc1, vsp34, vsp36, 0
; AIX-NEXT:    lxvp vsp34, 176(r1)
; AIX-NEXT:    lxvp vsp36, 208(r1)
; AIX-NEXT:    dmxxinstdmr512 wacc_hi1, vsp34, vsp36, 1
; AIX-NEXT:    lxvp vsp34, 240(r1)
; AIX-NEXT:    lxvp vsp36, 272(r1)
; AIX-NEXT:    dmxxinstdmr512 wacc0, vsp34, vsp36, 0
; AIX-NEXT:    lxvp vsp34, 304(r1)
; AIX-NEXT:    lxvp vsp36, 336(r1)
; AIX-NEXT:    dmxxinstdmr512 wacc_hi0, vsp34, vsp36, 1
; AIX-NEXT:    dmxxextfdmr512 vsp34, vsp36, wacc_hi1, 1
; AIX-NEXT:    stxvp vsp36, 224(r31)
; AIX-NEXT:    stxvp vsp34, 192(r31)
; AIX-NEXT:    dmxxextfdmr512 vsp34, vsp36, wacc1, 0
; AIX-NEXT:    stxvp vsp36, 160(r31)
; AIX-NEXT:    stxvp vsp34, 128(r31)
; AIX-NEXT:    dmxxextfdmr512 vsp34, vsp36, wacc_hi0, 1
; AIX-NEXT:    stxvp vsp36, 96(r31)
; AIX-NEXT:    stxvp vsp34, 64(r31)
; AIX-NEXT:    dmxxextfdmr512 vsp34, vsp36, wacc0, 0
; AIX-NEXT:    stxvp vsp36, 32(r31)
; AIX-NEXT:    stxvp vsp34, 0(r31)
; AIX-NEXT:    ld r31, 376(r1) # 8-byte Folded Reload
; AIX-NEXT:    addi r1, r1, 384
; AIX-NEXT:    ld r0, 16(r1)
; AIX-NEXT:    mtlr r0
; AIX-NEXT:    blr
;
; AIX32-LABEL: test_dmsha3hash:
; AIX32:       # %bb.0: # %entry
; AIX32-NEXT:    mflr r0
; AIX32-NEXT:    stw r0, 8(r1)
; AIX32-NEXT:    stwu r1, -336(r1)
; AIX32-NEXT:    stw r31, 332(r1) # 4-byte Folded Spill
; AIX32-NEXT:    lxvp vsp34, 224(r3)
; AIX32-NEXT:    lxvp vsp36, 192(r3)
; AIX32-NEXT:    lxvp vsp32, 160(r3)
; AIX32-NEXT:    lxvp vsp38, 128(r3)
; AIX32-NEXT:    lxvp vsp40, 96(r3)
; AIX32-NEXT:    lxvp vsp42, 64(r3)
; AIX32-NEXT:    lxvp vsp44, 32(r3)
; AIX32-NEXT:    lxvp vsp46, 0(r3)
; AIX32-NEXT:    dmxxinstdmr512 wacc_hi1, vsp36, vsp34, 1
; AIX32-NEXT:    dmxxinstdmr512 wacc1, vsp38, vsp32, 0
; AIX32-NEXT:    dmxxinstdmr512 wacc_hi0, vsp42, vsp40, 1
; AIX32-NEXT:    dmxxinstdmr512 wacc0, vsp46, vsp44, 0
; AIX32-NEXT:    dmsha3hash dmrp0, 5
; AIX32-NEXT:    dmxxextfdmr512 vsp36, vsp34, wacc1, 0
; AIX32-NEXT:    stxvp vsp36, 64(r1)
; AIX32-NEXT:    stxvp vsp34, 96(r1)
; AIX32-NEXT:    dmxxextfdmr512 vsp36, vsp34, wacc_hi1, 1
; AIX32-NEXT:    stxvp vsp36, 128(r1)
; AIX32-NEXT:    stxvp vsp34, 160(r1)
; AIX32-NEXT:    dmxxextfdmr512 vsp36, vsp34, wacc0, 0
; AIX32-NEXT:    stxvp vsp36, 192(r1)
; AIX32-NEXT:    stxvp vsp34, 224(r1)
; AIX32-NEXT:    dmxxextfdmr512 vsp36, vsp34, wacc_hi0, 1
; AIX32-NEXT:    mr r31, r4
; AIX32-NEXT:    stxvp vsp36, 256(r1)
; AIX32-NEXT:    stxvp vsp34, 288(r1)
; AIX32-NEXT:    bl .dummy_func[PR]
; AIX32-NEXT:    nop
; AIX32-NEXT:    lxvp vsp34, 64(r1)
; AIX32-NEXT:    lxvp vsp36, 96(r1)
; AIX32-NEXT:    dmxxinstdmr512 wacc1, vsp34, vsp36, 0
; AIX32-NEXT:    lxvp vsp34, 128(r1)
; AIX32-NEXT:    lxvp vsp36, 160(r1)
; AIX32-NEXT:    dmxxinstdmr512 wacc_hi1, vsp34, vsp36, 1
; AIX32-NEXT:    lxvp vsp34, 192(r1)
; AIX32-NEXT:    lxvp vsp36, 224(r1)
; AIX32-NEXT:    dmxxinstdmr512 wacc0, vsp34, vsp36, 0
; AIX32-NEXT:    lxvp vsp34, 256(r1)
; AIX32-NEXT:    lxvp vsp36, 288(r1)
; AIX32-NEXT:    dmxxinstdmr512 wacc_hi0, vsp34, vsp36, 1
; AIX32-NEXT:    dmxxextfdmr512 vsp34, vsp36, wacc_hi1, 1
; AIX32-NEXT:    stxvp vsp36, 224(r31)
; AIX32-NEXT:    stxvp vsp34, 192(r31)
; AIX32-NEXT:    dmxxextfdmr512 vsp34, vsp36, wacc1, 0
; AIX32-NEXT:    stxvp vsp36, 160(r31)
; AIX32-NEXT:    stxvp vsp34, 128(r31)
; AIX32-NEXT:    dmxxextfdmr512 vsp34, vsp36, wacc_hi0, 1
; AIX32-NEXT:    stxvp vsp36, 96(r31)
; AIX32-NEXT:    stxvp vsp34, 64(r31)
; AIX32-NEXT:    dmxxextfdmr512 vsp34, vsp36, wacc0, 0
; AIX32-NEXT:    stxvp vsp36, 32(r31)
; AIX32-NEXT:    stxvp vsp34, 0(r31)
; AIX32-NEXT:    lwz r31, 332(r1) # 4-byte Folded Reload
; AIX32-NEXT:    addi r1, r1, 336
; AIX32-NEXT:    lwz r0, 8(r1)
; AIX32-NEXT:    mtlr r0
; AIX32-NEXT:    blr
  entry:
    %0 = load <2048 x i1>, ptr %vopp, align 64
    %2 = tail call <2048 x i1> @llvm.ppc.mma.dmsha3hash(<2048 x i1> %0, i32 5)
    tail call void @dummy_func()
    %3 = tail call <2048 x i1> @llvm.ppc.mma.dmsha3hash(<2048 x i1> %0, i32 5)
    store <2048 x i1> %2, ptr %resp, align 64
    ret void
}
