1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 12:02:58 +02:00

[X86] Add a simple hack to IsProfitableToFold to prevent vselect+strict fp operations from being folded into masked instructions.

We really need to update the isel patterns to prevent this, but
that requires some tablegen de-tangling. So this hack will work
for correctness in the short term.
This commit is contained in:
Craig Topper 2019-12-18 14:24:20 -08:00
parent 7e3bfeda71
commit 477cf157af
2 changed files with 8 additions and 1 deletions

View File

@ -580,6 +580,12 @@ X86DAGToDAGISel::IsProfitableToFold(SDValue N, SDNode *U, SDNode *Root) const {
if (!N.hasOneUse())
return false;
// FIXME: Temporary hack to prevent strict floating point nodes from
// folding into masked operations illegally.
if (U == Root && Root->getOpcode() == ISD::VSELECT &&
N.getOpcode() != ISD::LOAD && N.getOpcode() != X86ISD::VBROADCAST_LOAD)
return false;
if (N.getOpcode() != ISD::LOAD)
return true;

View File

@ -7317,7 +7317,8 @@ define <16 x float> @vpaddd_mask_test(<16 x float> %i, <16 x float> %j, <16 x i3
; AVX512-LABEL: vpaddd_mask_test:
; AVX512: # %bb.0:
; AVX512-NEXT: vptestmd %zmm2, %zmm2, %k1
; AVX512-NEXT: vaddps %zmm1, %zmm0, %zmm0 {%k1}
; AVX512-NEXT: vaddps %zmm1, %zmm0, %zmm1
; AVX512-NEXT: vmovaps %zmm1, %zmm0 {%k1}
; AVX512-NEXT: retq
%mask = icmp ne <16 x i32> %mask1, zeroinitializer
%x = call <16 x float> @llvm.experimental.constrained.fadd.v16f32(<16 x float> %i, <16 x float> %j, metadata !"round.dynamic", metadata !"fpexcept.strict") #0