From: Justin Hibbits Date: Mon, 6 Apr 2020 15:08:02 +0000 (-0500) Subject: PowerPC: Don't hoist float multiply + add to fused operation on SPE X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f43b2285815961da057af1a772bc31d0152d286b;p=platform%2Fupstream%2Fllvm.git PowerPC: Don't hoist float multiply + add to fused operation on SPE SPE doesn't have a fmadd instruction, so don't bother hoisting a multiply and add sequence to this, as it'd become just a library call. Hoisting happens too late for the CTR usability test to veto using the CTR in a loop, and results in an assert "Invalid PPC CTR loop!". --- diff --git a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp index 8e0633f..ad34785 100644 --- a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp +++ b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp @@ -16676,6 +16676,8 @@ bool PPCTargetLowering::isFMAFasterThanFMulAndFAdd(const MachineFunction &MF, bool PPCTargetLowering::isFMAFasterThanFMulAndFAdd(const Function &F, Type *Ty) const { + if (Subtarget.hasSPE()) + return false; switch (Ty->getScalarType()->getTypeID()) { case Type::FloatTyID: case Type::DoubleTyID: diff --git a/llvm/test/CodeGen/PowerPC/fma-assoc.ll b/llvm/test/CodeGen/PowerPC/fma-assoc.ll index 1c21c87..94cbb0c 100644 --- a/llvm/test/CodeGen/PowerPC/fma-assoc.ll +++ b/llvm/test/CodeGen/PowerPC/fma-assoc.ll @@ -9,6 +9,8 @@ ; RUN: llc -verify-machineinstrs < %s -mtriple=powerpc64-ibm-aix-xcoff \ ; RUN: -fp-contract=fast -mattr=+vsx -disable-ppc-vsx-fma-mutation=false \ ; RUN: -mcpu=pwr7 -vec-extabi | FileCheck -check-prefix=CHECK-VSX %s +; RUN: llc -verify-machineinstrs < %s -mtriple=powerpcspe-linux-unknown-gnu \ +; RUN: | FileCheck -check-prefix=CHECK-SPE %s define double @test_FMADD_ASSOC1(double %A, double %B, double %C, ; CHECK-LABEL: test_FMADD_ASSOC1: @@ -24,6 +26,22 @@ define double @test_FMADD_ASSOC1(double %A, double %B, double %C, ; CHECK-VSX-NEXT: xsmaddadp 0, 1, 2 ; CHECK-VSX-NEXT: xsadddp 1, 0, 5 ; CHECK-VSX-NEXT: blr +; +; CHECK-SPE-LABEL: test_FMADD_ASSOC1: +; CHECK-SPE: # %bb.0: +; CHECK-SPE-NEXT: evmergelo 9, 9, 10 +; CHECK-SPE-NEXT: evmergelo 7, 7, 8 +; CHECK-SPE-NEXT: evmergelo 5, 5, 6 +; CHECK-SPE-NEXT: evmergelo 3, 3, 4 +; CHECK-SPE-NEXT: efdmul 4, 7, 9 +; CHECK-SPE-NEXT: efdmul 3, 3, 5 +; CHECK-SPE-NEXT: evldd 5, 8(1) +; CHECK-SPE-NEXT: efdadd 3, 3, 4 +; CHECK-SPE-NEXT: efdadd 4, 3, 5 +; CHECK-SPE-NEXT: evmergehi 3, 4, 4 +; CHECK-SPE-NEXT: # kill: def $r4 killed $r4 killed $s4 +; CHECK-SPE-NEXT: # kill: def $r3 killed $r3 killed $s3 +; CHECK-SPE-NEXT: blr double %D, double %E) { %F = fmul double %A, %B ; [#uses=1] %G = fmul double %C, %D ; [#uses=1] @@ -46,6 +64,22 @@ define double @test_FMADD_ASSOC2(double %A, double %B, double %C, ; CHECK-VSX-NEXT: xsmaddadp 0, 1, 2 ; CHECK-VSX-NEXT: xsadddp 1, 5, 0 ; CHECK-VSX-NEXT: blr +; +; CHECK-SPE-LABEL: test_FMADD_ASSOC2: +; CHECK-SPE: # %bb.0: +; CHECK-SPE-NEXT: evmergelo 9, 9, 10 +; CHECK-SPE-NEXT: evmergelo 7, 7, 8 +; CHECK-SPE-NEXT: evmergelo 5, 5, 6 +; CHECK-SPE-NEXT: evmergelo 3, 3, 4 +; CHECK-SPE-NEXT: efdmul 4, 7, 9 +; CHECK-SPE-NEXT: efdmul 3, 3, 5 +; CHECK-SPE-NEXT: evldd 5, 8(1) +; CHECK-SPE-NEXT: efdadd 3, 3, 4 +; CHECK-SPE-NEXT: efdadd 4, 5, 3 +; CHECK-SPE-NEXT: evmergehi 3, 4, 4 +; CHECK-SPE-NEXT: # kill: def $r4 killed $r4 killed $s4 +; CHECK-SPE-NEXT: # kill: def $r3 killed $r3 killed $s3 +; CHECK-SPE-NEXT: blr double %D, double %E) { %F = fmul double %A, %B ; [#uses=1] %G = fmul double %C, %D ; [#uses=1] @@ -68,6 +102,22 @@ define double @test_FMSUB_ASSOC1(double %A, double %B, double %C, ; CHECK-VSX-NEXT: xsmaddadp 0, 1, 2 ; CHECK-VSX-NEXT: xssubdp 1, 0, 5 ; CHECK-VSX-NEXT: blr +; +; CHECK-SPE-LABEL: test_FMSUB_ASSOC1: +; CHECK-SPE: # %bb.0: +; CHECK-SPE-NEXT: evmergelo 9, 9, 10 +; CHECK-SPE-NEXT: evmergelo 7, 7, 8 +; CHECK-SPE-NEXT: evmergelo 5, 5, 6 +; CHECK-SPE-NEXT: evmergelo 3, 3, 4 +; CHECK-SPE-NEXT: efdmul 4, 7, 9 +; CHECK-SPE-NEXT: efdmul 3, 3, 5 +; CHECK-SPE-NEXT: evldd 5, 8(1) +; CHECK-SPE-NEXT: efdadd 3, 3, 4 +; CHECK-SPE-NEXT: efdsub 4, 3, 5 +; CHECK-SPE-NEXT: evmergehi 3, 4, 4 +; CHECK-SPE-NEXT: # kill: def $r4 killed $r4 killed $s4 +; CHECK-SPE-NEXT: # kill: def $r3 killed $r3 killed $s3 +; CHECK-SPE-NEXT: blr double %D, double %E) { %F = fmul double %A, %B ; [#uses=1] %G = fmul double %C, %D ; [#uses=1] @@ -90,6 +140,22 @@ define double @test_FMSUB_ASSOC2(double %A, double %B, double %C, ; CHECK-VSX-NEXT: xsmaddadp 0, 1, 2 ; CHECK-VSX-NEXT: xssubdp 1, 5, 0 ; CHECK-VSX-NEXT: blr +; +; CHECK-SPE-LABEL: test_FMSUB_ASSOC2: +; CHECK-SPE: # %bb.0: +; CHECK-SPE-NEXT: evmergelo 9, 9, 10 +; CHECK-SPE-NEXT: evmergelo 7, 7, 8 +; CHECK-SPE-NEXT: evmergelo 5, 5, 6 +; CHECK-SPE-NEXT: evmergelo 3, 3, 4 +; CHECK-SPE-NEXT: efdmul 4, 7, 9 +; CHECK-SPE-NEXT: efdmul 3, 3, 5 +; CHECK-SPE-NEXT: evldd 5, 8(1) +; CHECK-SPE-NEXT: efdadd 3, 3, 4 +; CHECK-SPE-NEXT: efdsub 4, 5, 3 +; CHECK-SPE-NEXT: evmergehi 3, 4, 4 +; CHECK-SPE-NEXT: # kill: def $r4 killed $r4 killed $s4 +; CHECK-SPE-NEXT: # kill: def $r3 killed $r3 killed $s3 +; CHECK-SPE-NEXT: blr double %D, double %E) { %F = fmul double %A, %B ; [#uses=1] %G = fmul double %C, %D ; [#uses=1] @@ -110,6 +176,21 @@ define double @test_FMADD_ASSOC_EXT1(float %A, float %B, double %C, ; CHECK-VSX-NEXT: xsmaddmdp 1, 2, 5 ; CHECK-VSX-NEXT: xsmaddadp 1, 3, 4 ; CHECK-VSX-NEXT: blr +; +; CHECK-SPE-LABEL: test_FMADD_ASSOC_EXT1: +; CHECK-SPE: # %bb.0: +; CHECK-SPE-NEXT: efsmul 3, 3, 4 +; CHECK-SPE-NEXT: evmergelo 4, 9, 10 +; CHECK-SPE-NEXT: evmergelo 7, 7, 8 +; CHECK-SPE-NEXT: efdcfs 3, 3 +; CHECK-SPE-NEXT: evmergelo 5, 5, 6 +; CHECK-SPE-NEXT: efdmul 5, 5, 7 +; CHECK-SPE-NEXT: efdadd 3, 5, 3 +; CHECK-SPE-NEXT: efdadd 4, 3, 4 +; CHECK-SPE-NEXT: evmergehi 3, 4, 4 +; CHECK-SPE-NEXT: # kill: def $r4 killed $r4 killed $s4 +; CHECK-SPE-NEXT: # kill: def $r3 killed $r3 killed $s3 +; CHECK-SPE-NEXT: blr double %D, double %E) { %F = fmul float %A, %B ; [#uses=1] %G = fpext float %F to double ; [#uses=1] @@ -132,6 +213,19 @@ define double @test_FMADD_ASSOC_EXT2(float %A, float %B, float %C, ; CHECK-VSX-NEXT: xsmaddadp 3, 1, 2 ; CHECK-VSX-NEXT: fmr 1, 3 ; CHECK-VSX-NEXT: blr +; +; CHECK-SPE-LABEL: test_FMADD_ASSOC_EXT2: +; CHECK-SPE: # %bb.0: +; CHECK-SPE-NEXT: efsmul 3, 3, 4 +; CHECK-SPE-NEXT: efsmul 4, 5, 6 +; CHECK-SPE-NEXT: efsadd 3, 3, 4 +; CHECK-SPE-NEXT: evmergelo 4, 7, 8 +; CHECK-SPE-NEXT: efdcfs 3, 3 +; CHECK-SPE-NEXT: efdadd 4, 3, 4 +; CHECK-SPE-NEXT: evmergehi 3, 4, 4 +; CHECK-SPE-NEXT: # kill: def $r4 killed $r4 killed $s4 +; CHECK-SPE-NEXT: # kill: def $r3 killed $r3 killed $s3 +; CHECK-SPE-NEXT: blr float %D, double %E) { %F = fmul float %A, %B ; [#uses=1] %G = fmul float %C, %D ; [#uses=1] @@ -153,6 +247,21 @@ define double @test_FMADD_ASSOC_EXT3(float %A, float %B, double %C, ; CHECK-VSX-NEXT: xsmaddmdp 1, 2, 5 ; CHECK-VSX-NEXT: xsmaddadp 1, 3, 4 ; CHECK-VSX-NEXT: blr +; +; CHECK-SPE-LABEL: test_FMADD_ASSOC_EXT3: +; CHECK-SPE: # %bb.0: +; CHECK-SPE-NEXT: efsmul 3, 3, 4 +; CHECK-SPE-NEXT: evmergelo 4, 9, 10 +; CHECK-SPE-NEXT: evmergelo 7, 7, 8 +; CHECK-SPE-NEXT: efdcfs 3, 3 +; CHECK-SPE-NEXT: evmergelo 5, 5, 6 +; CHECK-SPE-NEXT: efdmul 5, 5, 7 +; CHECK-SPE-NEXT: efdadd 3, 5, 3 +; CHECK-SPE-NEXT: efdadd 4, 4, 3 +; CHECK-SPE-NEXT: evmergehi 3, 4, 4 +; CHECK-SPE-NEXT: # kill: def $r4 killed $r4 killed $s4 +; CHECK-SPE-NEXT: # kill: def $r3 killed $r3 killed $s3 +; CHECK-SPE-NEXT: blr double %D, double %E) { %F = fmul float %A, %B ; [#uses=1] %G = fpext float %F to double ; [#uses=1] @@ -175,6 +284,19 @@ define double @test_FMADD_ASSOC_EXT4(float %A, float %B, float %C, ; CHECK-VSX-NEXT: xsmaddadp 3, 1, 2 ; CHECK-VSX-NEXT: fmr 1, 3 ; CHECK-VSX-NEXT: blr +; +; CHECK-SPE-LABEL: test_FMADD_ASSOC_EXT4: +; CHECK-SPE: # %bb.0: +; CHECK-SPE-NEXT: efsmul 3, 3, 4 +; CHECK-SPE-NEXT: efsmul 4, 5, 6 +; CHECK-SPE-NEXT: efsadd 3, 3, 4 +; CHECK-SPE-NEXT: evmergelo 4, 7, 8 +; CHECK-SPE-NEXT: efdcfs 3, 3 +; CHECK-SPE-NEXT: efdadd 4, 4, 3 +; CHECK-SPE-NEXT: evmergehi 3, 4, 4 +; CHECK-SPE-NEXT: # kill: def $r4 killed $r4 killed $s4 +; CHECK-SPE-NEXT: # kill: def $r3 killed $r3 killed $s3 +; CHECK-SPE-NEXT: blr float %D, double %E) { %F = fmul float %A, %B ; [#uses=1] %G = fmul float %C, %D ; [#uses=1] @@ -198,6 +320,21 @@ define double @test_FMSUB_ASSOC_EXT1(float %A, float %B, double %C, ; CHECK-VSX-NEXT: xsmaddadp 0, 3, 4 ; CHECK-VSX-NEXT: xssubdp 1, 0, 5 ; CHECK-VSX-NEXT: blr +; +; CHECK-SPE-LABEL: test_FMSUB_ASSOC_EXT1: +; CHECK-SPE: # %bb.0: +; CHECK-SPE-NEXT: efsmul 3, 3, 4 +; CHECK-SPE-NEXT: evmergelo 4, 9, 10 +; CHECK-SPE-NEXT: evmergelo 7, 7, 8 +; CHECK-SPE-NEXT: efdcfs 3, 3 +; CHECK-SPE-NEXT: evmergelo 5, 5, 6 +; CHECK-SPE-NEXT: efdmul 5, 5, 7 +; CHECK-SPE-NEXT: efdadd 3, 5, 3 +; CHECK-SPE-NEXT: efdsub 4, 3, 4 +; CHECK-SPE-NEXT: evmergehi 3, 4, 4 +; CHECK-SPE-NEXT: # kill: def $r4 killed $r4 killed $s4 +; CHECK-SPE-NEXT: # kill: def $r3 killed $r3 killed $s3 +; CHECK-SPE-NEXT: blr double %D, double %E) { %F = fmul float %A, %B ; [#uses=1] %G = fpext float %F to double ; [#uses=1] @@ -221,6 +358,19 @@ define double @test_FMSUB_ASSOC_EXT2(float %A, float %B, float %C, ; CHECK-VSX-NEXT: fmadds 0, 1, 2, 0 ; CHECK-VSX-NEXT: xssubdp 1, 0, 5 ; CHECK-VSX-NEXT: blr +; +; CHECK-SPE-LABEL: test_FMSUB_ASSOC_EXT2: +; CHECK-SPE: # %bb.0: +; CHECK-SPE-NEXT: efsmul 3, 3, 4 +; CHECK-SPE-NEXT: efsmul 4, 5, 6 +; CHECK-SPE-NEXT: efsadd 3, 3, 4 +; CHECK-SPE-NEXT: evmergelo 4, 7, 8 +; CHECK-SPE-NEXT: efdcfs 3, 3 +; CHECK-SPE-NEXT: efdsub 4, 3, 4 +; CHECK-SPE-NEXT: evmergehi 3, 4, 4 +; CHECK-SPE-NEXT: # kill: def $r4 killed $r4 killed $s4 +; CHECK-SPE-NEXT: # kill: def $r3 killed $r3 killed $s3 +; CHECK-SPE-NEXT: blr float %D, double %E) { %F = fmul float %A, %B ; [#uses=1] %G = fmul float %C, %D ; [#uses=1] @@ -244,6 +394,21 @@ define double @test_FMSUB_ASSOC_EXT3(float %A, float %B, double %C, ; CHECK-VSX-NEXT: xsmaddadp 0, 3, 4 ; CHECK-VSX-NEXT: xssubdp 1, 5, 0 ; CHECK-VSX-NEXT: blr +; +; CHECK-SPE-LABEL: test_FMSUB_ASSOC_EXT3: +; CHECK-SPE: # %bb.0: +; CHECK-SPE-NEXT: efsmul 3, 3, 4 +; CHECK-SPE-NEXT: evmergelo 4, 9, 10 +; CHECK-SPE-NEXT: evmergelo 7, 7, 8 +; CHECK-SPE-NEXT: efdcfs 3, 3 +; CHECK-SPE-NEXT: evmergelo 5, 5, 6 +; CHECK-SPE-NEXT: efdmul 5, 5, 7 +; CHECK-SPE-NEXT: efdadd 3, 5, 3 +; CHECK-SPE-NEXT: efdsub 4, 4, 3 +; CHECK-SPE-NEXT: evmergehi 3, 4, 4 +; CHECK-SPE-NEXT: # kill: def $r4 killed $r4 killed $s4 +; CHECK-SPE-NEXT: # kill: def $r3 killed $r3 killed $s3 +; CHECK-SPE-NEXT: blr double %D, double %E) { %F = fmul float %A, %B ; [#uses=1] %G = fpext float %F to double ; [#uses=1] @@ -267,6 +432,19 @@ define double @test_FMSUB_ASSOC_EXT4(float %A, float %B, float %C, ; CHECK-VSX-NEXT: fmadds 0, 1, 2, 0 ; CHECK-VSX-NEXT: xssubdp 1, 5, 0 ; CHECK-VSX-NEXT: blr +; +; CHECK-SPE-LABEL: test_FMSUB_ASSOC_EXT4: +; CHECK-SPE: # %bb.0: +; CHECK-SPE-NEXT: efsmul 3, 3, 4 +; CHECK-SPE-NEXT: efsmul 4, 5, 6 +; CHECK-SPE-NEXT: efsadd 3, 3, 4 +; CHECK-SPE-NEXT: evmergelo 4, 7, 8 +; CHECK-SPE-NEXT: efdcfs 3, 3 +; CHECK-SPE-NEXT: efdsub 4, 4, 3 +; CHECK-SPE-NEXT: evmergehi 3, 4, 4 +; CHECK-SPE-NEXT: # kill: def $r4 killed $r4 killed $s4 +; CHECK-SPE-NEXT: # kill: def $r3 killed $r3 killed $s3 +; CHECK-SPE-NEXT: blr float %D, double %E) { %F = fmul float %A, %B ; [#uses=1] %G = fmul float %C, %D ; [#uses=1] @@ -289,6 +467,22 @@ define double @test_reassoc_FMADD_ASSOC1(double %A, double %B, double %C, ; CHECK-VSX-NEXT: xsmaddadp 3, 1, 2 ; CHECK-VSX-NEXT: fmr 1, 3 ; CHECK-VSX-NEXT: blr +; +; CHECK-SPE-LABEL: test_reassoc_FMADD_ASSOC1: +; CHECK-SPE: # %bb.0: +; CHECK-SPE-NEXT: evmergelo 9, 9, 10 +; CHECK-SPE-NEXT: evmergelo 7, 7, 8 +; CHECK-SPE-NEXT: evmergelo 5, 5, 6 +; CHECK-SPE-NEXT: evmergelo 3, 3, 4 +; CHECK-SPE-NEXT: efdmul 4, 7, 9 +; CHECK-SPE-NEXT: efdmul 3, 3, 5 +; CHECK-SPE-NEXT: evldd 5, 8(1) +; CHECK-SPE-NEXT: efdadd 3, 3, 4 +; CHECK-SPE-NEXT: efdadd 4, 3, 5 +; CHECK-SPE-NEXT: evmergehi 3, 4, 4 +; CHECK-SPE-NEXT: # kill: def $r4 killed $r4 killed $s4 +; CHECK-SPE-NEXT: # kill: def $r3 killed $r3 killed $s3 +; CHECK-SPE-NEXT: blr double %D, double %E) { %F = fmul reassoc double %A, %B ; [#uses=1] %G = fmul reassoc double %C, %D ; [#uses=1] @@ -310,6 +504,22 @@ define double @test_reassoc_FMADD_ASSOC2(double %A, double %B, double %C, ; CHECK-VSX-NEXT: xsmaddadp 3, 1, 2 ; CHECK-VSX-NEXT: fmr 1, 3 ; CHECK-VSX-NEXT: blr +; +; CHECK-SPE-LABEL: test_reassoc_FMADD_ASSOC2: +; CHECK-SPE: # %bb.0: +; CHECK-SPE-NEXT: evmergelo 9, 9, 10 +; CHECK-SPE-NEXT: evmergelo 7, 7, 8 +; CHECK-SPE-NEXT: evmergelo 5, 5, 6 +; CHECK-SPE-NEXT: evmergelo 3, 3, 4 +; CHECK-SPE-NEXT: efdmul 4, 7, 9 +; CHECK-SPE-NEXT: efdmul 3, 3, 5 +; CHECK-SPE-NEXT: evldd 5, 8(1) +; CHECK-SPE-NEXT: efdadd 3, 3, 4 +; CHECK-SPE-NEXT: efdadd 4, 5, 3 +; CHECK-SPE-NEXT: evmergehi 3, 4, 4 +; CHECK-SPE-NEXT: # kill: def $r4 killed $r4 killed $s4 +; CHECK-SPE-NEXT: # kill: def $r3 killed $r3 killed $s3 +; CHECK-SPE-NEXT: blr double %D, double %E) { %F = fmul reassoc double %A, %B ; [#uses=1] %G = fmul reassoc double %C, %D ; [#uses=1] @@ -333,6 +543,22 @@ define double @test_reassoc_FMSUB_ASSOC1(double %A, double %B, double %C, ; CHECK-VSX-NEXT: xsmaddadp 0, 1, 2 ; CHECK-VSX-NEXT: xssubdp 1, 0, 5 ; CHECK-VSX-NEXT: blr +; +; CHECK-SPE-LABEL: test_reassoc_FMSUB_ASSOC1: +; CHECK-SPE: # %bb.0: +; CHECK-SPE-NEXT: evmergelo 9, 9, 10 +; CHECK-SPE-NEXT: evmergelo 7, 7, 8 +; CHECK-SPE-NEXT: evmergelo 5, 5, 6 +; CHECK-SPE-NEXT: evmergelo 3, 3, 4 +; CHECK-SPE-NEXT: efdmul 4, 7, 9 +; CHECK-SPE-NEXT: efdmul 3, 3, 5 +; CHECK-SPE-NEXT: evldd 5, 8(1) +; CHECK-SPE-NEXT: efdadd 3, 3, 4 +; CHECK-SPE-NEXT: efdsub 4, 3, 5 +; CHECK-SPE-NEXT: evmergehi 3, 4, 4 +; CHECK-SPE-NEXT: # kill: def $r4 killed $r4 killed $s4 +; CHECK-SPE-NEXT: # kill: def $r3 killed $r3 killed $s3 +; CHECK-SPE-NEXT: blr double %D, double %E) { %F = fmul reassoc double %A, %B ; [#uses=1] %G = fmul reassoc double %C, %D ; [#uses=1] @@ -354,6 +580,22 @@ define double @test_reassoc_FMSUB_ASSOC11(double %A, double %B, double %C, ; CHECK-VSX-NEXT: xsmaddadp 3, 1, 2 ; CHECK-VSX-NEXT: fmr 1, 3 ; CHECK-VSX-NEXT: blr +; +; CHECK-SPE-LABEL: test_reassoc_FMSUB_ASSOC11: +; CHECK-SPE: # %bb.0: +; CHECK-SPE-NEXT: evmergelo 9, 9, 10 +; CHECK-SPE-NEXT: evmergelo 7, 7, 8 +; CHECK-SPE-NEXT: evmergelo 5, 5, 6 +; CHECK-SPE-NEXT: evmergelo 3, 3, 4 +; CHECK-SPE-NEXT: efdmul 4, 7, 9 +; CHECK-SPE-NEXT: efdmul 3, 3, 5 +; CHECK-SPE-NEXT: evldd 5, 8(1) +; CHECK-SPE-NEXT: efdadd 3, 3, 4 +; CHECK-SPE-NEXT: efdsub 4, 3, 5 +; CHECK-SPE-NEXT: evmergehi 3, 4, 4 +; CHECK-SPE-NEXT: # kill: def $r4 killed $r4 killed $s4 +; CHECK-SPE-NEXT: # kill: def $r3 killed $r3 killed $s3 +; CHECK-SPE-NEXT: blr double %D, double %E) { %F = fmul contract reassoc double %A, %B ; [#uses=1] %G = fmul contract reassoc double %C, %D ; [#uses=1] @@ -377,6 +619,22 @@ define double @test_reassoc_FMSUB_ASSOC2(double %A, double %B, double %C, ; CHECK-VSX-NEXT: xsmaddadp 0, 1, 2 ; CHECK-VSX-NEXT: xssubdp 1, 5, 0 ; CHECK-VSX-NEXT: blr +; +; CHECK-SPE-LABEL: test_reassoc_FMSUB_ASSOC2: +; CHECK-SPE: # %bb.0: +; CHECK-SPE-NEXT: evmergelo 9, 9, 10 +; CHECK-SPE-NEXT: evmergelo 7, 7, 8 +; CHECK-SPE-NEXT: evmergelo 5, 5, 6 +; CHECK-SPE-NEXT: evmergelo 3, 3, 4 +; CHECK-SPE-NEXT: efdmul 4, 7, 9 +; CHECK-SPE-NEXT: efdmul 3, 3, 5 +; CHECK-SPE-NEXT: evldd 5, 8(1) +; CHECK-SPE-NEXT: efdadd 3, 3, 4 +; CHECK-SPE-NEXT: efdsub 4, 5, 3 +; CHECK-SPE-NEXT: evmergehi 3, 4, 4 +; CHECK-SPE-NEXT: # kill: def $r4 killed $r4 killed $s4 +; CHECK-SPE-NEXT: # kill: def $r3 killed $r3 killed $s3 +; CHECK-SPE-NEXT: blr double %D, double %E) { %F = fmul reassoc double %A, %B ; [#uses=1] %G = fmul reassoc double %C, %D ; [#uses=1] @@ -399,6 +657,22 @@ define double @test_fast_FMSUB_ASSOC2(double %A, double %B, double %C, ; CHECK-VSX-NEXT: xsmaddadp 0, 1, 2 ; CHECK-VSX-NEXT: xssubdp 1, 5, 0 ; CHECK-VSX-NEXT: blr +; +; CHECK-SPE-LABEL: test_fast_FMSUB_ASSOC2: +; CHECK-SPE: # %bb.0: +; CHECK-SPE-NEXT: evmergelo 9, 9, 10 +; CHECK-SPE-NEXT: evmergelo 7, 7, 8 +; CHECK-SPE-NEXT: evmergelo 5, 5, 6 +; CHECK-SPE-NEXT: evmergelo 3, 3, 4 +; CHECK-SPE-NEXT: efdmul 4, 7, 9 +; CHECK-SPE-NEXT: efdmul 3, 3, 5 +; CHECK-SPE-NEXT: evldd 5, 8(1) +; CHECK-SPE-NEXT: efdadd 3, 3, 4 +; CHECK-SPE-NEXT: efdsub 4, 5, 3 +; CHECK-SPE-NEXT: evmergehi 3, 4, 4 +; CHECK-SPE-NEXT: # kill: def $r4 killed $r4 killed $s4 +; CHECK-SPE-NEXT: # kill: def $r3 killed $r3 killed $s3 +; CHECK-SPE-NEXT: blr double %D, double %E) { %F = fmul reassoc double %A, %B ; [#uses=1] %G = fmul reassoc double %C, %D ; [#uses=1] @@ -419,6 +693,21 @@ define double @test_reassoc_FMADD_ASSOC_EXT1(float %A, float %B, double %C, ; CHECK-VSX-NEXT: xsmaddmdp 1, 2, 5 ; CHECK-VSX-NEXT: xsmaddadp 1, 3, 4 ; CHECK-VSX-NEXT: blr +; +; CHECK-SPE-LABEL: test_reassoc_FMADD_ASSOC_EXT1: +; CHECK-SPE: # %bb.0: +; CHECK-SPE-NEXT: efsmul 3, 3, 4 +; CHECK-SPE-NEXT: evmergelo 4, 9, 10 +; CHECK-SPE-NEXT: evmergelo 7, 7, 8 +; CHECK-SPE-NEXT: efdcfs 3, 3 +; CHECK-SPE-NEXT: evmergelo 5, 5, 6 +; CHECK-SPE-NEXT: efdmul 5, 5, 7 +; CHECK-SPE-NEXT: efdadd 3, 5, 3 +; CHECK-SPE-NEXT: efdadd 4, 3, 4 +; CHECK-SPE-NEXT: evmergehi 3, 4, 4 +; CHECK-SPE-NEXT: # kill: def $r4 killed $r4 killed $s4 +; CHECK-SPE-NEXT: # kill: def $r3 killed $r3 killed $s3 +; CHECK-SPE-NEXT: blr double %D, double %E) { %F = fmul reassoc float %A, %B ; [#uses=1] %G = fpext float %F to double ; [#uses=1] @@ -441,6 +730,19 @@ define double @test_reassoc_FMADD_ASSOC_EXT2(float %A, float %B, float %C, ; CHECK-VSX-NEXT: xsmaddadp 3, 1, 2 ; CHECK-VSX-NEXT: fmr 1, 3 ; CHECK-VSX-NEXT: blr +; +; CHECK-SPE-LABEL: test_reassoc_FMADD_ASSOC_EXT2: +; CHECK-SPE: # %bb.0: +; CHECK-SPE-NEXT: efsmul 3, 3, 4 +; CHECK-SPE-NEXT: efsmul 4, 5, 6 +; CHECK-SPE-NEXT: efsadd 3, 3, 4 +; CHECK-SPE-NEXT: evmergelo 4, 7, 8 +; CHECK-SPE-NEXT: efdcfs 3, 3 +; CHECK-SPE-NEXT: efdadd 4, 3, 4 +; CHECK-SPE-NEXT: evmergehi 3, 4, 4 +; CHECK-SPE-NEXT: # kill: def $r4 killed $r4 killed $s4 +; CHECK-SPE-NEXT: # kill: def $r3 killed $r3 killed $s3 +; CHECK-SPE-NEXT: blr float %D, double %E) { %F = fmul reassoc float %A, %B ; [#uses=1] %G = fmul reassoc float %C, %D ; [#uses=1] @@ -462,6 +764,21 @@ define double @test_reassoc_FMADD_ASSOC_EXT3(float %A, float %B, double %C, ; CHECK-VSX-NEXT: xsmaddmdp 1, 2, 5 ; CHECK-VSX-NEXT: xsmaddadp 1, 3, 4 ; CHECK-VSX-NEXT: blr +; +; CHECK-SPE-LABEL: test_reassoc_FMADD_ASSOC_EXT3: +; CHECK-SPE: # %bb.0: +; CHECK-SPE-NEXT: efsmul 3, 3, 4 +; CHECK-SPE-NEXT: evmergelo 4, 9, 10 +; CHECK-SPE-NEXT: evmergelo 7, 7, 8 +; CHECK-SPE-NEXT: efdcfs 3, 3 +; CHECK-SPE-NEXT: evmergelo 5, 5, 6 +; CHECK-SPE-NEXT: efdmul 5, 5, 7 +; CHECK-SPE-NEXT: efdadd 3, 5, 3 +; CHECK-SPE-NEXT: efdadd 4, 4, 3 +; CHECK-SPE-NEXT: evmergehi 3, 4, 4 +; CHECK-SPE-NEXT: # kill: def $r4 killed $r4 killed $s4 +; CHECK-SPE-NEXT: # kill: def $r3 killed $r3 killed $s3 +; CHECK-SPE-NEXT: blr double %D, double %E) { %F = fmul reassoc float %A, %B ; [#uses=1] %G = fpext float %F to double ; [#uses=1] @@ -484,6 +801,19 @@ define double @test_reassoc_FMADD_ASSOC_EXT4(float %A, float %B, float %C, ; CHECK-VSX-NEXT: xsmaddadp 3, 1, 2 ; CHECK-VSX-NEXT: fmr 1, 3 ; CHECK-VSX-NEXT: blr +; +; CHECK-SPE-LABEL: test_reassoc_FMADD_ASSOC_EXT4: +; CHECK-SPE: # %bb.0: +; CHECK-SPE-NEXT: efsmul 3, 3, 4 +; CHECK-SPE-NEXT: efsmul 4, 5, 6 +; CHECK-SPE-NEXT: efsadd 3, 3, 4 +; CHECK-SPE-NEXT: evmergelo 4, 7, 8 +; CHECK-SPE-NEXT: efdcfs 3, 3 +; CHECK-SPE-NEXT: efdadd 4, 4, 3 +; CHECK-SPE-NEXT: evmergehi 3, 4, 4 +; CHECK-SPE-NEXT: # kill: def $r4 killed $r4 killed $s4 +; CHECK-SPE-NEXT: # kill: def $r3 killed $r3 killed $s3 +; CHECK-SPE-NEXT: blr float %D, double %E) { %F = fmul reassoc float %A, %B ; [#uses=1] %G = fmul reassoc float %C, %D ; [#uses=1] @@ -505,6 +835,21 @@ define double @test_reassoc_FMSUB_ASSOC_EXT1(float %A, float %B, double %C, ; CHECK-VSX-NEXT: xsmsubmdp 1, 2, 5 ; CHECK-VSX-NEXT: xsmaddadp 1, 3, 4 ; CHECK-VSX-NEXT: blr +; +; CHECK-SPE-LABEL: test_reassoc_FMSUB_ASSOC_EXT1: +; CHECK-SPE: # %bb.0: +; CHECK-SPE-NEXT: efsmul 3, 3, 4 +; CHECK-SPE-NEXT: evmergelo 4, 9, 10 +; CHECK-SPE-NEXT: evmergelo 7, 7, 8 +; CHECK-SPE-NEXT: efdcfs 3, 3 +; CHECK-SPE-NEXT: evmergelo 5, 5, 6 +; CHECK-SPE-NEXT: efdmul 5, 5, 7 +; CHECK-SPE-NEXT: efdadd 3, 5, 3 +; CHECK-SPE-NEXT: efdsub 4, 3, 4 +; CHECK-SPE-NEXT: evmergehi 3, 4, 4 +; CHECK-SPE-NEXT: # kill: def $r4 killed $r4 killed $s4 +; CHECK-SPE-NEXT: # kill: def $r3 killed $r3 killed $s3 +; CHECK-SPE-NEXT: blr double %D, double %E) { %F = fmul reassoc float %A, %B ; [#uses=1] %G = fpext float %F to double ; [#uses=1] @@ -527,6 +872,19 @@ define double @test_reassoc_FMSUB_ASSOC_EXT2(float %A, float %B, float %C, ; CHECK-VSX-NEXT: xsmaddadp 3, 1, 2 ; CHECK-VSX-NEXT: fmr 1, 3 ; CHECK-VSX-NEXT: blr +; +; CHECK-SPE-LABEL: test_reassoc_FMSUB_ASSOC_EXT2: +; CHECK-SPE: # %bb.0: +; CHECK-SPE-NEXT: efsmul 3, 3, 4 +; CHECK-SPE-NEXT: efsmul 4, 5, 6 +; CHECK-SPE-NEXT: efsadd 3, 3, 4 +; CHECK-SPE-NEXT: evmergelo 4, 7, 8 +; CHECK-SPE-NEXT: efdcfs 3, 3 +; CHECK-SPE-NEXT: efdsub 4, 3, 4 +; CHECK-SPE-NEXT: evmergehi 3, 4, 4 +; CHECK-SPE-NEXT: # kill: def $r4 killed $r4 killed $s4 +; CHECK-SPE-NEXT: # kill: def $r3 killed $r3 killed $s3 +; CHECK-SPE-NEXT: blr float %D, double %E) { %F = fmul reassoc float %A, %B ; [#uses=1] %G = fmul reassoc float %C, %D ; [#uses=1] @@ -552,6 +910,21 @@ define double @test_reassoc_FMSUB_ASSOC_EXT3(float %A, float %B, double %C, ; CHECK-VSX-NEXT: xsmaddmdp 1, 2, 5 ; CHECK-VSX-NEXT: xsmaddadp 1, 0, 4 ; CHECK-VSX-NEXT: blr +; +; CHECK-SPE-LABEL: test_reassoc_FMSUB_ASSOC_EXT3: +; CHECK-SPE: # %bb.0: +; CHECK-SPE-NEXT: efsmul 3, 3, 4 +; CHECK-SPE-NEXT: evmergelo 4, 9, 10 +; CHECK-SPE-NEXT: evmergelo 7, 7, 8 +; CHECK-SPE-NEXT: efdcfs 3, 3 +; CHECK-SPE-NEXT: evmergelo 5, 5, 6 +; CHECK-SPE-NEXT: efdmul 5, 5, 7 +; CHECK-SPE-NEXT: efdadd 3, 5, 3 +; CHECK-SPE-NEXT: efdsub 4, 4, 3 +; CHECK-SPE-NEXT: evmergehi 3, 4, 4 +; CHECK-SPE-NEXT: # kill: def $r4 killed $r4 killed $s4 +; CHECK-SPE-NEXT: # kill: def $r3 killed $r3 killed $s3 +; CHECK-SPE-NEXT: blr double %D, double %E) { %F = fmul reassoc float %A, %B ; [#uses=1] %G = fpext float %F to double ; [#uses=1] @@ -575,6 +948,21 @@ define double @test_fast_FMSUB_ASSOC_EXT3(float %A, float %B, double %C, ; CHECK-VSX-NEXT: xsnmsubmdp 1, 2, 5 ; CHECK-VSX-NEXT: xsnmsubadp 1, 3, 4 ; CHECK-VSX-NEXT: blr +; +; CHECK-SPE-LABEL: test_fast_FMSUB_ASSOC_EXT3: +; CHECK-SPE: # %bb.0: +; CHECK-SPE-NEXT: efsmul 3, 3, 4 +; CHECK-SPE-NEXT: evmergelo 4, 9, 10 +; CHECK-SPE-NEXT: evmergelo 7, 7, 8 +; CHECK-SPE-NEXT: efdcfs 3, 3 +; CHECK-SPE-NEXT: evmergelo 5, 5, 6 +; CHECK-SPE-NEXT: efdmul 5, 5, 7 +; CHECK-SPE-NEXT: efdadd 3, 5, 3 +; CHECK-SPE-NEXT: efdsub 4, 4, 3 +; CHECK-SPE-NEXT: evmergehi 3, 4, 4 +; CHECK-SPE-NEXT: # kill: def $r4 killed $r4 killed $s4 +; CHECK-SPE-NEXT: # kill: def $r3 killed $r3 killed $s3 +; CHECK-SPE-NEXT: blr double %D, double %E) { %F = fmul reassoc float %A, %B %G = fpext float %F to double @@ -601,6 +989,19 @@ define double @test_reassoc_FMSUB_ASSOC_EXT4(float %A, float %B, float %C, ; CHECK-VSX-NEXT: xsmaddadp 0, 1, 2 ; CHECK-VSX-NEXT: fmr 1, 0 ; CHECK-VSX-NEXT: blr +; +; CHECK-SPE-LABEL: test_reassoc_FMSUB_ASSOC_EXT4: +; CHECK-SPE: # %bb.0: +; CHECK-SPE-NEXT: efsmul 3, 3, 4 +; CHECK-SPE-NEXT: efsmul 4, 5, 6 +; CHECK-SPE-NEXT: efsadd 3, 3, 4 +; CHECK-SPE-NEXT: evmergelo 4, 7, 8 +; CHECK-SPE-NEXT: efdcfs 3, 3 +; CHECK-SPE-NEXT: efdsub 4, 4, 3 +; CHECK-SPE-NEXT: evmergehi 3, 4, 4 +; CHECK-SPE-NEXT: # kill: def $r4 killed $r4 killed $s4 +; CHECK-SPE-NEXT: # kill: def $r3 killed $r3 killed $s3 +; CHECK-SPE-NEXT: blr float %D, double %E) { %F = fmul reassoc float %A, %B ; [#uses=1] %G = fmul reassoc float %C, %D ; [#uses=1] @@ -623,6 +1024,19 @@ define double @test_fast_FMSUB_ASSOC_EXT4(float %A, float %B, float %C, ; CHECK-VSX-NEXT: xsnmsubadp 3, 1, 2 ; CHECK-VSX-NEXT: fmr 1, 3 ; CHECK-VSX-NEXT: blr +; +; CHECK-SPE-LABEL: test_fast_FMSUB_ASSOC_EXT4: +; CHECK-SPE: # %bb.0: +; CHECK-SPE-NEXT: efsmul 3, 3, 4 +; CHECK-SPE-NEXT: efsmul 4, 5, 6 +; CHECK-SPE-NEXT: efsadd 3, 3, 4 +; CHECK-SPE-NEXT: evmergelo 4, 7, 8 +; CHECK-SPE-NEXT: efdcfs 3, 3 +; CHECK-SPE-NEXT: efdsub 4, 4, 3 +; CHECK-SPE-NEXT: evmergehi 3, 4, 4 +; CHECK-SPE-NEXT: # kill: def $r4 killed $r4 killed $s4 +; CHECK-SPE-NEXT: # kill: def $r3 killed $r3 killed $s3 +; CHECK-SPE-NEXT: blr float %D, double %E) { %F = fmul reassoc float %A, %B %G = fmul reassoc float %C, %D diff --git a/llvm/test/CodeGen/PowerPC/pr55463.ll b/llvm/test/CodeGen/PowerPC/pr55463.ll index d973063..1776779 100644 --- a/llvm/test/CodeGen/PowerPC/pr55463.ll +++ b/llvm/test/CodeGen/PowerPC/pr55463.ll @@ -6,44 +6,18 @@ define void @baz() #0 { ; CHECK: # %bb.0: # %bb ; CHECK-NEXT: mflr 0 ; CHECK-NEXT: stw 0, 4(1) -; CHECK-NEXT: stwu 1, -48(1) -; CHECK-NEXT: li 3, .LCPI0_0@l -; CHECK-NEXT: li 5, .LCPI0_1@l -; CHECK-NEXT: lis 4, .LCPI0_0@ha -; CHECK-NEXT: lis 6, .LCPI0_1@ha -; CHECK-NEXT: evstdd 29, 24(1) # 8-byte Folded Spill -; CHECK-NEXT: evstdd 30, 32(1) # 8-byte Folded Spill -; CHECK-NEXT: evlddx 30, 4, 3 +; CHECK-NEXT: stwu 1, -16(1) ; CHECK-NEXT: # implicit-def: $r3 -; CHECK-NEXT: evlddx 29, 6, 5 -; CHECK-NEXT: evstdd 28, 16(1) # 8-byte Folded Spill -; CHECK-NEXT: # implicit-def: $r28 ; CHECK-NEXT: .p2align 4 ; CHECK-NEXT: .LBB0_1: # %bb1 ; CHECK-NEXT: # -; CHECK-NEXT: efdcfsi 8, 3 -; CHECK-NEXT: mr 4, 30 -; CHECK-NEXT: mr 6, 29 -; CHECK-NEXT: evmergehi 3, 30, 30 -; CHECK-NEXT: evmergehi 5, 29, 29 -; CHECK-NEXT: # kill: def $r3 killed $r3 killed $s3 -; CHECK-NEXT: # kill: def $r5 killed $r5 killed $s5 -; CHECK-NEXT: evmergehi 7, 8, 8 -; CHECK-NEXT: # kill: def $r8 killed $r8 killed $s8 -; CHECK-NEXT: # kill: def $r7 killed $r7 killed $s7 -; CHECK-NEXT: bl fma -; CHECK-NEXT: evmergelo 3, 3, 4 -; CHECK-NEXT: addi 28, 28, 1 -; CHECK-NEXT: cmplwi 28, 0 -; CHECK-NEXT: efdctsiz 3, 3 +; CHECK-NEXT: addi 3, 3, 1 +; CHECK-NEXT: cmplwi 3, 0 ; CHECK-NEXT: bne 0, .LBB0_1 ; CHECK-NEXT: # %bb.2: # %bb8 ; CHECK-NEXT: bl wibble -; CHECK-NEXT: evldd 30, 32(1) # 8-byte Folded Reload -; CHECK-NEXT: evldd 29, 24(1) # 8-byte Folded Reload -; CHECK-NEXT: evldd 28, 16(1) # 8-byte Folded Reload -; CHECK-NEXT: lwz 0, 52(1) -; CHECK-NEXT: addi 1, 1, 48 +; CHECK-NEXT: lwz 0, 20(1) +; CHECK-NEXT: addi 1, 1, 16 ; CHECK-NEXT: mtlr 0 ; CHECK-NEXT: blr bb: