On Wed, Nov 09, 2016 at 10:16:35PM +0000, Joseph Myers wrote:
> On Wed, 9 Nov 2016, Bernd Edlinger wrote:
>
> > Yes, but maybe introduce a test if the half-wide value fits?
> >
> > like:
> >
> > #define M_OK2(M, T) ((M) > sizeof(T) * CHAR_BIT / 2 - 1)
>
> Something like that.
In patch form, that would look like this...
I've checked on my ARM and AArch64 trees with _Float16 support that this
lets the tests pass.
OK?
Thanks,
James
---
2016-11-10 James Greenhalgh <[email protected]>
* gcc.dg/torture/fp-int-convert.h (M_OK2): New, use it in
WVAL0S tests added in r241817.
diff --git a/gcc/testsuite/gcc.dg/torture/fp-int-convert.h b/gcc/testsuite/gcc.dg/torture/fp-int-convert.h
index bbe9666..2b904b6 100644
--- a/gcc/testsuite/gcc.dg/torture/fp-int-convert.h
+++ b/gcc/testsuite/gcc.dg/torture/fp-int-convert.h
@@ -53,13 +53,14 @@ do { \
TEST_I_F_VAL (U, F, HVAL1U (P, U), P_OK (P, U)); \
TEST_I_F_VAL (U, F, HVAL1U (P, U) + 1, P_OK (P, U)); \
TEST_I_F_VAL (U, F, HVAL1U (P, U) - 1, P_OK (P, U)); \
- TEST_I_F_VAL (I, F, WVAL0S (I), 1); \
- TEST_I_F_VAL (I, F, -WVAL0S (I), 1); \
+ TEST_I_F_VAL (I, F, WVAL0S (I), M_OK2 (M, U)); \
+ TEST_I_F_VAL (I, F, -WVAL0S (I), M_OK2 (M, U)); \
} while (0)
#define P_OK(P, T) ((P) >= sizeof(T) * CHAR_BIT)
#define P_OK1(P, T) ((P) >= sizeof(T) * CHAR_BIT - 1)
#define M_OK1(M, T) ((M) > sizeof(T) * CHAR_BIT - 1)
+#define M_OK2(M, T) ((M) > sizeof(T) * CHAR_BIT / 2 - 1)
#define HVAL0U(P, U) (U)(P_OK (P, U) \
? (U)1 \
: (((U)1 << (sizeof(U) * CHAR_BIT - 1)) \