1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00

[PowerPC] Fix the unexpected modification caused by D62993 in LowerSELECT_CC for power9

Summary:
The patch D62993 : `[PowerPC] Emit scalar min/max instructions with unsafe fp math`
has modified the functionality when `Subtarget.hasP9Vector() && (!HasNoInfs || !HasNoNaNs)`,
 this modification is not expected.

Reviewed By: nemanjai

Differential Revision: https://reviews.llvm.org/D74701
This commit is contained in:
Kang Zhang 2020-02-26 02:59:03 +00:00
parent a962b08ed4
commit 012c99178d
3 changed files with 80 additions and 37 deletions

View File

@ -7582,7 +7582,8 @@ SDValue PPCTargetLowering::LowerSELECT_CC(SDValue Op, SelectionDAG &DAG) const {
case ISD::SETLT:
return DAG.getNode(PPCISD::XSMINCDP, dl, Op.getValueType(), LHS, RHS);
}
}
} else if (!HasNoInfs || !HasNoNaNs)
return Op;
// TODO: Propagate flags from the select rather than global settings.
SDNodeFlags Flags;

View File

@ -35,10 +35,12 @@ define double @testoeq(double %a, double %b, double %c, double %d) {
;
; NO-FAST-P9-LABEL: testoeq:
; NO-FAST-P9: # %bb.0: # %entry
; NO-FAST-P9-NEXT: xssubdp f0, f1, f2
; NO-FAST-P9-NEXT: fsel f1, f0, f3, f4
; NO-FAST-P9-NEXT: xsnegdp f0, f0
; NO-FAST-P9-NEXT: fsel f1, f0, f1, f4
; NO-FAST-P9-NEXT: xscmpudp cr0, f1, f2
; NO-FAST-P9-NEXT: beq cr0, .LBB0_2
; NO-FAST-P9-NEXT: # %bb.1: # %entry
; NO-FAST-P9-NEXT: fmr f3, f4
; NO-FAST-P9-NEXT: .LBB0_2: # %entry
; NO-FAST-P9-NEXT: fmr f1, f3
; NO-FAST-P9-NEXT: blr
;
; NO-FAST-P8-LABEL: testoeq:

View File

@ -127,10 +127,12 @@ define float @select_fast_oeq_float(float %a, float %b, float %c, float %d) {
;
; NO-FAST-P9-LABEL: select_fast_oeq_float:
; NO-FAST-P9: # %bb.0: # %entry
; NO-FAST-P9-NEXT: xssubsp f0, f1, f2
; NO-FAST-P9-NEXT: xsnegdp f1, f0
; NO-FAST-P9-NEXT: fsel f0, f0, f3, f4
; NO-FAST-P9-NEXT: fsel f1, f1, f0, f4
; NO-FAST-P9-NEXT: fcmpu cr0, f1, f2
; NO-FAST-P9-NEXT: beq cr0, .LBB2_2
; NO-FAST-P9-NEXT: # %bb.1: # %entry
; NO-FAST-P9-NEXT: fmr f3, f4
; NO-FAST-P9-NEXT: .LBB2_2: # %entry
; NO-FAST-P9-NEXT: fmr f1, f3
; NO-FAST-P9-NEXT: blr
entry:
%cmp = fcmp fast oeq float %a, %b
@ -166,10 +168,12 @@ define double @select_fast_oeq_double(double %a, double %b, double %c, double %d
;
; NO-FAST-P9-LABEL: select_fast_oeq_double:
; NO-FAST-P9: # %bb.0: # %entry
; NO-FAST-P9-NEXT: xssubdp f0, f1, f2
; NO-FAST-P9-NEXT: fsel f1, f0, f3, f4
; NO-FAST-P9-NEXT: xsnegdp f0, f0
; NO-FAST-P9-NEXT: fsel f1, f0, f1, f4
; NO-FAST-P9-NEXT: xscmpudp cr0, f1, f2
; NO-FAST-P9-NEXT: beq cr0, .LBB3_2
; NO-FAST-P9-NEXT: # %bb.1: # %entry
; NO-FAST-P9-NEXT: fmr f3, f4
; NO-FAST-P9-NEXT: .LBB3_2: # %entry
; NO-FAST-P9-NEXT: fmr f1, f3
; NO-FAST-P9-NEXT: blr
entry:
%cmp = fcmp fast oeq double %a, %b
@ -293,10 +297,12 @@ define float @select_fast_one_float(float %a, float %b, float %c, float %d) {
;
; NO-FAST-P9-LABEL: select_fast_one_float:
; NO-FAST-P9: # %bb.0: # %entry
; NO-FAST-P9-NEXT: xssubsp f0, f1, f2
; NO-FAST-P9-NEXT: xsnegdp f1, f0
; NO-FAST-P9-NEXT: fsel f0, f0, f4, f3
; NO-FAST-P9-NEXT: fsel f1, f1, f0, f3
; NO-FAST-P9-NEXT: fcmpu cr0, f1, f2
; NO-FAST-P9-NEXT: bne cr0, .LBB6_2
; NO-FAST-P9-NEXT: # %bb.1: # %entry
; NO-FAST-P9-NEXT: fmr f3, f4
; NO-FAST-P9-NEXT: .LBB6_2: # %entry
; NO-FAST-P9-NEXT: fmr f1, f3
; NO-FAST-P9-NEXT: blr
entry:
%cmp = fcmp fast one float %a, %b
@ -332,10 +338,12 @@ define double @select_fast_one_double(double %a, double %b, double %c, double %d
;
; NO-FAST-P9-LABEL: select_fast_one_double:
; NO-FAST-P9: # %bb.0: # %entry
; NO-FAST-P9-NEXT: xssubdp f0, f1, f2
; NO-FAST-P9-NEXT: fsel f1, f0, f4, f3
; NO-FAST-P9-NEXT: xsnegdp f0, f0
; NO-FAST-P9-NEXT: fsel f1, f0, f1, f3
; NO-FAST-P9-NEXT: xscmpudp cr0, f1, f2
; NO-FAST-P9-NEXT: bne cr0, .LBB7_2
; NO-FAST-P9-NEXT: # %bb.1: # %entry
; NO-FAST-P9-NEXT: fmr f3, f4
; NO-FAST-P9-NEXT: .LBB7_2: # %entry
; NO-FAST-P9-NEXT: fmr f1, f3
; NO-FAST-P9-NEXT: blr
entry:
%cmp = fcmp fast one double %a, %b
@ -447,8 +455,12 @@ define float @select_fast_oge_float(float %a, float %b, float %c, float %d) {
;
; NO-FAST-P9-LABEL: select_fast_oge_float:
; NO-FAST-P9: # %bb.0: # %entry
; NO-FAST-P9-NEXT: xssubsp f0, f1, f2
; NO-FAST-P9-NEXT: fsel f1, f0, f3, f4
; NO-FAST-P9-NEXT: fcmpu cr0, f1, f2
; NO-FAST-P9-NEXT: bge cr0, .LBB10_2
; NO-FAST-P9-NEXT: # %bb.1: # %entry
; NO-FAST-P9-NEXT: fmr f3, f4
; NO-FAST-P9-NEXT: .LBB10_2: # %entry
; NO-FAST-P9-NEXT: fmr f1, f3
; NO-FAST-P9-NEXT: blr
entry:
%cmp = fcmp fast oge float %a, %b
@ -480,8 +492,12 @@ define double @select_fast_oge_double(double %a, double %b, double %c, double %d
;
; NO-FAST-P9-LABEL: select_fast_oge_double:
; NO-FAST-P9: # %bb.0: # %entry
; NO-FAST-P9-NEXT: xssubdp f0, f1, f2
; NO-FAST-P9-NEXT: fsel f1, f0, f3, f4
; NO-FAST-P9-NEXT: xscmpudp cr0, f1, f2
; NO-FAST-P9-NEXT: bge cr0, .LBB11_2
; NO-FAST-P9-NEXT: # %bb.1: # %entry
; NO-FAST-P9-NEXT: fmr f3, f4
; NO-FAST-P9-NEXT: .LBB11_2: # %entry
; NO-FAST-P9-NEXT: fmr f1, f3
; NO-FAST-P9-NEXT: blr
entry:
%cmp = fcmp fast oge double %a, %b
@ -589,8 +605,12 @@ define float @select_fast_olt_float(float %a, float %b, float %c, float %d) {
;
; NO-FAST-P9-LABEL: select_fast_olt_float:
; NO-FAST-P9: # %bb.0: # %entry
; NO-FAST-P9-NEXT: xssubsp f0, f1, f2
; NO-FAST-P9-NEXT: fsel f1, f0, f4, f3
; NO-FAST-P9-NEXT: fcmpu cr0, f1, f2
; NO-FAST-P9-NEXT: blt cr0, .LBB14_2
; NO-FAST-P9-NEXT: # %bb.1: # %entry
; NO-FAST-P9-NEXT: fmr f3, f4
; NO-FAST-P9-NEXT: .LBB14_2: # %entry
; NO-FAST-P9-NEXT: fmr f1, f3
; NO-FAST-P9-NEXT: blr
entry:
%cmp = fcmp fast olt float %a, %b
@ -622,8 +642,12 @@ define double @select_fast_olt_double(double %a, double %b, double %c, double %d
;
; NO-FAST-P9-LABEL: select_fast_olt_double:
; NO-FAST-P9: # %bb.0: # %entry
; NO-FAST-P9-NEXT: xssubdp f0, f1, f2
; NO-FAST-P9-NEXT: fsel f1, f0, f4, f3
; NO-FAST-P9-NEXT: xscmpudp cr0, f1, f2
; NO-FAST-P9-NEXT: blt cr0, .LBB15_2
; NO-FAST-P9-NEXT: # %bb.1: # %entry
; NO-FAST-P9-NEXT: fmr f3, f4
; NO-FAST-P9-NEXT: .LBB15_2: # %entry
; NO-FAST-P9-NEXT: fmr f1, f3
; NO-FAST-P9-NEXT: blr
entry:
%cmp = fcmp fast olt double %a, %b
@ -731,8 +755,12 @@ define float @select_fast_ogt_float(float %a, float %b, float %c, float %d) {
;
; NO-FAST-P9-LABEL: select_fast_ogt_float:
; NO-FAST-P9: # %bb.0: # %entry
; NO-FAST-P9-NEXT: xssubsp f0, f2, f1
; NO-FAST-P9-NEXT: fsel f1, f0, f4, f3
; NO-FAST-P9-NEXT: fcmpu cr0, f1, f2
; NO-FAST-P9-NEXT: bgt cr0, .LBB18_2
; NO-FAST-P9-NEXT: # %bb.1: # %entry
; NO-FAST-P9-NEXT: fmr f3, f4
; NO-FAST-P9-NEXT: .LBB18_2: # %entry
; NO-FAST-P9-NEXT: fmr f1, f3
; NO-FAST-P9-NEXT: blr
entry:
%cmp = fcmp fast ogt float %a, %b
@ -764,8 +792,12 @@ define double @select_fast_ogt_double(double %a, double %b, double %c, double %d
;
; NO-FAST-P9-LABEL: select_fast_ogt_double:
; NO-FAST-P9: # %bb.0: # %entry
; NO-FAST-P9-NEXT: xssubdp f0, f2, f1
; NO-FAST-P9-NEXT: fsel f1, f0, f4, f3
; NO-FAST-P9-NEXT: xscmpudp cr0, f1, f2
; NO-FAST-P9-NEXT: bgt cr0, .LBB19_2
; NO-FAST-P9-NEXT: # %bb.1: # %entry
; NO-FAST-P9-NEXT: fmr f3, f4
; NO-FAST-P9-NEXT: .LBB19_2: # %entry
; NO-FAST-P9-NEXT: fmr f1, f3
; NO-FAST-P9-NEXT: blr
entry:
%cmp = fcmp fast ogt double %a, %b
@ -877,8 +909,12 @@ define float @select_fast_ole_float(float %a, float %b, float %c, float %d) {
;
; NO-FAST-P9-LABEL: select_fast_ole_float:
; NO-FAST-P9: # %bb.0: # %entry
; NO-FAST-P9-NEXT: xssubsp f0, f2, f1
; NO-FAST-P9-NEXT: fsel f1, f0, f3, f4
; NO-FAST-P9-NEXT: fcmpu cr0, f1, f2
; NO-FAST-P9-NEXT: ble cr0, .LBB22_2
; NO-FAST-P9-NEXT: # %bb.1: # %entry
; NO-FAST-P9-NEXT: fmr f3, f4
; NO-FAST-P9-NEXT: .LBB22_2: # %entry
; NO-FAST-P9-NEXT: fmr f1, f3
; NO-FAST-P9-NEXT: blr
entry:
%cmp = fcmp fast ole float %a, %b
@ -910,8 +946,12 @@ define double @select_fast_ole_double(double %a, double %b, double %c, double %d
;
; NO-FAST-P9-LABEL: select_fast_ole_double:
; NO-FAST-P9: # %bb.0: # %entry
; NO-FAST-P9-NEXT: xssubdp f0, f2, f1
; NO-FAST-P9-NEXT: fsel f1, f0, f3, f4
; NO-FAST-P9-NEXT: xscmpudp cr0, f1, f2
; NO-FAST-P9-NEXT: ble cr0, .LBB23_2
; NO-FAST-P9-NEXT: # %bb.1: # %entry
; NO-FAST-P9-NEXT: fmr f3, f4
; NO-FAST-P9-NEXT: .LBB23_2: # %entry
; NO-FAST-P9-NEXT: fmr f1, f3
; NO-FAST-P9-NEXT: blr
entry:
%cmp = fcmp fast ole double %a, %b