This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch match.pd] Add a simplify rule for x * copysign (1.0, y);


On Thu, Oct 01, 2015 at 02:57:15PM +0100, James Greenhalgh wrote:
> 2015-10-01  James Greenhalgh  <james.greenhalgh@arm.com>
> 
> 	* match.pd (mult (COPYSIGN:s real_onep @0) @1): New simplifier.

Also, please note that
+      wide_int m = wi::min_value (TYPE_PRECISION (type), SIGNED);
+      tree tt
+     = build_nonstandard_integer_type (TYPE_PRECISION (type),
+                                       false);
+      tree mask = wide_int_to_tree (tt, m);
is really not a reliable way to determine which bit to change.
In some floating format it is not possible at all, in others it might not
be the topmost bit of the precision, or might depend on
FLOAT_WORDS_BIG_ENDIAN etc., see expand_copysign_bit and expand_copysign
for details (e.g. one has to look at fmt->signbit_rw etc.).
So, I probably agree with Andrew that it would be better optimized during
expansion.  One issue for that though is that TER stops at calls, we'd need
to special case this case.

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]