Skip to content

Commit 6c912bf

Browse files
add support for int->FP and FP->int ops, and add ia64 patterns for these
llvm-svn: 24132
1 parent a284b66 commit 6c912bf

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

llvm/lib/Target/IA64/IA64InstrInfo.td

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,18 @@ def GETFSIG : AForm<0x03, 0x0b, (ops GR:$dst, FP:$src),
553553
def SETFSIG : AForm<0x03, 0x0b, (ops FP:$dst, GR:$src),
554554
"setf.sig $dst = $src;;">;
555555

556+
// these four FP<->int conversion patterns need checking/cleaning
557+
def SINT_TO_FP : Pat<(sint_to_fp GR:$src),
558+
(FNORMD (FCVTXF (SETFSIG GR:$src)))>;
559+
def UINT_TO_FP : Pat<(uint_to_fp GR:$src),
560+
(FNORMD (FCVTXUF (SETFSIG GR:$src)))>;
561+
/* FIXME: tablegen coughs on these
562+
def FP_TO_SINT : Pat<(fp_to_sint FP:$src),
563+
(GETFSIG (FCVTFXTRUNC FP:$src))>;
564+
def FP_TO_UINT : Pat<(fp_to_uint FP:$src),
565+
(GETFSIG (FCVTFXUTRUNC FP:$src))>;
566+
*/
567+
556568
let isTerminator = 1, isBranch = 1 in {
557569
def BRL_NOTCALL : RawForm<0x03, 0xb0, (ops i64imm:$dst),
558570
"(p0) brl.cond.sptk $dst;;">;

llvm/lib/Target/TargetSelectionDAG.td

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,12 @@ def SDTFPRoundOp : SDTypeProfile<1, 1, [ // fround
9494
def SDTFPExtendOp : SDTypeProfile<1, 1, [ // fextend
9595
SDTCisFP<0>, SDTCisFP<1>, SDTCisOpSmallerThanOp<1, 0>
9696
]>;
97+
def SDTIntToFPOp : SDTypeProfile<1, 1, [ // [su]int_to_fp
98+
SDTCisFP<0>, SDTCisInt<1>
99+
]>;
100+
def SDTFPToIntOp : SDTypeProfile<1, 1, [ // fp_to_[su]int
101+
SDTCisInt<0>, SDTCisFP<1>
102+
]>;
97103
def SDTExtInreg : SDTypeProfile<1, 2, [ // sext_inreg
98104
SDTCisSameAs<0, 1>, SDTCisInt<0>, SDTCisVT<2, OtherVT>,
99105
SDTCisVTSmallerThanOp<2, 1>
@@ -172,6 +178,11 @@ def fsqrt : SDNode<"ISD::FSQRT" , SDTFPUnaryOp>;
172178
def fround : SDNode<"ISD::FP_ROUND" , SDTFPRoundOp>;
173179
def fextend : SDNode<"ISD::FP_EXTEND" , SDTFPExtendOp>;
174180

181+
def sint_to_fp : SDNode<"ISD::SINT_TO_FP" , SDTIntToFPOp>;
182+
def uint_to_fp : SDNode<"ISD::UINT_TO_FP" , SDTIntToFPOp>;
183+
def fp_to_sint : SDNode<"ISD::FP_TO_SINT" , SDTFPToIntOp>;
184+
def fp_to_uint : SDNode<"ISD::FP_TO_UINT" , SDTFPToIntOp>;
185+
175186
def setcc : SDNode<"ISD::SETCC" , SDTSetCC>;
176187

177188
//===----------------------------------------------------------------------===//

0 commit comments

Comments
 (0)