llvm.org GIT mirror llvm / e5bbd6d
implement FUITOS and FUITOD git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30803 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 13 years ago
3 changed file(s) with 48 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
4848
4949 setOperationAction(ISD::SINT_TO_FP, MVT::i32, Custom);
5050
51 setOperationAction(ISD::UINT_TO_FP, MVT::i32, Custom);
52
5153 setOperationAction(ISD::RET, MVT::Other, Custom);
5254 setOperationAction(ISD::GlobalAddress, MVT::i32, Custom);
5355 setOperationAction(ISD::ConstantPool, MVT::i32, Custom);
8688 FSITOS,
8789
8890 FSITOD,
91
92 FUITOS,
93
94 FUITOD,
8995
9096 FMRRD,
9197
123129 case ARMISD::BR: return "ARMISD::BR";
124130 case ARMISD::FSITOS: return "ARMISD::FSITOS";
125131 case ARMISD::FSITOD: return "ARMISD::FSITOD";
132 case ARMISD::FUITOS: return "ARMISD::FUITOS";
133 case ARMISD::FUITOD: return "ARMISD::FUITOD";
126134 case ARMISD::FMRRD: return "ARMISD::FMRRD";
127135 case ARMISD::FMDRR: return "ARMISD::FMDRR";
128136 }
544552 return DAG.getNode(op, vt, Tmp);
545553 }
546554
555 static SDOperand LowerUINT_TO_FP(SDOperand Op, SelectionDAG &DAG) {
556 SDOperand IntVal = Op.getOperand(0);
557 assert(IntVal.getValueType() == MVT::i32);
558 MVT::ValueType vt = Op.getValueType();
559 assert(vt == MVT::f32 ||
560 vt == MVT::f64);
561
562 SDOperand Tmp = DAG.getNode(ISD::BIT_CONVERT, MVT::f32, IntVal);
563 ARMISD::NodeType op = vt == MVT::f32 ? ARMISD::FUITOS : ARMISD::FUITOD;
564 return DAG.getNode(op, vt, Tmp);
565 }
566
547567 SDOperand ARMTargetLowering::LowerOperation(SDOperand Op, SelectionDAG &DAG) {
548568 switch (Op.getOpcode()) {
549569 default:
555575 return LowerGlobalAddress(Op, DAG);
556576 case ISD::SINT_TO_FP:
557577 return LowerSINT_TO_FP(Op, DAG);
578 case ISD::UINT_TO_FP:
579 return LowerUINT_TO_FP(Op, DAG);
558580 case ISD::FORMAL_ARGUMENTS:
559581 return LowerFORMAL_ARGUMENTS(Op, DAG, VarArgsFrameIndex);
560582 case ISD::CALL:
7373 def SDTVoidBinOp : SDTypeProfile<0, 2, [SDTCisSameAs<0, 1>]>;
7474 def armcmp : SDNode<"ARMISD::CMP", SDTVoidBinOp, [SDNPOutFlag]>;
7575
76 def armfsitos : SDNode<"ARMISD::FSITOS", SDTUnaryOp>;
76 def armfsitos : SDNode<"ARMISD::FSITOS", SDTUnaryOp>;
7777 def armfsitod : SDNode<"ARMISD::FSITOD", SDTUnaryOp>;
78 def armfuitos : SDNode<"ARMISD::FUITOS", SDTUnaryOp>;
79 def armfuitod : SDNode<"ARMISD::FUITOD", SDTUnaryOp>;
7880
7981 def SDTarmfmrrd : SDTypeProfile<0, 3, [SDTCisInt<0>, SDTCisInt<1>, SDTCisFP<2>]>;
8082 def armfmrrd : SDNode<"ARMISD::FMRRD", SDTarmfmrrd,
183185 def FSITOD : InstARM<(ops DFPRegs:$dst, FPRegs:$src),
184186 "fsitod $dst, $src", [(set DFPRegs:$dst, (armfsitod FPRegs:$src))]>;
185187
188 def FUITOS : InstARM<(ops FPRegs:$dst, FPRegs:$src),
189 "fuitos $dst, $src", [(set FPRegs:$dst, (armfuitos FPRegs:$src))]>;
190
191 def FUITOD : InstARM<(ops DFPRegs:$dst, FPRegs:$src),
192 "fuitod $dst, $src", [(set DFPRegs:$dst, (armfuitod FPRegs:$src))]>;
193
186194
187195 // Floating Point Arithmetic
188196 def FADDS : InstARM<(ops FPRegs:$dst, FPRegs:$a, FPRegs:$b),
0 ; RUN: llvm-as < %s | llc -march=arm &&
1 ; RUN: llvm-as < %s | llc -march=arm | grep fmsr | wc -l | grep 2 &&
1 ; RUN: llvm-as < %s | llc -march=arm | grep fmsr | wc -l | grep 4 &&
22 ; RUN: llvm-as < %s | llc -march=arm | grep fsitos &&
33 ; RUN: llvm-as < %s | llc -march=arm | grep fmrs &&
44 ; RUN: llvm-as < %s | llc -march=arm | grep fsitod &&
5 ; RUN: llvm-as < %s | llc -march=arm | grep fmrrd | wc -l | grep 4 &&
5 ; RUN: llvm-as < %s | llc -march=arm | grep fmrrd | wc -l | grep 5 &&
66 ; RUN: llvm-as < %s | llc -march=arm | grep fmdrr | wc -l | grep 2 &&
77 ; RUN: llvm-as < %s | llc -march=arm | grep fldd &&
88 ; RUN: llvm-as < %s | llc -march=arm | grep flds &&
9 ; RUN: llvm-as < %s | llc -march=arm | grep fuitod &&
10 ; RUN: llvm-as < %s | llc -march=arm | grep fuitos &&
911 ; RUN: llvm-as < %s | llc -march=arm | grep ".word.*1065353216"
1012
1113 float %f(int %a) {
1921 %tmp = cast int %a to double ; [#uses=1]
2022 ret double %tmp
2123 }
24
25 double %uint_to_double(uint %a) {
26 entry:
27 %tmp = cast uint %a to double
28 ret double %tmp
29 }
30
31 float %uint_to_float(uint %a) {
32 entry:
33 %tmp = cast uint %a to float
34 ret float %tmp
35 }
36
2237
2338 double %h(double* %v) {
2439 entry: