fpu: Use {get,set}_float_rounding_mode everywhere
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Richard Henderson committed
May 1, 2026 at 15:58 UTC
c26e4876d108f517fb579c2af93960c8035e8d1a
14 files changed
+185
-189
fpu/softfloat-parts.c.inc
+4
-4
@@ -300,7 +300,7 @@ static void partsN(uncanon_normal)(FloatPartsN *p, float_status *s,
300
int exp;
301
FloatExceptionFlags flags = 0;
302
303
- switch (s->float_rounding_mode) {
303
+ switch (get_float_rounding_mode(s)) {
304
case float_round_nearest_even_max:
305
overflow_norm = true;
306
/* fall through */
@@ -431,7 +431,7 @@ static void partsN(uncanon_normal)(FloatPartsN *p, float_status *s,
431
432
if (p->frac_lo & round_mask) {
433
/* Need to recompute round-to-even/round-to-odd. */
434
- switch (s->float_rounding_mode) {
434
+ switch (get_float_rounding_mode(s)) {
435
case float_round_nearest_even:
436
if (N > 64 && frac_lsb == 0) {
437
inc = ((p->frac_hi & 1) ||
@@ -558,7 +558,7 @@ FloatPartsN partsN(addsub)(const FloatPartsN *a_orig,
558
559
if (ab_mask == float_cmask_zero) {
560
/* 0 - 0 */
561
- a.sign = s->float_rounding_mode == float_round_down;
561
+ a.sign = get_float_rounding_mode(s) == float_round_down;
562
return a;
563
}
564
@@ -763,7 +763,7 @@ FloatPartsN partsN(muladd)(const FloatPartsN *a, const FloatPartsN *b,
763
return_sub_zero:
764
/* 0 - 0 == -0 for round_down, +0 otherwise. */
765
return (FloatPartsN){
766
- .sign = s->float_rounding_mode == float_round_down,
766
+ .sign = get_float_rounding_mode(s) == float_round_down,
767
.cls = float_class_zero
768
};
769
fpu/softfloat.c
+44
-44
@@ -234,7 +234,7 @@ static inline bool can_use_fpu(const float_status *s)
234
return false;
235
}
236
return likely(s->float_exception_flags & float_flag_inexact &&
237
- s->float_rounding_mode == float_round_nearest_even);
237
+ get_float_rounding_mode(s) == float_round_nearest_even);
238
}
239
240
/*
@@ -2803,7 +2803,7 @@ float16 float16_round_to_int(float16 a, float_status *s)
2803
{
2804
FloatParts64 p = float16_unpack_canonical(a, s);
2805
2806
- p = parts64_round_to_int(&p, s->float_rounding_mode, 0, s,
2806
+ p = parts64_round_to_int(&p, get_float_rounding_mode(s), 0, s,
2807
&float16_params);
2808
return float16_round_pack_canonical(&p, s);
2809
}
@@ -2812,7 +2812,7 @@ float32 float32_round_to_int(float32 a, float_status *s)
2812
{
2813
FloatParts64 p = float32_unpack_canonical(a, s);
2814
2815
- p = parts64_round_to_int(&p, s->float_rounding_mode, 0, s,
2815
+ p = parts64_round_to_int(&p, get_float_rounding_mode(s), 0, s,
2816
&float32_params);
2817
return float32_round_pack_canonical(&p, s);
2818
}
@@ -2821,7 +2821,7 @@ float64 float64_round_to_int(float64 a, float_status *s)
2821
{
2822
FloatParts64 p = float64_unpack_canonical(a, s);
2823
2824
- p = parts64_round_to_int(&p, s->float_rounding_mode, 0, s,
2824
+ p = parts64_round_to_int(&p, get_float_rounding_mode(s), 0, s,
2825
&float64_params);
2826
return float64_round_pack_canonical(&p, s);
2827
}
@@ -2830,7 +2830,7 @@ bfloat16 bfloat16_round_to_int(bfloat16 a, float_status *s)
2830
{
2831
FloatParts64 p = bfloat16_unpack_canonical(a, s);
2832
2833
- p = parts64_round_to_int(&p, s->float_rounding_mode, 0, s,
2833
+ p = parts64_round_to_int(&p, get_float_rounding_mode(s), 0, s,
2834
&bfloat16_params);
2835
return bfloat16_round_pack_canonical(&p, s);
2836
}
@@ -2839,7 +2839,7 @@ float128 float128_round_to_int(float128 a, float_status *s)
2839
{
2840
FloatParts128 p = float128_unpack_canonical(a, s);
2841
2842
- p = parts128_round_to_int(&p, s->float_rounding_mode, 0, s,
2842
+ p = parts128_round_to_int(&p, get_float_rounding_mode(s), 0, s,
2843
&float128_params);
2844
return float128_round_pack_canonical(&p, s);
2845
}
@@ -2852,7 +2852,7 @@ floatx80 floatx80_round_to_int(floatx80 a, float_status *status)
2852
return floatx80_default_nan(status);
2853
}
2854
2855
- p = parts128_round_to_int(&p, status->float_rounding_mode, 0, status,
2855
+ p = parts128_round_to_int(&p, get_float_rounding_mode(status), 0, status,
2856
&floatx80_params[status->floatx80_rounding_precision]);
2857
return floatx80_round_pack_canonical(&p, status);
2858
}
@@ -3050,77 +3050,77 @@ static int64_t floatx80_to_int64_scalbn(floatx80 a, FloatRoundMode rmode,
3050
3051
int8_t float16_to_int8(float16 a, float_status *s)
3052
{
3053
- return float16_to_int8_scalbn(a, s->float_rounding_mode, 0, s);
3053
+ return float16_to_int8_scalbn(a, get_float_rounding_mode(s), 0, s);
3054
}
3055
3056
int16_t float16_to_int16(float16 a, float_status *s)
3057
{
3058
- return float16_to_int16_scalbn(a, s->float_rounding_mode, 0, s);
3058
+ return float16_to_int16_scalbn(a, get_float_rounding_mode(s), 0, s);
3059
}
3060
3061
int32_t float16_to_int32(float16 a, float_status *s)
3062
{
3063
- return float16_to_int32_scalbn(a, s->float_rounding_mode, 0, s);
3063
+ return float16_to_int32_scalbn(a, get_float_rounding_mode(s), 0, s);
3064
}
3065
3066
int64_t float16_to_int64(float16 a, float_status *s)
3067
{
3068
- return float16_to_int64_scalbn(a, s->float_rounding_mode, 0, s);
3068
+ return float16_to_int64_scalbn(a, get_float_rounding_mode(s), 0, s);
3069
}
3070
3071
int16_t float32_to_int16(float32 a, float_status *s)
3072
{
3073
- return float32_to_int16_scalbn(a, s->float_rounding_mode, 0, s);
3073
+ return float32_to_int16_scalbn(a, get_float_rounding_mode(s), 0, s);
3074
}
3075
3076
int32_t float32_to_int32(float32 a, float_status *s)
3077
{
3078
- return float32_to_int32_scalbn(a, s->float_rounding_mode, 0, s);
3078
+ return float32_to_int32_scalbn(a, get_float_rounding_mode(s), 0, s);
3079
}
3080
3081
int64_t float32_to_int64(float32 a, float_status *s)
3082
{
3083
- return float32_to_int64_scalbn(a, s->float_rounding_mode, 0, s);
3083
+ return float32_to_int64_scalbn(a, get_float_rounding_mode(s), 0, s);
3084
}
3085
3086
int16_t float64_to_int16(float64 a, float_status *s)
3087
{
3088
- return float64_to_int16_scalbn(a, s->float_rounding_mode, 0, s);
3088
+ return float64_to_int16_scalbn(a, get_float_rounding_mode(s), 0, s);
3089
}
3090
3091
int32_t float64_to_int32(float64 a, float_status *s)
3092
{
3093
- return float64_to_int32_scalbn(a, s->float_rounding_mode, 0, s);
3093
+ return float64_to_int32_scalbn(a, get_float_rounding_mode(s), 0, s);
3094
}
3095
3096
int64_t float64_to_int64(float64 a, float_status *s)
3097
{
3098
- return float64_to_int64_scalbn(a, s->float_rounding_mode, 0, s);
3098
+ return float64_to_int64_scalbn(a, get_float_rounding_mode(s), 0, s);
3099
}
3100
3101
int32_t float128_to_int32(float128 a, float_status *s)
3102
{
3103
- return float128_to_int32_scalbn(a, s->float_rounding_mode, 0, s);
3103
+ return float128_to_int32_scalbn(a, get_float_rounding_mode(s), 0, s);
3104
}
3105
3106
int64_t float128_to_int64(float128 a, float_status *s)
3107
{
3108
- return float128_to_int64_scalbn(a, s->float_rounding_mode, 0, s);
3108
+ return float128_to_int64_scalbn(a, get_float_rounding_mode(s), 0, s);
3109
}
3110
3111
Int128 float128_to_int128(float128 a, float_status *s)
3112
{
3113
- return float128_to_int128_scalbn(a, s->float_rounding_mode, 0, s);
3113
+ return float128_to_int128_scalbn(a, get_float_rounding_mode(s), 0, s);
3114
}
3115
3116
int32_t floatx80_to_int32(floatx80 a, float_status *s)
3117
{
3118
- return floatx80_to_int32_scalbn(a, s->float_rounding_mode, 0, s);
3118
+ return floatx80_to_int32_scalbn(a, get_float_rounding_mode(s), 0, s);
3119
}
3120
3121
int64_t floatx80_to_int64(floatx80 a, float_status *s)
3122
{
3123
- return floatx80_to_int64_scalbn(a, s->float_rounding_mode, 0, s);
3123
+ return floatx80_to_int64_scalbn(a, get_float_rounding_mode(s), 0, s);
3124
}
3125
3126
int16_t float16_to_int16_round_to_zero(float16 a, float_status *s)
@@ -3195,22 +3195,22 @@ int64_t floatx80_to_int64_round_to_zero(floatx80 a, float_status *s)
3195
3196
int8_t bfloat16_to_int8(bfloat16 a, float_status *s)
3197
{
3198
- return bfloat16_to_int8_scalbn(a, s->float_rounding_mode, 0, s);
3198
+ return bfloat16_to_int8_scalbn(a, get_float_rounding_mode(s), 0, s);
3199
}
3200
3201
int16_t bfloat16_to_int16(bfloat16 a, float_status *s)
3202
{
3203
- return bfloat16_to_int16_scalbn(a, s->float_rounding_mode, 0, s);
3203
+ return bfloat16_to_int16_scalbn(a, get_float_rounding_mode(s), 0, s);
3204
}
3205
3206
int32_t bfloat16_to_int32(bfloat16 a, float_status *s)
3207
{
3208
- return bfloat16_to_int32_scalbn(a, s->float_rounding_mode, 0, s);
3208
+ return bfloat16_to_int32_scalbn(a, get_float_rounding_mode(s), 0, s);
3209
}
3210
3211
int64_t bfloat16_to_int64(bfloat16 a, float_status *s)
3212
{
3213
- return bfloat16_to_int64_scalbn(a, s->float_rounding_mode, 0, s);
3213
+ return bfloat16_to_int64_scalbn(a, get_float_rounding_mode(s), 0, s);
3214
}
3215
3216
int8_t bfloat16_to_int8_round_to_zero(bfloat16 a, float_status *s)
@@ -3489,67 +3489,67 @@ static Int128 float128_to_uint128_scalbn(float128 a, FloatRoundMode rmode,
3489
3490
uint8_t float16_to_uint8(float16 a, float_status *s)
3491
{
3492
- return float16_to_uint8_scalbn(a, s->float_rounding_mode, 0, s);
3492
+ return float16_to_uint8_scalbn(a, get_float_rounding_mode(s), 0, s);
3493
}
3494
3495
uint16_t float16_to_uint16(float16 a, float_status *s)
3496
{
3497
- return float16_to_uint16_scalbn(a, s->float_rounding_mode, 0, s);
3497
+ return float16_to_uint16_scalbn(a, get_float_rounding_mode(s), 0, s);
3498
}
3499
3500
uint32_t float16_to_uint32(float16 a, float_status *s)
3501
{
3502
- return float16_to_uint32_scalbn(a, s->float_rounding_mode, 0, s);
3502
+ return float16_to_uint32_scalbn(a, get_float_rounding_mode(s), 0, s);
3503
}
3504
3505
uint64_t float16_to_uint64(float16 a, float_status *s)
3506
{
3507
- return float16_to_uint64_scalbn(a, s->float_rounding_mode, 0, s);
3507
+ return float16_to_uint64_scalbn(a, get_float_rounding_mode(s), 0, s);
3508
}
3509
3510
uint16_t float32_to_uint16(float32 a, float_status *s)
3511
{
3512
- return float32_to_uint16_scalbn(a, s->float_rounding_mode, 0, s);
3512
+ return float32_to_uint16_scalbn(a, get_float_rounding_mode(s), 0, s);
3513
}
3514
3515
uint32_t float32_to_uint32(float32 a, float_status *s)
3516
{
3517
- return float32_to_uint32_scalbn(a, s->float_rounding_mode, 0, s);
3517
+ return float32_to_uint32_scalbn(a, get_float_rounding_mode(s), 0, s);
3518
}
3519
3520
uint64_t float32_to_uint64(float32 a, float_status *s)
3521
{
3522
- return float32_to_uint64_scalbn(a, s->float_rounding_mode, 0, s);
3522
+ return float32_to_uint64_scalbn(a, get_float_rounding_mode(s), 0, s);
3523
}
3524
3525
uint16_t float64_to_uint16(float64 a, float_status *s)
3526
{
3527
- return float64_to_uint16_scalbn(a, s->float_rounding_mode, 0, s);
3527
+ return float64_to_uint16_scalbn(a, get_float_rounding_mode(s), 0, s);
3528
}
3529
3530
uint32_t float64_to_uint32(float64 a, float_status *s)
3531
{
3532
- return float64_to_uint32_scalbn(a, s->float_rounding_mode, 0, s);
3532
+ return float64_to_uint32_scalbn(a, get_float_rounding_mode(s), 0, s);
3533
}
3534
3535
uint64_t float64_to_uint64(float64 a, float_status *s)
3536
{
3537
- return float64_to_uint64_scalbn(a, s->float_rounding_mode, 0, s);
3537
+ return float64_to_uint64_scalbn(a, get_float_rounding_mode(s), 0, s);
3538
}
3539
3540
uint32_t float128_to_uint32(float128 a, float_status *s)
3541
{
3542
- return float128_to_uint32_scalbn(a, s->float_rounding_mode, 0, s);
3542
+ return float128_to_uint32_scalbn(a, get_float_rounding_mode(s), 0, s);
3543
}
3544
3545
uint64_t float128_to_uint64(float128 a, float_status *s)
3546
{
3547
- return float128_to_uint64_scalbn(a, s->float_rounding_mode, 0, s);
3547
+ return float128_to_uint64_scalbn(a, get_float_rounding_mode(s), 0, s);
3548
}
3549
3550
Int128 float128_to_uint128(float128 a, float_status *s)
3551
{
3552
- return float128_to_uint128_scalbn(a, s->float_rounding_mode, 0, s);
3552
+ return float128_to_uint128_scalbn(a, get_float_rounding_mode(s), 0, s);
3553
}
3554
3555
uint16_t float16_to_uint16_round_to_zero(float16 a, float_status *s)
@@ -3614,22 +3614,22 @@ Int128 float128_to_uint128_round_to_zero(float128 a, float_status *s)
3614
3615
uint8_t bfloat16_to_uint8(bfloat16 a, float_status *s)
3616
{
3617
- return bfloat16_to_uint8_scalbn(a, s->float_rounding_mode, 0, s);
3617
+ return bfloat16_to_uint8_scalbn(a, get_float_rounding_mode(s), 0, s);
3618
}
3619
3620
uint16_t bfloat16_to_uint16(bfloat16 a, float_status *s)
3621
{
3622
- return bfloat16_to_uint16_scalbn(a, s->float_rounding_mode, 0, s);
3622
+ return bfloat16_to_uint16_scalbn(a, get_float_rounding_mode(s), 0, s);
3623
}
3624
3625
uint32_t bfloat16_to_uint32(bfloat16 a, float_status *s)
3626
{
3627
- return bfloat16_to_uint32_scalbn(a, s->float_rounding_mode, 0, s);
3627
+ return bfloat16_to_uint32_scalbn(a, get_float_rounding_mode(s), 0, s);
3628
}
3629
3630
uint64_t bfloat16_to_uint64(bfloat16 a, float_status *s)
3631
{
3632
- return bfloat16_to_uint64_scalbn(a, s->float_rounding_mode, 0, s);
3632
+ return bfloat16_to_uint64_scalbn(a, get_float_rounding_mode(s), 0, s);
3633
}
3634
3635
uint8_t bfloat16_to_uint8_round_to_zero(bfloat16 a, float_status *s)
@@ -4878,7 +4878,7 @@ floatx80 roundAndPackFloatx80(FloatX80RoundPrec roundingPrecision, bool zSign,
4878
bool roundNearestEven, increment, isTiny;
4879
int64_t roundIncrement, roundMask, roundBits;
4880
4881
- roundingMode = status->float_rounding_mode;
4881
+ roundingMode = get_float_rounding_mode(status);
4882
roundNearestEven = ( roundingMode == float_round_nearest_even );
4883
switch (roundingPrecision) {
4884
case floatx80_precision_x:
target/alpha/fpu_helper.c
+1
-1
@@ -485,7 +485,7 @@ static uint64_t do_cvttq(CPUAlphaState *env, uint64_t a, int roundmode)
485
486
uint64_t helper_cvttq(CPUAlphaState *env, uint64_t a)
487
{
488
- return do_cvttq(env, a, FP_STATUS.float_rounding_mode);
488
+ return do_cvttq(env, a, get_float_rounding_mode(&FP_STATUS));
489
}
490
491
uint64_t helper_cvttq_c(CPUAlphaState *env, uint64_t a)
target/arm/tcg/vfp_helper.c
+4
-4
@@ -423,10 +423,10 @@ ftype HELPER(vfp_##name##to##p)(uint##isz##_t x, uint32_t shift, \
423
float_status *fpst) \
424
{ \
425
ftype ret; \
426
- FloatRoundMode oldmode = fpst->float_rounding_mode; \
427
- fpst->float_rounding_mode = float_round_nearest_even; \
426
+ FloatRoundMode oldmode = get_float_rounding_mode(fpst); \
427
+ set_float_rounding_mode(float_round_nearest_even, fpst); \
428
ret = itype##_to_##float##fsz##_scalbn(x, -shift, fpst); \
429
- fpst->float_rounding_mode = oldmode; \
429
+ set_float_rounding_mode(oldmode, fpst); \
430
return ret; \
431
}
432
@@ -663,7 +663,7 @@ static uint64_t call_recip_estimate(int *exp, int exp_off, uint64_t frac,
663
664
static bool round_to_inf(float_status *fpst, bool sign_bit)
665
{
666
- switch (fpst->float_rounding_mode) {
666
+ switch (get_float_rounding_mode(fpst)) {
667
case float_round_nearest_even: /* Round to Nearest */
668
return true;
669
case float_round_up: /* Round to +Inf */
target/hexagon/fma_emu.c
+3
-3
@@ -315,7 +315,7 @@ static float64 accum_round_float64(Accum a, float_status *fp_status)
315
if ((int128_gethi(a.mant) == 0) && (int128_getlo(a.mant) == 0)
316
&& ((a.guard | a.round | a.sticky) == 0)) {
317
/* result zero */
318
- switch (fp_status->float_rounding_mode) {
318
+ switch (get_float_rounding_mode(fp_status)) {
319
case float_round_down:
320
return zero_float64(1);
321
default:
@@ -362,7 +362,7 @@ static float64 accum_round_float64(Accum a, float_status *fp_status)
362
/* OK, we're relatively canonical... now we need to round */
363
if (a.guard || a.round || a.sticky) {
364
float_raise(float_flag_inexact, fp_status);
365
- switch (fp_status->float_rounding_mode) {
365
+ switch (get_float_rounding_mode(fp_status)) {
366
case float_round_to_zero:
367
/* Chop and we're done */
368
break;
@@ -401,7 +401,7 @@ static float64 accum_round_float64(Accum a, float_status *fp_status)
401
/* Yep, inf result */
402
float_raise(float_flag_overflow, fp_status);
403
float_raise(float_flag_inexact, fp_status);
404
- switch (fp_status->float_rounding_mode) {
404
+ switch (get_float_rounding_mode(fp_status)) {
405
case float_round_to_zero:
406
return maxfinite_float64(a.sign);
407
case float_round_up:
target/i386/ops_sse.h
+10
-14
@@ -601,7 +601,7 @@ void glue(helper_cvtph2ps, SUFFIX)(CPUX86State *env, Reg *d, Reg *s)
601
void glue(helper_cvtps2ph, SUFFIX)(CPUX86State *env, Reg *d, Reg *s, int mode)
602
{
603
int i;
604
- FloatRoundMode prev_rounding_mode = env->sse_status.float_rounding_mode;
604
+ FloatRoundMode prev_rounding_mode = get_float_rounding_mode(&env->sse_status);
605
if (!(mode & (1 << 2))) {
606
set_x86_rounding_mode(mode & 3, &env->sse_status);
607
}
@@ -613,7 +613,7 @@ void glue(helper_cvtps2ph, SUFFIX)(CPUX86State *env, Reg *d, Reg *s, int mode)
613
d->Q(i) = 0;
614
}
615
616
- env->sse_status.float_rounding_mode = prev_rounding_mode;
616
+ set_float_rounding_mode(prev_rounding_mode, &env->sse_status);
617
}
618
#endif
619
@@ -1715,10 +1715,9 @@ void glue(helper_roundps, SUFFIX)(CPUX86State *env, Reg *d, Reg *s,
1715
uint32_t mode)
1716
{
1717
int old_flags = get_float_exception_flags(&env->sse_status);
1718
- signed char prev_rounding_mode;
1718
+ FloatRoundMode prev_rounding_mode = get_float_rounding_mode(&env->sse_status);
1719
int i;
1720
1721
- prev_rounding_mode = env->sse_status.float_rounding_mode;
1721
if (!(mode & (1 << 2))) {
1722
set_x86_rounding_mode(mode & 3, &env->sse_status);
1723
}
@@ -1732,17 +1731,16 @@ void glue(helper_roundps, SUFFIX)(CPUX86State *env, Reg *d, Reg *s,
1731
~float_flag_inexact,
1732
&env->sse_status);
1733
}
1735
- env->sse_status.float_rounding_mode = prev_rounding_mode;
1734
+ set_float_rounding_mode(prev_rounding_mode, &env->sse_status);
1735
}
1736
1737
void glue(helper_roundpd, SUFFIX)(CPUX86State *env, Reg *d, Reg *s,
1738
uint32_t mode)
1739
{
1740
int old_flags = get_float_exception_flags(&env->sse_status);
1742
- signed char prev_rounding_mode;
1741
+ FloatRoundMode prev_rounding_mode = get_float_rounding_mode(&env->sse_status);
1742
int i;
1743
1745
- prev_rounding_mode = env->sse_status.float_rounding_mode;
1744
if (!(mode & (1 << 2))) {
1745
set_x86_rounding_mode(mode & 3, &env->sse_status);
1746
}
@@ -1756,7 +1754,7 @@ void glue(helper_roundpd, SUFFIX)(CPUX86State *env, Reg *d, Reg *s,
1754
~float_flag_inexact,
1755
&env->sse_status);
1756
}
1759
- env->sse_status.float_rounding_mode = prev_rounding_mode;
1757
+ set_float_rounding_mode(prev_rounding_mode, &env->sse_status);
1758
}
1759
1760
#if SHIFT == 1
@@ -1764,10 +1762,9 @@ void glue(helper_roundss, SUFFIX)(CPUX86State *env, Reg *d, Reg *v, Reg *s,
1762
uint32_t mode)
1763
{
1764
int old_flags = get_float_exception_flags(&env->sse_status);
1767
- signed char prev_rounding_mode;
1765
+ FloatRoundMode prev_rounding_mode = get_float_rounding_mode(&env->sse_status);
1766
int i;
1767
1770
- prev_rounding_mode = env->sse_status.float_rounding_mode;
1768
if (!(mode & (1 << 2))) {
1769
set_x86_rounding_mode(mode & 3, &env->sse_status);
1770
}
@@ -1782,17 +1779,16 @@ void glue(helper_roundss, SUFFIX)(CPUX86State *env, Reg *d, Reg *v, Reg *s,
1779
~float_flag_inexact,
1780
&env->sse_status);
1781
}
1785
- env->sse_status.float_rounding_mode = prev_rounding_mode;
1782
+ set_float_rounding_mode(prev_rounding_mode, &env->sse_status);
1783
}
1784
1785
void glue(helper_roundsd, SUFFIX)(CPUX86State *env, Reg *d, Reg *v, Reg *s,
1786
uint32_t mode)
1787
{
1788
int old_flags = get_float_exception_flags(&env->sse_status);
1792
- signed char prev_rounding_mode;
1789
+ FloatRoundMode prev_rounding_mode = get_float_rounding_mode(&env->sse_status);
1790
int i;
1791
1795
- prev_rounding_mode = env->sse_status.float_rounding_mode;
1792
if (!(mode & (1 << 2))) {
1793
set_x86_rounding_mode(mode & 3, &env->sse_status);
1794
}
@@ -1807,7 +1803,7 @@ void glue(helper_roundsd, SUFFIX)(CPUX86State *env, Reg *d, Reg *v, Reg *s,
1803
~float_flag_inexact,
1804
&env->sse_status);
1805
}
1810
- env->sse_status.float_rounding_mode = prev_rounding_mode;
1806
+ set_float_rounding_mode(prev_rounding_mode, &env->sse_status);
1807
}
1808
#endif
1809
target/i386/tcg/fpu_helper.c
+14
-14
@@ -1183,10 +1183,10 @@ void helper_f2xm1(CPUX86State *env)
1183
bool asign, bsign;
1184
int32_t n, aexp, bexp;
1185
uint64_t asig0, asig1, asig2, bsig0, bsig1;
1186
- FloatRoundMode save_mode = env->fp_status.float_rounding_mode;
1186
+ FloatRoundMode save_mode = get_float_rounding_mode(&env->fp_status);
1187
FloatX80RoundPrec save_prec =
1188
env->fp_status.floatx80_rounding_precision;
1189
- env->fp_status.float_rounding_mode = float_round_nearest_even;
1189
+ set_float_rounding_mode(float_round_nearest_even, &env->fp_status);
1190
env->fp_status.floatx80_rounding_precision = floatx80_precision_x;
1191
1192
/* Find the nearest multiple of 1/32 to the argument. */
@@ -1202,7 +1202,7 @@ void helper_f2xm1(CPUX86State *env)
1202
*/
1203
ST0 = f2xm1_table[n].t;
1204
set_float_exception_flags(float_flag_inexact, &env->fp_status);
1205
- env->fp_status.float_rounding_mode = save_mode;
1205
+ set_float_rounding_mode(save_mode, &env->fp_status);
1206
} else {
1207
/*
1208
* Compute the lower parts of a polynomial expansion for
@@ -1282,7 +1282,7 @@ void helper_f2xm1(CPUX86State *env)
1282
asign = bsign;
1283
}
1284
}
1285
- env->fp_status.float_rounding_mode = save_mode;
1285
+ set_float_rounding_mode(save_mode, &env->fp_status);
1286
/* This result is inexact. */
1287
asig1 |= 1;
1288
ST0 = normalizeRoundAndPackFloatx80(floatx80_precision_x,
@@ -1483,10 +1483,10 @@ void helper_fpatan(CPUX86State *env)
1483
uint64_t azsig0, azsig1;
1484
uint64_t azsig2, azsig3, axsig0, axsig1;
1485
floatx80 x8;
1486
- FloatRoundMode save_mode = env->fp_status.float_rounding_mode;
1486
+ FloatRoundMode save_mode = get_float_rounding_mode(&env->fp_status);
1487
FloatX80RoundPrec save_prec =
1488
env->fp_status.floatx80_rounding_precision;
1489
- env->fp_status.float_rounding_mode = float_round_nearest_even;
1489
+ set_float_rounding_mode(float_round_nearest_even, &env->fp_status);
1490
env->fp_status.floatx80_rounding_precision = floatx80_precision_x;
1491
1492
if (arg0_exp == 0) {
@@ -1793,7 +1793,7 @@ void helper_fpatan(CPUX86State *env)
1793
}
1794
}
1795
1796
- env->fp_status.float_rounding_mode = save_mode;
1796
+ set_float_rounding_mode(save_mode, &env->fp_status);
1797
env->fp_status.floatx80_rounding_precision = save_prec;
1798
}
1799
/* This result is inexact. */
@@ -2121,10 +2121,10 @@ void helper_fyl2xp1(CPUX86State *env)
2121
} else {
2122
int32_t aexp;
2123
uint64_t asig0, asig1, asig2;
2124
- FloatRoundMode save_mode = env->fp_status.float_rounding_mode;
2124
+ FloatRoundMode save_mode = get_float_rounding_mode(&env->fp_status);
2125
FloatX80RoundPrec save_prec =
2126
env->fp_status.floatx80_rounding_precision;
2127
- env->fp_status.float_rounding_mode = float_round_nearest_even;
2127
+ set_float_rounding_mode(float_round_nearest_even, &env->fp_status);
2128
env->fp_status.floatx80_rounding_precision = floatx80_precision_x;
2129
2130
helper_fyl2x_common(env, ST0, &aexp, &asig0, &asig1);
@@ -2139,7 +2139,7 @@ void helper_fyl2xp1(CPUX86State *env)
2139
aexp += arg1_exp - 0x3ffe;
2140
/* This result is inexact. */
2141
asig1 |= 1;
2142
- env->fp_status.float_rounding_mode = save_mode;
2142
+ set_float_rounding_mode(save_mode, &env->fp_status);
2143
ST1 = normalizeRoundAndPackFloatx80(floatx80_precision_x,
2144
arg0_sign ^ arg1_sign, aexp,
2145
asig0, asig1, &env->fp_status);
@@ -2224,10 +2224,10 @@ void helper_fyl2x(CPUX86State *env)
2224
} else {
2225
int32_t int_exp;
2226
floatx80 arg0_m1;
2227
- FloatRoundMode save_mode = env->fp_status.float_rounding_mode;
2227
+ FloatRoundMode save_mode = get_float_rounding_mode(&env->fp_status);
2228
FloatX80RoundPrec save_prec =
2229
env->fp_status.floatx80_rounding_precision;
2230
- env->fp_status.float_rounding_mode = float_round_nearest_even;
2230
+ set_float_rounding_mode(float_round_nearest_even, &env->fp_status);
2231
env->fp_status.floatx80_rounding_precision = floatx80_precision_x;
2232
2233
if (arg0_exp == 0) {
@@ -2245,7 +2245,7 @@ void helper_fyl2x(CPUX86State *env)
2245
floatx80_one, &env->fp_status);
2246
if (floatx80_is_zero(arg0_m1)) {
2247
/* Exact power of 2; multiply by ST1. */
2248
- env->fp_status.float_rounding_mode = save_mode;
2248
+ set_float_rounding_mode(save_mode, &env->fp_status);
2249
ST1 = floatx80_mul(int32_to_floatx80(int_exp, &env->fp_status),
2250
ST1, &env->fp_status);
2251
} else {
@@ -2284,7 +2284,7 @@ void helper_fyl2x(CPUX86State *env)
2284
aexp += arg1_exp - 0x3ffe;
2285
/* This result is inexact. */
2286
asig1 |= 1;
2287
- env->fp_status.float_rounding_mode = save_mode;
2287
+ set_float_rounding_mode(save_mode, &env->fp_status);
2288
ST1 = normalizeRoundAndPackFloatx80(floatx80_precision_x,
2289
asign ^ arg1_sign, aexp,
2290
asig0, asig1, &env->fp_status);
target/m68k/softfloat.c
+85
-85
@@ -266,9 +266,9 @@ floatx80 floatx80_lognp1(floatx80 a, float_status *status)
266
return floatx80_move(a, status);
267
}
268
269
- user_rnd_mode = status->float_rounding_mode;
269
+ user_rnd_mode = get_float_rounding_mode(status);
270
user_rnd_prec = status->floatx80_rounding_precision;
271
- status->float_rounding_mode = float_round_nearest_even;
271
+ set_float_rounding_mode(float_round_nearest_even, status);
272
status->floatx80_rounding_precision = floatx80_precision_x;
273
274
compact = floatx80_make_compact(aExp, aSig);
@@ -336,7 +336,7 @@ floatx80 floatx80_lognp1(floatx80 a, float_status *status)
336
status); /* LOG(F)+U*V*(A2+V*(A4+V*A6)) */
337
fp0 = floatx80_add(fp0, fp1, status); /* FP0 IS LOG(F) + LOG(1+U) */
338
339
- status->float_rounding_mode = user_rnd_mode;
339
+ set_float_rounding_mode(user_rnd_mode, status);
340
status->floatx80_rounding_precision = user_rnd_prec;
341
342
a = floatx80_add(fp0, klog2, status);
@@ -402,7 +402,7 @@ floatx80 floatx80_lognp1(floatx80 a, float_status *status)
402
fp0 = floatx80_mul(fp0, fp1,
403
status); /* U*V*([B1+W*(B3+W*B5)] + [V*(B2+W*B4)]) */
404
405
- status->float_rounding_mode = user_rnd_mode;
405
+ set_float_rounding_mode(user_rnd_mode, status);
406
status->floatx80_rounding_precision = user_rnd_prec;
407
408
a = floatx80_add(fp0, saveu, status);
@@ -464,9 +464,9 @@ floatx80 floatx80_logn(floatx80 a, float_status *status)
464
return floatx80_default_nan(status);
465
}
466
467
- user_rnd_mode = status->float_rounding_mode;
467
+ user_rnd_mode = get_float_rounding_mode(status);
468
user_rnd_prec = status->floatx80_rounding_precision;
469
- status->float_rounding_mode = float_round_nearest_even;
469
+ set_float_rounding_mode(float_round_nearest_even, status);
470
status->floatx80_rounding_precision = floatx80_precision_x;
471
472
compact = floatx80_make_compact(aExp, aSig);
@@ -523,7 +523,7 @@ floatx80 floatx80_logn(floatx80 a, float_status *status)
523
status); /* LOG(F)+U*V*(A2+V*(A4+V*A6)) */
524
fp0 = floatx80_add(fp0, fp1, status); /* FP0 IS LOG(F) + LOG(1+U) */
525
526
- status->float_rounding_mode = user_rnd_mode;
526
+ set_float_rounding_mode(user_rnd_mode, status);
527
status->floatx80_rounding_precision = user_rnd_prec;
528
529
a = floatx80_add(fp0, klog2, status);
@@ -569,7 +569,7 @@ floatx80 floatx80_logn(floatx80 a, float_status *status)
569
fp0 = floatx80_mul(fp0, fp1,
570
status); /* U*V*([B1+W*(B3+W*B5)] + [V*(B2+W*B4)]) */
571
572
- status->float_rounding_mode = user_rnd_mode;
572
+ set_float_rounding_mode(user_rnd_mode, status);
573
status->floatx80_rounding_precision = user_rnd_prec;
574
575
a = floatx80_add(fp0, saveu, status);
@@ -620,15 +620,15 @@ floatx80 floatx80_log10(floatx80 a, float_status *status)
620
return floatx80_default_nan(status);
621
}
622
623
- user_rnd_mode = status->float_rounding_mode;
623
+ user_rnd_mode = get_float_rounding_mode(status);
624
user_rnd_prec = status->floatx80_rounding_precision;
625
- status->float_rounding_mode = float_round_nearest_even;
625
+ set_float_rounding_mode(float_round_nearest_even, status);
626
status->floatx80_rounding_precision = floatx80_precision_x;
627
628
fp0 = floatx80_logn(a, status);
629
fp1 = packFloatx80(0, 0x3FFD, UINT64_C(0xDE5BD8A937287195)); /* INV_L10 */
630
631
- status->float_rounding_mode = user_rnd_mode;
631
+ set_float_rounding_mode(user_rnd_mode, status);
632
status->floatx80_rounding_precision = user_rnd_prec;
633
634
a = floatx80_mul(fp0, fp1, status); /* LOGN(X)*INV_L10 */
@@ -679,13 +679,13 @@ floatx80 floatx80_log2(floatx80 a, float_status *status)
679
return floatx80_default_nan(status);
680
}
681
682
- user_rnd_mode = status->float_rounding_mode;
682
+ user_rnd_mode = get_float_rounding_mode(status);
683
user_rnd_prec = status->floatx80_rounding_precision;
684
- status->float_rounding_mode = float_round_nearest_even;
684
+ set_float_rounding_mode(float_round_nearest_even, status);
685
status->floatx80_rounding_precision = floatx80_precision_x;
686
687
if (aSig == one_sig) { /* X is 2^k */
688
- status->float_rounding_mode = user_rnd_mode;
688
+ set_float_rounding_mode(user_rnd_mode, status);
689
status->floatx80_rounding_precision = user_rnd_prec;
690
691
a = int32_to_floatx80(aExp - 0x3FFF, status);
@@ -693,7 +693,7 @@ floatx80 floatx80_log2(floatx80 a, float_status *status)
693
fp0 = floatx80_logn(a, status);
694
fp1 = packFloatx80(0, 0x3FFF, UINT64_C(0xB8AA3B295C17F0BC)); /* INV_L2 */
695
696
- status->float_rounding_mode = user_rnd_mode;
696
+ set_float_rounding_mode(user_rnd_mode, status);
697
status->floatx80_rounding_precision = user_rnd_prec;
698
699
a = floatx80_mul(fp0, fp1, status); /* LOGN(X)*INV_L2 */
@@ -739,9 +739,9 @@ floatx80 floatx80_etox(floatx80 a, float_status *status)
739
return packFloatx80(0, one_exp, one_sig);
740
}
741
742
- user_rnd_mode = status->float_rounding_mode;
742
+ user_rnd_mode = get_float_rounding_mode(status);
743
user_rnd_prec = status->floatx80_rounding_precision;
744
- status->float_rounding_mode = float_round_nearest_even;
744
+ set_float_rounding_mode(float_round_nearest_even, status);
745
status->floatx80_rounding_precision = floatx80_precision_x;
746
747
adjflag = 0;
@@ -817,7 +817,7 @@ floatx80 floatx80_etox(floatx80 a, float_status *status)
817
fp0 = floatx80_mul(fp0, adjscale, status);
818
}
819
820
- status->float_rounding_mode = user_rnd_mode;
820
+ set_float_rounding_mode(user_rnd_mode, status);
821
status->floatx80_rounding_precision = user_rnd_prec;
822
823
a = floatx80_mul(fp0, scale, status);
@@ -827,7 +827,7 @@ floatx80 floatx80_etox(floatx80 a, float_status *status)
827
return a;
828
} else { /* |X| >= 16380 log2 */
829
if (compact > 0x400CB27C) { /* |X| >= 16480 log2 */
830
- status->float_rounding_mode = user_rnd_mode;
830
+ set_float_rounding_mode(user_rnd_mode, status);
831
status->floatx80_rounding_precision = user_rnd_prec;
832
if (aSign) {
833
a = roundAndPackFloatx80(
@@ -876,7 +876,7 @@ floatx80 floatx80_etox(floatx80 a, float_status *status)
876
}
877
}
878
} else { /* |X| < 2^(-65) */
879
- status->float_rounding_mode = user_rnd_mode;
879
+ set_float_rounding_mode(user_rnd_mode, status);
880
status->floatx80_rounding_precision = user_rnd_prec;
881
882
a = floatx80_add(a, float32_to_floatx80(make_float32(0x3F800000),
@@ -922,9 +922,9 @@ floatx80 floatx80_twotox(floatx80 a, float_status *status)
922
return packFloatx80(0, one_exp, one_sig);
923
}
924
925
- user_rnd_mode = status->float_rounding_mode;
925
+ user_rnd_mode = get_float_rounding_mode(status);
926
user_rnd_prec = status->floatx80_rounding_precision;
927
- status->float_rounding_mode = float_round_nearest_even;
927
+ set_float_rounding_mode(float_round_nearest_even, status);
928
status->floatx80_rounding_precision = floatx80_precision_x;
929
930
fp0 = a;
@@ -934,7 +934,7 @@ floatx80 floatx80_twotox(floatx80 a, float_status *status)
934
if (compact < 0x3FB98000 || compact > 0x400D80C0) {
935
/* |X| > 16480 or |X| < 2^(-70) */
936
if (compact > 0x3FFF8000) { /* |X| > 16480 */
937
- status->float_rounding_mode = user_rnd_mode;
937
+ set_float_rounding_mode(user_rnd_mode, status);
938
status->floatx80_rounding_precision = user_rnd_prec;
939
940
if (aSign) {
@@ -945,7 +945,7 @@ floatx80 floatx80_twotox(floatx80 a, float_status *status)
945
0, 0x8000, aSig, 0, status);
946
}
947
} else { /* |X| < 2^(-70) */
948
- status->float_rounding_mode = user_rnd_mode;
948
+ set_float_rounding_mode(user_rnd_mode, status);
949
status->floatx80_rounding_precision = user_rnd_prec;
950
951
a = floatx80_add(fp0, float32_to_floatx80(
@@ -1027,7 +1027,7 @@ floatx80 floatx80_twotox(floatx80 a, float_status *status)
1027
fp0 = floatx80_add(fp0, fact2, status);
1028
fp0 = floatx80_add(fp0, fact1, status);
1029
1030
- status->float_rounding_mode = user_rnd_mode;
1030
+ set_float_rounding_mode(user_rnd_mode, status);
1031
status->floatx80_rounding_precision = user_rnd_prec;
1032
1033
a = floatx80_mul(fp0, adjfact, status);
@@ -1072,9 +1072,9 @@ floatx80 floatx80_tentox(floatx80 a, float_status *status)
1072
return packFloatx80(0, one_exp, one_sig);
1073
}
1074
1075
- user_rnd_mode = status->float_rounding_mode;
1075
+ user_rnd_mode = get_float_rounding_mode(status);
1076
user_rnd_prec = status->floatx80_rounding_precision;
1077
- status->float_rounding_mode = float_round_nearest_even;
1077
+ set_float_rounding_mode(float_round_nearest_even, status);
1078
status->floatx80_rounding_precision = floatx80_precision_x;
1079
1080
fp0 = a;
@@ -1084,7 +1084,7 @@ floatx80 floatx80_tentox(floatx80 a, float_status *status)
1084
if (compact < 0x3FB98000 || compact > 0x400B9B07) {
1085
/* |X| > 16480 LOG2/LOG10 or |X| < 2^(-70) */
1086
if (compact > 0x3FFF8000) { /* |X| > 16480 */
1087
- status->float_rounding_mode = user_rnd_mode;
1087
+ set_float_rounding_mode(user_rnd_mode, status);
1088
status->floatx80_rounding_precision = user_rnd_prec;
1089
1090
if (aSign) {
@@ -1095,7 +1095,7 @@ floatx80 floatx80_tentox(floatx80 a, float_status *status)
1095
0, 0x8000, aSig, 0, status);
1096
}
1097
} else { /* |X| < 2^(-70) */
1098
- status->float_rounding_mode = user_rnd_mode;
1098
+ set_float_rounding_mode(user_rnd_mode, status);
1099
status->floatx80_rounding_precision = user_rnd_prec;
1100
1101
a = floatx80_add(fp0, float32_to_floatx80(
@@ -1182,7 +1182,7 @@ floatx80 floatx80_tentox(floatx80 a, float_status *status)
1182
fp0 = floatx80_add(fp0, fact2, status);
1183
fp0 = floatx80_add(fp0, fact1, status);
1184
1185
- status->float_rounding_mode = user_rnd_mode;
1185
+ set_float_rounding_mode(user_rnd_mode, status);
1186
status->floatx80_rounding_precision = user_rnd_prec;
1187
1188
a = floatx80_mul(fp0, adjfact, status);
@@ -1227,9 +1227,9 @@ floatx80 floatx80_tan(floatx80 a, float_status *status)
1227
return packFloatx80(aSign, 0, 0);
1228
}
1229
1230
- user_rnd_mode = status->float_rounding_mode;
1230
+ user_rnd_mode = get_float_rounding_mode(status);
1231
user_rnd_prec = status->floatx80_rounding_precision;
1232
- status->float_rounding_mode = float_round_nearest_even;
1232
+ set_float_rounding_mode(float_round_nearest_even, status);
1233
status->floatx80_rounding_precision = floatx80_precision_x;
1234
1235
compact = floatx80_make_compact(aExp, aSig);
@@ -1294,7 +1294,7 @@ floatx80 floatx80_tan(floatx80 a, float_status *status)
1294
fp1 = floatx80_add(fp1, fp3, status); /* FP1 is r := (A-R)+a */
1295
goto loop;
1296
} else {
1297
- status->float_rounding_mode = user_rnd_mode;
1297
+ set_float_rounding_mode(user_rnd_mode, status);
1298
status->floatx80_rounding_precision = user_rnd_prec;
1299
1300
a = floatx80_move(a, status);
@@ -1354,7 +1354,7 @@ floatx80 floatx80_tan(floatx80 a, float_status *status)
1354
xSign ^= 1;
1355
fp1 = packFloatx80(xSign, xExp, xSig);
1356
1357
- status->float_rounding_mode = user_rnd_mode;
1357
+ set_float_rounding_mode(user_rnd_mode, status);
1358
status->floatx80_rounding_precision = user_rnd_prec;
1359
1360
a = floatx80_div(fp0, fp1, status);
@@ -1392,7 +1392,7 @@ floatx80 floatx80_tan(floatx80 a, float_status *status)
1392
make_float32(0x3F800000), status),
1393
status); /* 1+S(Q1+S(Q2+S(Q3+SQ4))) */
1394
1395
- status->float_rounding_mode = user_rnd_mode;
1395
+ set_float_rounding_mode(user_rnd_mode, status);
1396
status->floatx80_rounding_precision = user_rnd_prec;
1397
1398
a = floatx80_div(fp0, fp1, status);
@@ -1438,9 +1438,9 @@ floatx80 floatx80_sin(floatx80 a, float_status *status)
1438
return packFloatx80(aSign, 0, 0);
1439
}
1440
1441
- user_rnd_mode = status->float_rounding_mode;
1441
+ user_rnd_mode = get_float_rounding_mode(status);
1442
user_rnd_prec = status->floatx80_rounding_precision;
1443
- status->float_rounding_mode = float_round_nearest_even;
1443
+ set_float_rounding_mode(float_round_nearest_even, status);
1444
status->floatx80_rounding_precision = floatx80_precision_x;
1445
1446
compact = floatx80_make_compact(aExp, aSig);
@@ -1509,7 +1509,7 @@ floatx80 floatx80_sin(floatx80 a, float_status *status)
1509
fp0 = float32_to_floatx80(make_float32(0x3F800000),
1510
status); /* 1 */
1511
1512
- status->float_rounding_mode = user_rnd_mode;
1512
+ set_float_rounding_mode(user_rnd_mode, status);
1513
status->floatx80_rounding_precision = user_rnd_prec;
1514
1515
/* SINTINY */
@@ -1582,7 +1582,7 @@ floatx80 floatx80_sin(floatx80 a, float_status *status)
1582
x = packFloatx80(xSign, xExp, xSig);
1583
fp0 = floatx80_mul(fp0, x, status);
1584
1585
- status->float_rounding_mode = user_rnd_mode;
1585
+ set_float_rounding_mode(user_rnd_mode, status);
1586
status->floatx80_rounding_precision = user_rnd_prec;
1587
1588
a = floatx80_add(fp0, float32_to_floatx80(posneg1, status), status);
@@ -1632,7 +1632,7 @@ floatx80 floatx80_sin(floatx80 a, float_status *status)
1632
fp0 = floatx80_mul(fp0, x, status); /* R'*S */
1633
fp0 = floatx80_mul(fp0, fp1, status); /* SIN(R')-R' */
1634
1635
- status->float_rounding_mode = user_rnd_mode;
1635
+ set_float_rounding_mode(user_rnd_mode, status);
1636
status->floatx80_rounding_precision = user_rnd_prec;
1637
1638
a = floatx80_add(fp0, x, status);
@@ -1678,9 +1678,9 @@ floatx80 floatx80_cos(floatx80 a, float_status *status)
1678
return packFloatx80(0, one_exp, one_sig);
1679
}
1680
1681
- user_rnd_mode = status->float_rounding_mode;
1681
+ user_rnd_mode = get_float_rounding_mode(status);
1682
user_rnd_prec = status->floatx80_rounding_precision;
1683
- status->float_rounding_mode = float_round_nearest_even;
1683
+ set_float_rounding_mode(float_round_nearest_even, status);
1684
status->floatx80_rounding_precision = floatx80_precision_x;
1685
1686
compact = floatx80_make_compact(aExp, aSig);
@@ -1748,7 +1748,7 @@ floatx80 floatx80_cos(floatx80 a, float_status *status)
1748
/* SINSM */
1749
fp0 = float32_to_floatx80(make_float32(0x3F800000), status); /* 1 */
1750
1751
- status->float_rounding_mode = user_rnd_mode;
1751
+ set_float_rounding_mode(user_rnd_mode, status);
1752
status->floatx80_rounding_precision = user_rnd_prec;
1753
1754
/* COSTINY */
@@ -1822,7 +1822,7 @@ floatx80 floatx80_cos(floatx80 a, float_status *status)
1822
x = packFloatx80(xSign, xExp, xSig);
1823
fp0 = floatx80_mul(fp0, x, status);
1824
1825
- status->float_rounding_mode = user_rnd_mode;
1825
+ set_float_rounding_mode(user_rnd_mode, status);
1826
status->floatx80_rounding_precision = user_rnd_prec;
1827
1828
a = floatx80_add(fp0, float32_to_floatx80(posneg1, status), status);
@@ -1870,7 +1870,7 @@ floatx80 floatx80_cos(floatx80 a, float_status *status)
1870
fp0 = floatx80_mul(fp0, x, status); /* R'*S */
1871
fp0 = floatx80_mul(fp0, fp1, status); /* SIN(R')-R' */
1872
1873
- status->float_rounding_mode = user_rnd_mode;
1873
+ set_float_rounding_mode(user_rnd_mode, status);
1874
status->floatx80_rounding_precision = user_rnd_prec;
1875
1876
a = floatx80_add(fp0, x, status);
@@ -1917,9 +1917,9 @@ floatx80 floatx80_atan(floatx80 a, float_status *status)
1917
1918
compact = floatx80_make_compact(aExp, aSig);
1919
1920
- user_rnd_mode = status->float_rounding_mode;
1920
+ user_rnd_mode = get_float_rounding_mode(status);
1921
user_rnd_prec = status->floatx80_rounding_precision;
1922
- status->float_rounding_mode = float_round_nearest_even;
1922
+ set_float_rounding_mode(float_round_nearest_even, status);
1923
status->floatx80_rounding_precision = floatx80_precision_x;
1924
1925
if (compact < 0x3FFB8000 || compact > 0x4002FFFF) {
@@ -1929,7 +1929,7 @@ floatx80 floatx80_atan(floatx80 a, float_status *status)
1929
fp0 = packFloatx80(aSign, piby2_exp, pi_sig);
1930
fp1 = packFloatx80(aSign, 0x0001, one_sig);
1931
1932
- status->float_rounding_mode = user_rnd_mode;
1932
+ set_float_rounding_mode(user_rnd_mode, status);
1933
status->floatx80_rounding_precision = user_rnd_prec;
1934
1935
a = floatx80_sub(fp0, fp1, status);
@@ -1969,7 +1969,7 @@ floatx80 floatx80_atan(floatx80 a, float_status *status)
1969
fp0 = floatx80_add(fp0, xsave, status);
1970
fp1 = packFloatx80(aSign, piby2_exp, pi_sig);
1971
1972
- status->float_rounding_mode = user_rnd_mode;
1972
+ set_float_rounding_mode(user_rnd_mode, status);
1973
status->floatx80_rounding_precision = user_rnd_prec;
1974
1975
a = floatx80_add(fp0, fp1, status);
@@ -1980,7 +1980,7 @@ floatx80 floatx80_atan(floatx80 a, float_status *status)
1980
}
1981
} else { /* |X| < 1/16 */
1982
if (compact < 0x3FD78000) { /* |X| < 2^(-40) */
1983
- status->float_rounding_mode = user_rnd_mode;
1983
+ set_float_rounding_mode(user_rnd_mode, status);
1984
status->floatx80_rounding_precision = user_rnd_prec;
1985
1986
a = floatx80_move(a, status);
@@ -2020,7 +2020,7 @@ floatx80 floatx80_atan(floatx80 a, float_status *status)
2020
/* X*Y*([B1+Z*(B3+Z*B5)]+[Y*(B2+Z*(B4+Z*B6))]) */
2021
fp0 = floatx80_mul(fp0, fp1, status);
2022
2023
- status->float_rounding_mode = user_rnd_mode;
2023
+ set_float_rounding_mode(user_rnd_mode, status);
2024
status->floatx80_rounding_precision = user_rnd_prec;
2025
2026
a = floatx80_add(fp0, xsave, status);
@@ -2069,7 +2069,7 @@ floatx80 floatx80_atan(floatx80 a, float_status *status)
2069
fp1 = floatx80_mul(fp1, fp2, status); /* A1*U*V*(A2+V*(A3+V)) */
2070
fp0 = floatx80_add(fp0, fp1, status); /* ATAN(U) */
2071
2072
- status->float_rounding_mode = user_rnd_mode;
2072
+ set_float_rounding_mode(user_rnd_mode, status);
2073
status->floatx80_rounding_precision = user_rnd_prec;
2074
2075
a = floatx80_add(fp0, fp3, status); /* ATAN(X) */
@@ -2122,9 +2122,9 @@ floatx80 floatx80_asin(floatx80 a, float_status *status)
2122
2123
} /* |X| < 1 */
2124
2125
- user_rnd_mode = status->float_rounding_mode;
2125
+ user_rnd_mode = get_float_rounding_mode(status);
2126
user_rnd_prec = status->floatx80_rounding_precision;
2127
- status->float_rounding_mode = float_round_nearest_even;
2127
+ set_float_rounding_mode(float_round_nearest_even, status);
2128
status->floatx80_rounding_precision = floatx80_precision_x;
2129
2130
one = packFloatx80(0, one_exp, one_sig);
@@ -2136,7 +2136,7 @@ floatx80 floatx80_asin(floatx80 a, float_status *status)
2136
fp1 = floatx80_sqrt(fp1, status); /* SQRT((1+X)*(1-X)) */
2137
fp0 = floatx80_div(fp0, fp1, status); /* X/SQRT((1+X)*(1-X)) */
2138
2139
- status->float_rounding_mode = user_rnd_mode;
2139
+ set_float_rounding_mode(user_rnd_mode, status);
2140
status->floatx80_rounding_precision = user_rnd_prec;
2141
2142
a = floatx80_atan(fp0, status); /* ATAN(X/SQRT((1+X)*(1-X))) */
@@ -2192,9 +2192,9 @@ floatx80 floatx80_acos(floatx80 a, float_status *status)
2192
}
2193
} /* |X| < 1 */
2194
2195
- user_rnd_mode = status->float_rounding_mode;
2195
+ user_rnd_mode = get_float_rounding_mode(status);
2196
user_rnd_prec = status->floatx80_rounding_precision;
2197
- status->float_rounding_mode = float_round_nearest_even;
2197
+ set_float_rounding_mode(float_round_nearest_even, status);
2198
status->floatx80_rounding_precision = floatx80_precision_x;
2199
2200
one = packFloatx80(0, one_exp, one_sig);
@@ -2206,7 +2206,7 @@ floatx80 floatx80_acos(floatx80 a, float_status *status)
2206
fp0 = floatx80_sqrt(fp0, status); /* SQRT((1-X)/(1+X)) */
2207
fp0 = floatx80_atan(fp0, status); /* ATAN(SQRT((1-X)/(1+X))) */
2208
2209
- status->float_rounding_mode = user_rnd_mode;
2209
+ set_float_rounding_mode(user_rnd_mode, status);
2210
status->floatx80_rounding_precision = user_rnd_prec;
2211
2212
a = floatx80_add(fp0, fp0, status); /* 2 * ATAN(SQRT((1-X)/(1+X))) */
@@ -2256,9 +2256,9 @@ floatx80 floatx80_atanh(floatx80 a, float_status *status)
2256
}
2257
} /* |X| < 1 */
2258
2259
- user_rnd_mode = status->float_rounding_mode;
2259
+ user_rnd_mode = get_float_rounding_mode(status);
2260
user_rnd_prec = status->floatx80_rounding_precision;
2261
- status->float_rounding_mode = float_round_nearest_even;
2261
+ set_float_rounding_mode(float_round_nearest_even, status);
2262
status->floatx80_rounding_precision = floatx80_precision_x;
2263
2264
one = packFloatx80(0, one_exp, one_sig);
@@ -2270,7 +2270,7 @@ floatx80 floatx80_atanh(floatx80 a, float_status *status)
2270
fp0 = floatx80_div(fp0, fp1, status); /* Z = 2Y/(1-Y) */
2271
fp0 = floatx80_lognp1(fp0, status); /* LOG1P(Z) */
2272
2273
- status->float_rounding_mode = user_rnd_mode;
2273
+ set_float_rounding_mode(user_rnd_mode, status);
2274
status->floatx80_rounding_precision = user_rnd_prec;
2275
2276
a = floatx80_mul(fp0, fp2,
@@ -2315,9 +2315,9 @@ floatx80 floatx80_etoxm1(floatx80 a, float_status *status)
2315
return packFloatx80(aSign, 0, 0);
2316
}
2317
2318
- user_rnd_mode = status->float_rounding_mode;
2318
+ user_rnd_mode = get_float_rounding_mode(status);
2319
user_rnd_prec = status->floatx80_rounding_precision;
2320
- status->float_rounding_mode = float_round_nearest_even;
2320
+ set_float_rounding_mode(float_round_nearest_even, status);
2321
status->floatx80_rounding_precision = floatx80_precision_x;
2322
2323
if (aExp >= 0x3FFD) { /* |X| >= 1/4 */
@@ -2410,7 +2410,7 @@ floatx80 floatx80_etoxm1(floatx80 a, float_status *status)
2410
2411
sc = packFloatx80(0, m + 0x3FFF, one_sig);
2412
2413
- status->float_rounding_mode = user_rnd_mode;
2413
+ set_float_rounding_mode(user_rnd_mode, status);
2414
status->floatx80_rounding_precision = user_rnd_prec;
2415
2416
a = floatx80_mul(fp0, sc, status);
@@ -2423,7 +2423,7 @@ floatx80 floatx80_etoxm1(floatx80 a, float_status *status)
2423
fp0 = float32_to_floatx80(make_float32(0xBF800000),
2424
status); /* -1 */
2425
2426
- status->float_rounding_mode = user_rnd_mode;
2426
+ set_float_rounding_mode(user_rnd_mode, status);
2427
status->floatx80_rounding_precision = user_rnd_prec;
2428
2429
a = floatx80_add(fp0, float32_to_floatx80(
@@ -2434,7 +2434,7 @@ floatx80 floatx80_etoxm1(floatx80 a, float_status *status)
2434
2435
return a;
2436
} else {
2437
- status->float_rounding_mode = user_rnd_mode;
2437
+ set_float_rounding_mode(user_rnd_mode, status);
2438
status->floatx80_rounding_precision = user_rnd_prec;
2439
2440
return floatx80_etox(a, status);
@@ -2495,7 +2495,7 @@ floatx80 floatx80_etoxm1(floatx80 a, float_status *status)
2495
fp1 = floatx80_add(fp1, fp2, status); /* Q */
2496
fp0 = floatx80_add(fp0, fp1, status); /* S*B1+Q */
2497
2498
- status->float_rounding_mode = user_rnd_mode;
2498
+ set_float_rounding_mode(user_rnd_mode, status);
2499
status->floatx80_rounding_precision = user_rnd_prec;
2500
2501
a = floatx80_add(fp0, a, status);
@@ -2513,14 +2513,14 @@ floatx80 floatx80_etoxm1(floatx80 a, float_status *status)
2513
status);
2514
fp0 = floatx80_add(fp0, sc, status);
2515
2516
- status->float_rounding_mode = user_rnd_mode;
2516
+ set_float_rounding_mode(user_rnd_mode, status);
2517
status->floatx80_rounding_precision = user_rnd_prec;
2518
2519
a = floatx80_mul(fp0, float64_to_floatx80(
2520
make_float64(0x3730000000000000), status),
2521
status);
2522
} else {
2523
- status->float_rounding_mode = user_rnd_mode;
2523
+ set_float_rounding_mode(user_rnd_mode, status);
2524
status->floatx80_rounding_precision = user_rnd_prec;
2525
2526
a = floatx80_add(fp0, sc, status);
@@ -2565,9 +2565,9 @@ floatx80 floatx80_tanh(floatx80 a, float_status *status)
2565
return packFloatx80(aSign, 0, 0);
2566
}
2567
2568
- user_rnd_mode = status->float_rounding_mode;
2568
+ user_rnd_mode = get_float_rounding_mode(status);
2569
user_rnd_prec = status->floatx80_rounding_precision;
2570
- status->float_rounding_mode = float_round_nearest_even;
2570
+ set_float_rounding_mode(float_round_nearest_even, status);
2571
status->floatx80_rounding_precision = floatx80_precision_x;
2572
2573
compact = floatx80_make_compact(aExp, aSig);
@@ -2576,7 +2576,7 @@ floatx80 floatx80_tanh(floatx80 a, float_status *status)
2576
/* TANHBORS */
2577
if (compact < 0x3FFF8000) {
2578
/* TANHSM */
2579
- status->float_rounding_mode = user_rnd_mode;
2579
+ set_float_rounding_mode(user_rnd_mode, status);
2580
status->floatx80_rounding_precision = user_rnd_prec;
2581
2582
a = floatx80_move(a, status);
@@ -2593,7 +2593,7 @@ floatx80 floatx80_tanh(floatx80 a, float_status *status)
2593
sign &= 0x80000000;
2594
sign ^= 0x80800000; /* -SIGN(X)*EPS */
2595
2596
- status->float_rounding_mode = user_rnd_mode;
2596
+ set_float_rounding_mode(user_rnd_mode, status);
2597
status->floatx80_rounding_precision = user_rnd_prec;
2598
2599
a = floatx80_add(fp0, float32_to_floatx80(make_float32(sign),
@@ -2615,7 +2615,7 @@ floatx80 floatx80_tanh(floatx80 a, float_status *status)
2615
fp0 = float32_to_floatx80(make_float32(sign | 0x3F800000),
2616
status); /* SIGN */
2617
2618
- status->float_rounding_mode = user_rnd_mode;
2618
+ set_float_rounding_mode(user_rnd_mode, status);
2619
status->floatx80_rounding_precision = user_rnd_prec;
2620
2621
a = floatx80_add(fp1, fp0, status);
@@ -2638,7 +2638,7 @@ floatx80 floatx80_tanh(floatx80 a, float_status *status)
2638
2639
fp1 = packFloatx80(vSign ^ aSign, vExp, vSig);
2640
2641
- status->float_rounding_mode = user_rnd_mode;
2641
+ set_float_rounding_mode(user_rnd_mode, status);
2642
status->floatx80_rounding_precision = user_rnd_prec;
2643
2644
a = floatx80_div(fp0, fp1, status);
@@ -2681,9 +2681,9 @@ floatx80 floatx80_sinh(floatx80 a, float_status *status)
2681
return packFloatx80(aSign, 0, 0);
2682
}
2683
2684
- user_rnd_mode = status->float_rounding_mode;
2684
+ user_rnd_mode = get_float_rounding_mode(status);
2685
user_rnd_prec = status->floatx80_rounding_precision;
2686
- status->float_rounding_mode = float_round_nearest_even;
2686
+ set_float_rounding_mode(float_round_nearest_even, status);
2687
status->floatx80_rounding_precision = floatx80_precision_x;
2688
2689
compact = floatx80_make_compact(aExp, aSig);
@@ -2691,7 +2691,7 @@ floatx80 floatx80_sinh(floatx80 a, float_status *status)
2691
if (compact > 0x400CB167) {
2692
/* SINHBIG */
2693
if (compact > 0x400CB2B3) {
2694
- status->float_rounding_mode = user_rnd_mode;
2694
+ set_float_rounding_mode(user_rnd_mode, status);
2695
status->floatx80_rounding_precision = user_rnd_prec;
2696
2697
return roundAndPackFloatx80(status->floatx80_rounding_precision,
@@ -2707,7 +2707,7 @@ floatx80 floatx80_sinh(floatx80 a, float_status *status)
2707
fp0 = floatx80_etox(fp0, status);
2708
fp2 = packFloatx80(aSign, 0x7FFB, one_sig);
2709
2710
- status->float_rounding_mode = user_rnd_mode;
2710
+ set_float_rounding_mode(user_rnd_mode, status);
2711
status->floatx80_rounding_precision = user_rnd_prec;
2712
2713
a = floatx80_mul(fp0, fp2, status);
@@ -2727,7 +2727,7 @@ floatx80 floatx80_sinh(floatx80 a, float_status *status)
2727
2728
fact = packFloat32(aSign, 0x7E, 0);
2729
2730
- status->float_rounding_mode = user_rnd_mode;
2730
+ set_float_rounding_mode(user_rnd_mode, status);
2731
status->floatx80_rounding_precision = user_rnd_prec;
2732
2733
a = floatx80_mul(fp0, float32_to_floatx80(fact, status), status);
@@ -2767,16 +2767,16 @@ floatx80 floatx80_cosh(floatx80 a, float_status *status)
2767
return packFloatx80(0, one_exp, one_sig);
2768
}
2769
2770
- user_rnd_mode = status->float_rounding_mode;
2770
+ user_rnd_mode = get_float_rounding_mode(status);
2771
user_rnd_prec = status->floatx80_rounding_precision;
2772
- status->float_rounding_mode = float_round_nearest_even;
2772
+ set_float_rounding_mode(float_round_nearest_even, status);
2773
status->floatx80_rounding_precision = floatx80_precision_x;
2774
2775
compact = floatx80_make_compact(aExp, aSig);
2776
2777
if (compact > 0x400CB167) {
2778
if (compact > 0x400CB2B3) {
2779
- status->float_rounding_mode = user_rnd_mode;
2779
+ set_float_rounding_mode(user_rnd_mode, status);
2780
status->floatx80_rounding_precision = user_rnd_prec;
2781
return roundAndPackFloatx80(status->floatx80_rounding_precision, 0,
2782
0x8000, one_sig, 0, status);
@@ -2791,7 +2791,7 @@ floatx80 floatx80_cosh(floatx80 a, float_status *status)
2791
fp0 = floatx80_etox(fp0, status);
2792
fp1 = packFloatx80(0, 0x7FFB, one_sig);
2793
2794
- status->float_rounding_mode = user_rnd_mode;
2794
+ set_float_rounding_mode(user_rnd_mode, status);
2795
status->floatx80_rounding_precision = user_rnd_prec;
2796
2797
a = floatx80_mul(fp0, fp1, status);
@@ -2809,7 +2809,7 @@ floatx80 floatx80_cosh(floatx80 a, float_status *status)
2809
fp1 = float32_to_floatx80(make_float32(0x3E800000), status); /* 1/4 */
2810
fp1 = floatx80_div(fp1, fp0, status); /* 1/(2*EXP(|X|)) */
2811
2812
- status->float_rounding_mode = user_rnd_mode;
2812
+ set_float_rounding_mode(user_rnd_mode, status);
2813
status->floatx80_rounding_precision = user_rnd_prec;
2814
2815
a = floatx80_add(fp0, fp1, status);
target/ppc/fpu_helper.c
+7
-7
@@ -1616,7 +1616,7 @@ void helper_xsaddqp(CPUPPCState *env, uint32_t opcode,
1616
1617
tstat = env->fp_status;
1618
if (unlikely(Rc(opcode) != 0)) {
1619
- tstat.float_rounding_mode = float_round_to_odd;
1619
+ set_float_rounding_mode(float_round_to_odd, &tstat);
1620
}
1621
1622
set_float_exception_flags(0, &tstat);
@@ -1688,7 +1688,7 @@ void helper_xsmulqp(CPUPPCState *env, uint32_t opcode,
1688
helper_reset_fpstatus(env);
1689
tstat = env->fp_status;
1690
if (unlikely(Rc(opcode) != 0)) {
1691
- tstat.float_rounding_mode = float_round_to_odd;
1691
+ set_float_rounding_mode(float_round_to_odd, &tstat);
1692
}
1693
1694
set_float_exception_flags(0, &tstat);
@@ -1762,7 +1762,7 @@ void helper_xsdivqp(CPUPPCState *env, uint32_t opcode,
1762
helper_reset_fpstatus(env);
1763
tstat = env->fp_status;
1764
if (unlikely(Rc(opcode) != 0)) {
1765
- tstat.float_rounding_mode = float_round_to_odd;
1765
+ set_float_rounding_mode(float_round_to_odd, &tstat);
1766
}
1767
1768
set_float_exception_flags(0, &tstat);
@@ -2095,7 +2095,7 @@ void helper_##op(CPUPPCState *env, ppc_vsr_t *xt, ppc_vsr_t *s1, ppc_vsr_t *s2,\
2095
float_status tstat = env->fp_status; \
2096
set_float_exception_flags(0, &tstat); \
2097
if (ro) { \
2098
- tstat.float_rounding_mode = float_round_to_odd; \
2098
+ set_float_rounding_mode(float_round_to_odd, &tstat); \
2099
} \
2100
t.f128 = float128_muladd(s1->f128, s3->f128, s2->f128, maddflgs, &tstat); \
2101
env->fp_status.float_exception_flags |= tstat.float_exception_flags; \
@@ -2706,7 +2706,7 @@ void helper_XSCVQPDP(CPUPPCState *env, uint32_t ro, ppc_vsr_t *xt,
2706
2707
tstat = env->fp_status;
2708
if (ro != 0) {
2709
- tstat.float_rounding_mode = float_round_to_odd;
2709
+ set_float_rounding_mode(float_round_to_odd, &tstat);
2710
}
2711
2712
t.VsrD(0) = float128_to_float64(xb->f128, &tstat);
@@ -3306,7 +3306,7 @@ void helper_xssqrtqp(CPUPPCState *env, uint32_t opcode,
3306
3307
tstat = env->fp_status;
3308
if (unlikely(Rc(opcode) != 0)) {
3309
- tstat.float_rounding_mode = float_round_to_odd;
3309
+ set_float_rounding_mode(float_round_to_odd, &tstat);
3310
}
3311
3312
set_float_exception_flags(0, &tstat);
@@ -3332,7 +3332,7 @@ void helper_xssubqp(CPUPPCState *env, uint32_t opcode,
3332
3333
tstat = env->fp_status;
3334
if (unlikely(Rc(opcode) != 0)) {
3335
- tstat.float_rounding_mode = float_round_to_odd;
3335
+ set_float_rounding_mode(float_round_to_odd, &tstat);
3336
}
3337
3338
set_float_exception_flags(0, &tstat);
target/riscv/vector_helper.c
+3
-3
@@ -4270,9 +4270,9 @@ static uint64_t frec7(uint64_t f, int exp_size, int frac_size,
4270
s->float_exception_flags |= (float_flag_inexact |
4271
float_flag_overflow);
4272
4273
- if ((s->float_rounding_mode == float_round_to_zero) ||
4274
- ((s->float_rounding_mode == float_round_down) && !sign) ||
4275
- ((s->float_rounding_mode == float_round_up) && sign)) {
4273
+ if ((get_float_rounding_mode(s) == float_round_to_zero) ||
4274
+ ((get_float_rounding_mode(s) == float_round_down) && !sign) ||
4275
+ ((get_float_rounding_mode(s) == float_round_up) && sign)) {
4276
/* Return greatest/negative finite value. */
4277
return (sign << (exp_size + frac_size)) |
4278
(MAKE_64BIT_MASK(frac_size, exp_size) - 1);
target/s390x/tcg/fpu_helper.c
+2
-2
@@ -62,7 +62,7 @@ static int s390_get_bfp_rounding_mode(CPUS390XState *env, int m3)
62
switch (m3) {
63
case 0:
64
/* current mode */
65
- return env->fpu_status.float_rounding_mode;
65
+ return get_float_rounding_mode(&env->fpu_status);
66
case 1:
67
/* round to nearest with ties away from 0 */
68
return float_round_ties_away;
@@ -634,7 +634,7 @@ uint32_t HELPER(cxb)(CPUS390XState *env, Int128 a, Int128 b)
634
635
int s390_swap_bfp_rounding_mode(CPUS390XState *env, int m3)
636
{
637
- int ret = env->fpu_status.float_rounding_mode;
637
+ int ret = get_float_rounding_mode(&env->fpu_status);
638
639
set_float_rounding_mode(s390_get_bfp_rounding_mode(env, m3),
640
&env->fpu_status);
tests/fp/fp-bench.c
+1
-1
@@ -615,7 +615,7 @@ static void set_soft_precision(enum rounding rounding)
615
default:
616
g_assert_not_reached();
617
}
618
- soft_status.float_rounding_mode = mode;
618
+ set_float_rounding_mode(mode, &soft_status);
619
}
620
621
static void parse_args(int argc, char *argv[])
tests/fp/fp-test.c
+1
-1
@@ -967,7 +967,7 @@ void run_test(void)
967
968
verCases_roundingCode = 0;
969
slowfloat_roundingMode = rmode;
970
- qsf.float_rounding_mode = sf_rounding_to_qemu(rmode);
970
+ set_float_rounding_mode(sf_rounding_to_qemu(rmode), &qsf);
971
972
if (attrs & (FUNC_ARG_ROUNDINGMODE | FUNC_EFF_ROUNDINGMODE)) {
973
/* print rounding mode if the op is affected by it */
tests/fp/wrap.c.inc
+6
-6
@@ -168,7 +168,7 @@ WRAP_SF_TO_128(qemu_f64_to_f128M, float64_to_float128, float64)
168
{ \
169
type *ap = (type *)&a; \
170
\
171
- qsf.float_rounding_mode = sf_rounding_to_qemu(round); \
171
+ set_float_rounding_mode(sf_rounding_to_qemu(round), &qsf); \
172
return func(*ap, &qsf); \
173
}
174
@@ -328,7 +328,7 @@ WRAP_INT_TO_80(qemu_i64_to_extF80M, int64_to_floatx80, int64_t)
328
floatx80 a; \
329
\
330
a = soft_to_qemu80(*ap); \
331
- qsf.float_rounding_mode = sf_rounding_to_qemu(round); \
331
+ set_float_rounding_mode(sf_rounding_to_qemu(round), &qsf); \
332
return func(a, &qsf); \
333
}
334
@@ -360,7 +360,7 @@ WRAP_80_TO_INT_MINMAG(qemu_extF80M_to_i64_r_minMag,
360
float128 a; \
361
\
362
a = soft_to_qemu128(*ap); \
363
- qsf.float_rounding_mode = sf_rounding_to_qemu(round); \
363
+ set_float_rounding_mode(sf_rounding_to_qemu(round), &qsf); \
364
return func(a, &qsf); \
365
}
366
@@ -414,7 +414,7 @@ WRAP_INT_TO_128(qemu_i64_to_f128M, int64_to_float128, int64_t)
414
type *ap = (type *)&a; \
415
type ret; \
416
\
417
- qsf.float_rounding_mode = sf_rounding_to_qemu(round); \
417
+ set_float_rounding_mode(sf_rounding_to_qemu(round), &qsf); \
418
ret = func(*ap, &qsf); \
419
return *(type##_t *)&ret; \
420
}
@@ -431,7 +431,7 @@ static void qemu_extF80M_roundToInt(const extFloat80_t *ap, uint_fast8_t round,
431
floatx80 ret;
432
433
a = soft_to_qemu80(*ap);
434
- qsf.float_rounding_mode = sf_rounding_to_qemu(round);
434
+ set_float_rounding_mode(sf_rounding_to_qemu(round), &qsf);
435
ret = floatx80_round_to_int(a, &qsf);
436
*res = qemu_to_soft80(ret);
437
}
@@ -443,7 +443,7 @@ static void qemu_f128M_roundToInt(const float128_t *ap, uint_fast8_t round,
443
float128 ret;
444
445
a = soft_to_qemu128(*ap);
446
- qsf.float_rounding_mode = sf_rounding_to_qemu(round);
446
+ set_float_rounding_mode(sf_rounding_to_qemu(round), &qsf);
447
ret = float128_round_to_int(a, &qsf);
448
*res = qemu_to_soft128(ret);
449
}