* [PATCH] rs6000: Allow conversions of MMA pointer types [PR106017]
@ 2022-08-27 18:36 Peter Bergner
2022-08-27 21:37 ` Segher Boessenkool
0 siblings, 1 reply; 4+ messages in thread
From: Peter Bergner @ 2022-08-27 18:36 UTC (permalink / raw)
To: Segher Boessenkool; +Cc: GCC Patches
GCC incorrectly disables conversions between MMA pointer types, which
are allowed with clang. The original intent was to disable conversions
between MMA types and other other types, but pointer conversions should
have been allowed. The fix is to just remove the MMA pointer conversion
handling code altogether.
This passed bootstrap and regtesting on powerpc64le-linux with no regressions.
Ok for trunk and backports after some burn-in time?
Peter
gcc/
PR target/106017
* config/rs6000/rs6000.cc (rs6000_invalid_conversion): Remove handling
of MMA pointer conversions.
gcc/testsuite/
PR target/106017
* gcc.target/powerpc/pr106017.c: New test.
diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
index df491bee2ea..2f3146e56f8 100644
--- a/gcc/config/rs6000/rs6000.cc
+++ b/gcc/config/rs6000/rs6000.cc
@@ -28188,28 +28188,6 @@ rs6000_invalid_conversion (const_tree fromtype, const_tree totype)
if (tomode == OOmode)
return N_("invalid conversion to type %<__vector_pair%>");
}
- else if (POINTER_TYPE_P (fromtype) && POINTER_TYPE_P (totype))
- {
- /* We really care about the modes of the base types. */
- frommode = TYPE_MODE (TREE_TYPE (fromtype));
- tomode = TYPE_MODE (TREE_TYPE (totype));
-
- /* Do not allow conversions to/from XOmode and OOmode pointer
- types, except to/from void pointers. */
- if (frommode != tomode
- && frommode != VOIDmode
- && tomode != VOIDmode)
- {
- if (frommode == XOmode)
- return N_("invalid conversion from type %<__vector_quad *%>");
- if (tomode == XOmode)
- return N_("invalid conversion to type %<__vector_quad *%>");
- if (frommode == OOmode)
- return N_("invalid conversion from type %<__vector_pair *%>");
- if (tomode == OOmode)
- return N_("invalid conversion to type %<__vector_pair *%>");
- }
- }
/* Conversion allowed. */
return NULL;
diff --git a/gcc/testsuite/gcc.target/powerpc/pr106017.c b/gcc/testsuite/gcc.target/powerpc/pr106017.c
new file mode 100644
index 00000000000..46d6c7a4a33
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr106017.c
@@ -0,0 +1,19 @@
+/* PR target/106017 */
+/* { dg-options "-O1 -mdejagnu-cpu=power10" } */
+/* { dg-require-effective-target power10_ok } */
+
+/* Make sure we do not flag any errors on the following test cases. */
+
+void takeacc(__vector_quad *);
+void
+foo (void)
+{
+ __vector_quad arr[4];
+ takeacc (arr);
+}
+
+unsigned char *
+bar (__vector_quad *a)
+{
+ return (unsigned char *)a;
+}
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] rs6000: Allow conversions of MMA pointer types [PR106017]
2022-08-27 18:36 [PATCH] rs6000: Allow conversions of MMA pointer types [PR106017] Peter Bergner
@ 2022-08-27 21:37 ` Segher Boessenkool
2022-08-28 0:47 ` Peter Bergner
0 siblings, 1 reply; 4+ messages in thread
From: Segher Boessenkool @ 2022-08-27 21:37 UTC (permalink / raw)
To: Peter Bergner; +Cc: GCC Patches
Hi!
On Sat, Aug 27, 2022 at 01:36:07PM -0500, Peter Bergner wrote:
> GCC incorrectly disables conversions between MMA pointer types, which
> are allowed with clang. The original intent was to disable conversions
> between MMA types and other other types, but pointer conversions should
> have been allowed.
Such conversions are explicitly allowed in C, even (6.3.2.3/7).
> The fix is to just remove the MMA pointer conversion
> handling code altogether.
Okay for trunk and all backports. Thanks!
Segher
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] rs6000: Allow conversions of MMA pointer types [PR106017]
2022-08-27 21:37 ` Segher Boessenkool
@ 2022-08-28 0:47 ` Peter Bergner
2022-08-30 2:06 ` Peter Bergner
0 siblings, 1 reply; 4+ messages in thread
From: Peter Bergner @ 2022-08-28 0:47 UTC (permalink / raw)
To: Segher Boessenkool; +Cc: GCC Patches
On 8/27/22 4:37 PM, Segher Boessenkool wrote:
> Such conversions are explicitly allowed in C, even (6.3.2.3/7).
Yeah, I think I just got a little carried away disabling them originally. :-(
>> The fix is to just remove the MMA pointer conversion
>> handling code altogether.
>
> Okay for trunk and all backports. Thanks!
Ok, pushed to trunk. I'll backport after some burn-in. Thanks!
Peter
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] rs6000: Allow conversions of MMA pointer types [PR106017]
2022-08-28 0:47 ` Peter Bergner
@ 2022-08-30 2:06 ` Peter Bergner
0 siblings, 0 replies; 4+ messages in thread
From: Peter Bergner @ 2022-08-30 2:06 UTC (permalink / raw)
To: Segher Boessenkool; +Cc: GCC Patches
On 8/27/22 7:47 PM, Peter Bergner via Gcc-patches wrote:
> On 8/27/22 4:37 PM, Segher Boessenkool wrote:
>>> The fix is to just remove the MMA pointer conversion
>>> handling code altogether.
>>
>> Okay for trunk and all backports. Thanks!
>
> Ok, pushed to trunk. I'll backport after some burn-in. Thanks!
Test results on Bill's autotesters were clean on multiple systems,
so I pushed the backports to GCC 12, 11 and 10, so it's fixed
everywhere. Thanks!
Peter
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-08-30 2:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-27 18:36 [PATCH] rs6000: Allow conversions of MMA pointer types [PR106017] Peter Bergner
2022-08-27 21:37 ` Segher Boessenkool
2022-08-28 0:47 ` Peter Bergner
2022-08-30 2:06 ` Peter Bergner
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).