Skip to content

Commit 5e030e0

Browse files
committed
DAG: Define fptrunc_round in TargetSelectionDAG.td
1 parent d1adc86 commit 5e030e0

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

llvm/include/llvm/Target/TargetSelectionDAG.td

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,9 @@ def SDTFPUnaryOp : SDTypeProfile<1, 1, [ // fneg, fsqrt, etc
158158
def SDTFPRoundOp : SDTypeProfile<1, 1, [ // fpround
159159
SDTCisFP<0>, SDTCisFP<1>, SDTCisOpSmallerThanOp<0, 1>, SDTCisSameNumEltsAs<0, 1>
160160
]>;
161+
def SDTFPTruncRoundOp : SDTypeProfile<1, 2, [
162+
SDTCisFP<0>, SDTCisFP<1>, SDTCisInt<2>, SDTCisOpSmallerThanOp<0, 1>, SDTCisSameNumEltsAs<0, 1>
163+
]>;
161164
def SDTFPExtendOp : SDTypeProfile<1, 1, [ // fpextend
162165
SDTCisFP<0>, SDTCisFP<1>, SDTCisOpSmallerThanOp<1, 0>, SDTCisSameNumEltsAs<0, 1>
163166
]>;
@@ -552,6 +555,8 @@ def llround : SDNode<"ISD::LLROUND" , SDTFPToIntOp>;
552555
def lrint : SDNode<"ISD::LRINT" , SDTFPToIntOp>;
553556
def llrint : SDNode<"ISD::LLRINT" , SDTFPToIntOp>;
554557

558+
def fptrunc_round : SDNode<"ISD::FPTRUNC_ROUND", SDTFPTruncRoundOp>;
559+
555560
def fpround : SDNode<"ISD::FP_ROUND" , SDTFPRoundOp>;
556561
def fpextend : SDNode<"ISD::FP_EXTEND" , SDTFPExtendOp>;
557562
def fcopysign : SDNode<"ISD::FCOPYSIGN" , SDTFPSignOp>;

llvm/lib/Target/AMDGPU/AMDGPUGISel.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ def : GINodeEquiv<G_AMDGPU_S_BUFFER_LOAD_UBYTE, SIsbuffer_load_ubyte>;
297297
def : GINodeEquiv<G_AMDGPU_S_BUFFER_LOAD_SSHORT, SIsbuffer_load_short>;
298298
def : GINodeEquiv<G_AMDGPU_S_BUFFER_LOAD_USHORT, SIsbuffer_load_ushort>;
299299

300-
def : GINodeEquiv<G_INTRINSIC_FPTRUNC_ROUND, SIfptrunc_round>;
300+
def : GINodeEquiv<G_INTRINSIC_FPTRUNC_ROUND, fptrunc_round>;
301301

302302
class GISelSop2Pat <
303303
SDPatternOperator node,

llvm/lib/Target/AMDGPU/SIInstrInfo.td

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -304,12 +304,6 @@ def SIdenorm_mode : SDNode<"AMDGPUISD::DENORM_MODE",
304304
[SDNPHasChain, SDNPOptInGlue, SDNPOutGlue]
305305
>;
306306

307-
def SDTFPRoundModeOp : SDTypeProfile<1, 2, [
308-
SDTCisFP<0>, SDTCisFP<1>, SDTCisInt<2>, SDTCisOpSmallerThanOp<0, 1>, SDTCisSameNumEltsAs<0, 1>
309-
]>;
310-
311-
def SIfptrunc_round : SDNode<"ISD::FPTRUNC_ROUND", SDTFPRoundModeOp>;
312-
313307
//===----------------------------------------------------------------------===//
314308
// ValueType helpers
315309
//===----------------------------------------------------------------------===//

llvm/lib/Target/AMDGPU/SIInstructions.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ def FPTRUNC_ROUND_F16_F32_PSEUDO : VPseudoInstSI <(outs VGPR_32:$vdst),
232232
(ins VGPR_32:$src0, i32imm:$round)>;
233233
} // End Uses = [MODE, EXEC]
234234

235-
def : GCNPat <(f16 (SIfptrunc_round f32:$src0, (i32 SupportedRoundMode:$round))),
235+
def : GCNPat <(f16 (fptrunc_round f32:$src0, (i32 SupportedRoundMode:$round))),
236236
(FPTRUNC_ROUND_F16_F32_PSEUDO $src0, (as_hw_round_mode $round))>;
237237

238238
// Invert the exec mask and overwrite the inactive lanes of dst with inactive,

0 commit comments

Comments
 (0)