public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [committed] amdgcn: Allow vector reductions on constants
@ 2022-02-14 14:13 Andrew Stubbs
  2022-02-14 15:57 ` [OG11][committed] " Andrew Stubbs
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew Stubbs @ 2022-02-14 14:13 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 464 bytes --]

I've committed this fix for an ICE compiling sollve_vv testcase 
test_target_teams_distribute_defaultmap.c.

Somehow the optimizers result in a vector reduction on a vector of 
duplicated constants. This was a case the backend didn't handle, so we 
ended up with an unrecognised instruction ICE.

It might be better if constant reductions were evaluated at compile 
time, but this patch prevents the ICE right now.

Andrew

P.S. I'll backport this to OG11 shortly.

[-- Attachment #2: 220214-constant-reductions.patch --]
[-- Type: text/plain, Size: 843 bytes --]

amdgcn: Allow vector reductions on constants

Obviously it would be better if these reductions could be evaluated at compile
time, but this will avoid an ICE.

gcc/ChangeLog:

	* config/gcn/gcn.cc (gcn_expand_reduc_scalar): Use force_reg.

diff --git a/gcc/config/gcn/gcn.cc b/gcc/config/gcn/gcn.cc
index 74819c6e4d7..402f0256411 100644
--- a/gcc/config/gcn/gcn.cc
+++ b/gcc/config/gcn/gcn.cc
@@ -4460,7 +4460,7 @@ gcn_expand_reduc_scalar (machine_mode mode, rtx src, int unspec)
      pair of lanes, then on every pair of results from the previous
      iteration (thereby effectively reducing every 4 lanes) and so on until
      all lanes are reduced.  */
-  rtx in, out = src;
+  rtx in, out = force_reg (mode, src);
   for (int i = 0, shift = 1; i < 6; i++, shift <<= 1)
     {
       rtx shift_val = gen_rtx_CONST_INT (VOIDmode, shift);

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [OG11][committed] amdgcn: Allow vector reductions on constants
  2022-02-14 14:13 [committed] amdgcn: Allow vector reductions on constants Andrew Stubbs
@ 2022-02-14 15:57 ` Andrew Stubbs
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Stubbs @ 2022-02-14 15:57 UTC (permalink / raw)
  To: gcc-patches

On 14/02/2022 14:13, Andrew Stubbs wrote:
> I've committed this fix for an ICE compiling sollve_vv testcase 
> test_target_teams_distribute_defaultmap.c.
> 
> Somehow the optimizers result in a vector reduction on a vector of 
> duplicated constants. This was a case the backend didn't handle, so we 
> ended up with an unrecognised instruction ICE.
> 
> It might be better if constant reductions were evaluated at compile 
> time, but this patch prevents the ICE right now.
> 
> Andrew
> 
> P.S. I'll backport this to OG11 shortly.

Backport to devel/omp/gcc-11 branch done.

Andrew

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-02-14 15:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-14 14:13 [committed] amdgcn: Allow vector reductions on constants Andrew Stubbs
2022-02-14 15:57 ` [OG11][committed] " Andrew Stubbs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).