From: Richard Sandiford Date: Thu, 20 Feb 2020 13:57:44 +0000 (+0000) Subject: aarch64: Bump AARCH64_APPROX_MODE to 64 bits X-Git-Tag: upstream/12.2.0~18258 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d87778ed097f24a0bf394c0255019547008c3479;p=platform%2Fupstream%2Fgcc.git aarch64: Bump AARCH64_APPROX_MODE to 64 bits We now have more than 32 scalar and vector float modes, so the 32-bit AARCH64_APPROX_MODE would invoke UB for some of them. Bumping to a 64-bit mask fixes that... for now. Ideally we'd have a static assert to trap this, but logically it would go at file scope. I think it would be better to wait until the switch to C++11, so that we can use static_assert directly. 2020-02-21 Richard Sandiford gcc/ * config/aarch64/aarch64-protos.h (AARCH64_APPROX_MODE): Operate on and produce uint64_ts rather than ints. (AARCH64_APPROX_NONE, AARCH64_APPROX_ALL): Change to uint64_ts. (cpu_approx_modes): Change the fields from unsigned int to uint64_t. --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8241af4..b5eb87a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,12 @@ 2020-02-21 Richard Sandiford + * config/aarch64/aarch64-protos.h (AARCH64_APPROX_MODE): Operate + on and produce uint64_ts rather than ints. + (AARCH64_APPROX_NONE, AARCH64_APPROX_ALL): Change to uint64_ts. + (cpu_approx_modes): Change the fields from unsigned int to uint64_t. + +2020-02-21 Richard Sandiford + * config/aarch64/aarch64.c (aarch64_emit_approx_sqrt): Don't create an unused xmsk register when handling approximate rsqrt. diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h index d29975a..d6d668e 100644 --- a/gcc/config/aarch64/aarch64-protos.h +++ b/gcc/config/aarch64/aarch64-protos.h @@ -212,20 +212,20 @@ struct cpu_branch_cost /* Control approximate alternatives to certain FP operators. */ #define AARCH64_APPROX_MODE(MODE) \ ((MIN_MODE_FLOAT <= (MODE) && (MODE) <= MAX_MODE_FLOAT) \ - ? (1 << ((MODE) - MIN_MODE_FLOAT)) \ + ? ((uint64_t) 1 << ((MODE) - MIN_MODE_FLOAT)) \ : (MIN_MODE_VECTOR_FLOAT <= (MODE) && (MODE) <= MAX_MODE_VECTOR_FLOAT) \ - ? (1 << ((MODE) - MIN_MODE_VECTOR_FLOAT \ - + MAX_MODE_FLOAT - MIN_MODE_FLOAT + 1)) \ + ? ((uint64_t) 1 << ((MODE) - MIN_MODE_VECTOR_FLOAT \ + + MAX_MODE_FLOAT - MIN_MODE_FLOAT + 1)) \ : (0)) -#define AARCH64_APPROX_NONE (0) -#define AARCH64_APPROX_ALL (-1) +#define AARCH64_APPROX_NONE ((uint64_t) 0) +#define AARCH64_APPROX_ALL (~(uint64_t) 0) /* Allowed modes for approximations. */ struct cpu_approx_modes { - const unsigned int division; /* Division. */ - const unsigned int sqrt; /* Square root. */ - const unsigned int recip_sqrt; /* Reciprocal square root. */ + const uint64_t division; /* Division. */ + const uint64_t sqrt; /* Square root. */ + const uint64_t recip_sqrt; /* Reciprocal square root. */ }; /* Cache prefetch settings for prefetch-loop-arrays. */