@@ -298,8 +298,8 @@ bool Compiler<Emitter>::VisitCastExpr(const CastExpr *CE) {
298
298
return false ;
299
299
300
300
const auto *TargetSemantics = &Ctx.getFloatSemantics (CE->getType ());
301
- llvm::RoundingMode RM = getRoundingMode (CE);
302
- return this -> emitCastIntegralFloating (*FromT, TargetSemantics, RM , CE);
301
+ return this -> emitCastIntegralFloating (*FromT, TargetSemantics,
302
+ getFPOptions (CE) , CE);
303
303
}
304
304
305
305
case CK_FloatingToBoolean:
@@ -317,12 +317,12 @@ bool Compiler<Emitter>::VisitCastExpr(const CastExpr *CE) {
317
317
318
318
if (ToT == PT_IntAP)
319
319
return this ->emitCastFloatingIntegralAP (Ctx.getBitWidth (CE->getType ()),
320
- CE);
320
+ getFPOptions (CE), CE);
321
321
if (ToT == PT_IntAPS)
322
322
return this ->emitCastFloatingIntegralAPS (Ctx.getBitWidth (CE->getType ()),
323
- CE);
323
+ getFPOptions (CE), CE);
324
324
325
- return this ->emitCastFloatingIntegral (*ToT, CE);
325
+ return this ->emitCastFloatingIntegral (*ToT, getFPOptions (CE), CE);
326
326
}
327
327
328
328
case CK_NullToPointer:
@@ -810,21 +810,21 @@ bool Compiler<Emitter>::VisitBinaryOperator(const BinaryOperator *BO) {
810
810
return MaybeCastToBool (this ->emitGE (*LT, BO));
811
811
case BO_Sub:
812
812
if (BO->getType ()->isFloatingType ())
813
- return Discard (this ->emitSubf (getRoundingMode (BO), BO));
813
+ return Discard (this ->emitSubf (getFPOptions (BO), BO));
814
814
return Discard (this ->emitSub (*T, BO));
815
815
case BO_Add:
816
816
if (BO->getType ()->isFloatingType ())
817
- return Discard (this ->emitAddf (getRoundingMode (BO), BO));
817
+ return Discard (this ->emitAddf (getFPOptions (BO), BO));
818
818
return Discard (this ->emitAdd (*T, BO));
819
819
case BO_Mul:
820
820
if (BO->getType ()->isFloatingType ())
821
- return Discard (this ->emitMulf (getRoundingMode (BO), BO));
821
+ return Discard (this ->emitMulf (getFPOptions (BO), BO));
822
822
return Discard (this ->emitMul (*T, BO));
823
823
case BO_Rem:
824
824
return Discard (this ->emitRem (*T, BO));
825
825
case BO_Div:
826
826
if (BO->getType ()->isFloatingType ())
827
- return Discard (this ->emitDivf (getRoundingMode (BO), BO));
827
+ return Discard (this ->emitDivf (getFPOptions (BO), BO));
828
828
return Discard (this ->emitDiv (*T, BO));
829
829
case BO_Assign:
830
830
if (DiscardResult)
@@ -1153,7 +1153,7 @@ bool Compiler<Emitter>::VisitComplexBinOp(const BinaryOperator *E) {
1153
1153
if (!loadComplexValue (RHSIsComplex, true , ElemIndex, RHSOffset, RHS))
1154
1154
return false ;
1155
1155
if (ResultElemT == PT_Float) {
1156
- if (!this ->emitAddf (getRoundingMode (E), E))
1156
+ if (!this ->emitAddf (getFPOptions (E), E))
1157
1157
return false ;
1158
1158
} else {
1159
1159
if (!this ->emitAdd (ResultElemT, E))
@@ -1167,7 +1167,7 @@ bool Compiler<Emitter>::VisitComplexBinOp(const BinaryOperator *E) {
1167
1167
if (!loadComplexValue (RHSIsComplex, true , ElemIndex, RHSOffset, RHS))
1168
1168
return false ;
1169
1169
if (ResultElemT == PT_Float) {
1170
- if (!this ->emitSubf (getRoundingMode (E), E))
1170
+ if (!this ->emitSubf (getFPOptions (E), E))
1171
1171
return false ;
1172
1172
} else {
1173
1173
if (!this ->emitSub (ResultElemT, E))
@@ -1182,7 +1182,7 @@ bool Compiler<Emitter>::VisitComplexBinOp(const BinaryOperator *E) {
1182
1182
return false ;
1183
1183
1184
1184
if (ResultElemT == PT_Float) {
1185
- if (!this ->emitMulf (getRoundingMode (E), E))
1185
+ if (!this ->emitMulf (getFPOptions (E), E))
1186
1186
return false ;
1187
1187
} else {
1188
1188
if (!this ->emitMul (ResultElemT, E))
@@ -1198,7 +1198,7 @@ bool Compiler<Emitter>::VisitComplexBinOp(const BinaryOperator *E) {
1198
1198
return false ;
1199
1199
1200
1200
if (ResultElemT == PT_Float) {
1201
- if (!this ->emitDivf (getRoundingMode (E), E))
1201
+ if (!this ->emitDivf (getFPOptions (E), E))
1202
1202
return false ;
1203
1203
} else {
1204
1204
if (!this ->emitDiv (ResultElemT, E))
@@ -2063,22 +2063,21 @@ bool Compiler<Emitter>::VisitFloatCompoundAssignOperator(
2063
2063
if (!this ->emitGetLocal (*RT, TempOffset, E))
2064
2064
return false ;
2065
2065
2066
- llvm::RoundingMode RM = getRoundingMode (E);
2067
2066
switch (E->getOpcode ()) {
2068
2067
case BO_AddAssign:
2069
- if (!this ->emitAddf (RM , E))
2068
+ if (!this ->emitAddf (getFPOptions (E) , E))
2070
2069
return false ;
2071
2070
break ;
2072
2071
case BO_SubAssign:
2073
- if (!this ->emitSubf (RM , E))
2072
+ if (!this ->emitSubf (getFPOptions (E) , E))
2074
2073
return false ;
2075
2074
break ;
2076
2075
case BO_MulAssign:
2077
- if (!this ->emitMulf (RM , E))
2076
+ if (!this ->emitMulf (getFPOptions (E) , E))
2078
2077
return false ;
2079
2078
break ;
2080
2079
case BO_DivAssign:
2081
- if (!this ->emitDivf (RM , E))
2080
+ if (!this ->emitDivf (getFPOptions (E) , E))
2082
2081
return false ;
2083
2082
break ;
2084
2083
default :
@@ -3325,7 +3324,7 @@ template <class Emitter> bool Compiler<Emitter>::visitBool(const Expr *E) {
3325
3324
3326
3325
// Or Floats.
3327
3326
if (T == PT_Float)
3328
- return this ->emitCastFloatingIntegralBool (E);
3327
+ return this ->emitCastFloatingIntegralBool (getFPOptions (E), E);
3329
3328
3330
3329
// Or anything else we can.
3331
3330
return this ->emitCast (*T, PT_Bool, E);
@@ -5005,8 +5004,8 @@ bool Compiler<Emitter>::VisitUnaryOperator(const UnaryOperator *E) {
5005
5004
}
5006
5005
5007
5006
if (T == PT_Float) {
5008
- return DiscardResult ? this ->emitIncfPop (getRoundingMode (E), E)
5009
- : this ->emitIncf (getRoundingMode (E), E);
5007
+ return DiscardResult ? this ->emitIncfPop (getFPOptions (E), E)
5008
+ : this ->emitIncf (getFPOptions (E), E);
5010
5009
}
5011
5010
5012
5011
return DiscardResult ? this ->emitIncPop (*T, E) : this ->emitInc (*T, E);
@@ -5028,8 +5027,8 @@ bool Compiler<Emitter>::VisitUnaryOperator(const UnaryOperator *E) {
5028
5027
}
5029
5028
5030
5029
if (T == PT_Float) {
5031
- return DiscardResult ? this ->emitDecfPop (getRoundingMode (E), E)
5032
- : this ->emitDecf (getRoundingMode (E), E);
5030
+ return DiscardResult ? this ->emitDecfPop (getFPOptions (E), E)
5031
+ : this ->emitDecf (getFPOptions (E), E);
5033
5032
}
5034
5033
5035
5034
return DiscardResult ? this ->emitDecPop (*T, E) : this ->emitDec (*T, E);
@@ -5056,7 +5055,7 @@ bool Compiler<Emitter>::VisitUnaryOperator(const UnaryOperator *E) {
5056
5055
// Post-inc and pre-inc are the same if the value is to be discarded.
5057
5056
if (DiscardResult) {
5058
5057
if (T == PT_Float)
5059
- return this ->emitIncfPop (getRoundingMode (E), E);
5058
+ return this ->emitIncfPop (getFPOptions (E), E);
5060
5059
return this ->emitIncPop (*T, E);
5061
5060
}
5062
5061
@@ -5066,7 +5065,7 @@ bool Compiler<Emitter>::VisitUnaryOperator(const UnaryOperator *E) {
5066
5065
return false ;
5067
5066
if (!this ->emitConstFloat (llvm::APFloat (TargetSemantics, 1 ), E))
5068
5067
return false ;
5069
- if (!this ->emitAddf (getRoundingMode (E), E))
5068
+ if (!this ->emitAddf (getFPOptions (E), E))
5070
5069
return false ;
5071
5070
if (!this ->emitStoreFloat (E))
5072
5071
return false ;
@@ -5105,7 +5104,7 @@ bool Compiler<Emitter>::VisitUnaryOperator(const UnaryOperator *E) {
5105
5104
// Post-dec and pre-dec are the same if the value is to be discarded.
5106
5105
if (DiscardResult) {
5107
5106
if (T == PT_Float)
5108
- return this ->emitDecfPop (getRoundingMode (E), E);
5107
+ return this ->emitDecfPop (getFPOptions (E), E);
5109
5108
return this ->emitDecPop (*T, E);
5110
5109
}
5111
5110
@@ -5115,7 +5114,7 @@ bool Compiler<Emitter>::VisitUnaryOperator(const UnaryOperator *E) {
5115
5114
return false ;
5116
5115
if (!this ->emitConstFloat (llvm::APFloat (TargetSemantics, 1 ), E))
5117
5116
return false ;
5118
- if (!this ->emitSubf (getRoundingMode (E), E))
5117
+ if (!this ->emitSubf (getFPOptions (E), E))
5119
5118
return false ;
5120
5119
if (!this ->emitStoreFloat (E))
5121
5120
return false ;
@@ -5579,13 +5578,15 @@ bool Compiler<Emitter>::emitPrimCast(PrimType FromT, PrimType ToT,
5579
5578
}
5580
5579
5581
5580
if (ToT == PT_IntAP)
5582
- return this ->emitCastFloatingIntegralAP (Ctx.getBitWidth (ToQT), E);
5581
+ return this ->emitCastFloatingIntegralAP (Ctx.getBitWidth (ToQT),
5582
+ getFPOptions (E), E);
5583
5583
if (ToT == PT_IntAPS)
5584
- return this ->emitCastFloatingIntegralAPS (Ctx.getBitWidth (ToQT), E);
5584
+ return this ->emitCastFloatingIntegralAPS (Ctx.getBitWidth (ToQT),
5585
+ getFPOptions (E), E);
5585
5586
5586
5587
// Float to integral.
5587
5588
if (isIntegralType (ToT) || ToT == PT_Bool)
5588
- return this ->emitCastFloatingIntegral (ToT, E);
5589
+ return this ->emitCastFloatingIntegral (ToT, getFPOptions (E), E);
5589
5590
}
5590
5591
5591
5592
if (isIntegralType (FromT) || FromT == PT_Bool) {
@@ -5601,8 +5602,7 @@ bool Compiler<Emitter>::emitPrimCast(PrimType FromT, PrimType ToT,
5601
5602
if (ToT == PT_Float) {
5602
5603
// Integral to floating.
5603
5604
const llvm::fltSemantics *ToSem = &Ctx.getFloatSemantics (ToQT);
5604
- return this ->emitCastIntegralFloating (FromT, ToSem, getRoundingMode (E),
5605
- E);
5605
+ return this ->emitCastIntegralFloating (FromT, ToSem, getFPOptions (E), E);
5606
5606
}
5607
5607
}
5608
5608
@@ -5639,7 +5639,7 @@ bool Compiler<Emitter>::emitComplexBoolCast(const Expr *E) {
5639
5639
if (!this ->emitArrayElem (ElemT, 0 , E))
5640
5640
return false ;
5641
5641
if (ElemT == PT_Float) {
5642
- if (!this ->emitCastFloatingIntegral (PT_Bool, E))
5642
+ if (!this ->emitCastFloatingIntegral (PT_Bool, getFPOptions (E), E))
5643
5643
return false ;
5644
5644
} else {
5645
5645
if (!this ->emitCast (ElemT, PT_Bool, E))
@@ -5654,7 +5654,7 @@ bool Compiler<Emitter>::emitComplexBoolCast(const Expr *E) {
5654
5654
if (!this ->emitArrayElemPop (ElemT, 1 , E))
5655
5655
return false ;
5656
5656
if (ElemT == PT_Float) {
5657
- if (!this ->emitCastFloatingIntegral (PT_Bool, E))
5657
+ if (!this ->emitCastFloatingIntegral (PT_Bool, getFPOptions (E), E))
5658
5658
return false ;
5659
5659
} else {
5660
5660
if (!this ->emitCast (ElemT, PT_Bool, E))
0 commit comments