aboutsummaryrefslogtreecommitdiff
path: root/tests/tcg
diff options
context:
space:
mode:
Diffstat (limited to 'tests/tcg')
-rw-r--r--tests/tcg/i386/test-i386-fscale.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/tcg/i386/test-i386-fscale.c b/tests/tcg/i386/test-i386-fscale.c
index b953e7c563..d23b3cfeec 100644
--- a/tests/tcg/i386/test-i386-fscale.c
+++ b/tests/tcg/i386/test-i386-fscale.c
@@ -8,6 +8,8 @@ union u {
long double ld;
};
+volatile long double ld_third = 1.0L / 3.0L;
+volatile long double ld_four_thirds = 4.0L / 3.0L;
volatile union u ld_invalid_1 = { .s = { 1, 1234 } };
volatile union u ld_invalid_2 = { .s = { 0, 1234 } };
volatile union u ld_invalid_3 = { .s = { 0, 0x7fff } };
@@ -91,5 +93,16 @@ int main(void)
printf("FAIL: fscale finite down inf\n");
ret = 1;
}
+ /* Set round-to-nearest with single-precision rounding. */
+ cw = cw & ~0xf00;
+ __asm__ volatile ("fldcw %0" : : "m" (cw));
+ __asm__ volatile ("fscale" : "=t" (ld_res) :
+ "0" (ld_third), "u" (2.0L));
+ cw = cw | 0x300;
+ __asm__ volatile ("fldcw %0" : : "m" (cw));
+ if (ld_res != ld_four_thirds) {
+ printf("FAIL: fscale single-precision\n");
+ ret = 1;
+ }
return ret;
}