Bug 87369 - [9 Regression] Regression on aarch64/copysign-bsl.c since r264264
Summary: [9 Regression] Regression on aarch64/copysign-bsl.c since r264264
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 9.0
: P3 normal
Target Milestone: 9.0
Assignee: Richard Earnshaw
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-09-20 16:35 UTC by Christophe Lyon
Modified: 2018-12-11 11:36 UTC (History)
2 users (show)

See Also:
Host:
Target: aarch64
Build:
Known to work:
Known to fail:
Last reconfirmed: 2018-12-06 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christophe Lyon 2018-09-20 16:35:44 UTC
Since r264264, I've noticed a regression on
FAIL: gcc.target/aarch64/copysign-bsl.c scan-assembler b(sl|it|if)\tv[0-9]
Comment 1 Jeffrey A. Law 2018-12-06 18:24:18 UTC
I wonder if we would be better off having the bfxil pattern reject cases when just the high bit is on (which are those cases where we'd be able to use a bit instruction rather than bfxil.
Comment 2 Richard Earnshaw 2018-12-11 11:26:47 UTC
Author: rearnsha
Date: Tue Dec 11 11:26:15 2018
New Revision: 267019

URL: https://gcc.gnu.org/viewcvs?rev=267019&root=gcc&view=rev
Log:
[aarch64] PR target/87369 Prefer bsl/bit/bif for copysign

The copysign operations will almost always be performed on values in
floating-point registers.  As such, we do not want the compiler to
simplify the operations into code sequences that can only be done
using the general-purpose register set.  Unfortunately, this is what
is currently happening.

Fortunately, it seems quite unlikely that copysign() will be
subsequently followed by other logical operations on the values
involved, so I think it is acceptable to use an unspec here.  This
allows us to preserve the operation in a form that allows the register
allocator to make the right choice later on, without limitation on the
final form of the operation (well, if we do end up using the gp
register bank, we get a dead constant load that we cannot easily
eliminate at a late stage).

	PR target/37369
	* config/aarch64/iterators.md (sizem1): Add sizes for SFmode and DFmode.
	(Vbtype): Add SFmode mapping.
	* config/aarch64/aarch64.md (copysigndf3, copysignsf3): Delete.
	(copysign<GPF:mode>3): New expand pattern.
	(copysign<GPF:mode>3_insn): New insn pattern.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/aarch64/aarch64.md
    trunk/gcc/config/aarch64/iterators.md
Comment 3 Richard Earnshaw 2018-12-11 11:36:42 UTC
It seems better to fix this by using an unspec that's specific to the copysign expansion.  That means we don't need to nobble the other optimizations the compiler might do on bit-field manipulations.  It's unlikely that copysign will be followed by other bit-manipulating operations on a FP value, but we'll just have to live with that if they are.