public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] rs6000: Don't ICE when compiling the __builtin_vec_xst_trunc built-in [PR109178]
@ 2023-03-17 22:35 Peter Bergner
  2023-03-18  0:17 ` Peter Bergner
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Bergner @ 2023-03-17 22:35 UTC (permalink / raw)
  To: GCC Patches; +Cc: Segher Boessenkool, Kewen.Lin, Chip Kerchner

When we expand the __builtin_vec_xst_trunc built-in, we use the wrong mode
for the MEM operand which causes an unrecognizable insn ICE.  The solution
is to use the correct TMODE mode.

Is this ok for trunk and gcc12 assuming my bootstraps and regtests show
no regressions?

Peter


gcc/
	PR target/109178
	* config/rs6000/rs6000-builtin.cc (stv_expand_builtin): Use tmode.

gcc/testsuite/
	PR target/109178
	* gcc.target/powerpc/pr109178.c: New test.

diff --git a/gcc/config/rs6000/rs6000-builtin.cc b/gcc/config/rs6000/rs6000-builtin.cc
index 737a5c42bfb..83c28cd8af3 100644
--- a/gcc/config/rs6000/rs6000-builtin.cc
+++ b/gcc/config/rs6000/rs6000-builtin.cc
@@ -2933,7 +2933,7 @@ stv_expand_builtin (insn_code icode, rtx *op,
 
       rtx addr;
       if (op[1] == const0_rtx)
-	addr = gen_rtx_MEM (Pmode, op[2]);
+	addr = gen_rtx_MEM (tmode, op[2]);
       else
 	{
 	  op[1] = copy_to_mode_reg (Pmode, op[1]);
diff --git a/gcc/testsuite/gcc.target/powerpc/pr109178.c b/gcc/testsuite/gcc.target/powerpc/pr109178.c
new file mode 100644
index 00000000000..0f6e2d6b2eb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr109178.c
@@ -0,0 +1,13 @@
+/* PR target/109178 */
+/* { dg-require-effective-target int128 } */
+/* { dg-options "-O2 -mdejagnu-cpu=power10" } */
+
+/* Verify we do not ICE on the following.  */
+
+typedef __attribute__ ((altivec (vector__))) signed __int128 v1ti_t;
+
+void
+foo (signed int *dst, v1ti_t src)
+{
+  __builtin_vec_xst_trunc(src, 0, dst);
+}

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

* Re: [PATCH] rs6000: Don't ICE when compiling the __builtin_vec_xst_trunc built-in [PR109178]
  2023-03-17 22:35 [PATCH] rs6000: Don't ICE when compiling the __builtin_vec_xst_trunc built-in [PR109178] Peter Bergner
@ 2023-03-18  0:17 ` Peter Bergner
  2023-03-18  2:30   ` Peter Bergner
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Bergner @ 2023-03-18  0:17 UTC (permalink / raw)
  To: GCC Patches; +Cc: Segher Boessenkool, Kewen.Lin, Chip Kerchner

On 3/17/23 5:35 PM, Peter Bergner wrote:
> When we expand the __builtin_vec_xst_trunc built-in, we use the wrong mode
> for the MEM operand which causes an unrecognizable insn ICE.  The solution
> is to use the correct TMODE mode.
> 
> Is this ok for trunk and gcc12 assuming my bootstraps and regtests show
> no regressions?

The trunk bootstrap and regtests were clean.  I'm still waiting on the
backport testing to finish.

Peter



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

* Re: [PATCH] rs6000: Don't ICE when compiling the __builtin_vec_xst_trunc built-in [PR109178]
  2023-03-18  0:17 ` Peter Bergner
@ 2023-03-18  2:30   ` Peter Bergner
  2023-03-20  3:20     ` Kewen.Lin
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Bergner @ 2023-03-18  2:30 UTC (permalink / raw)
  To: GCC Patches; +Cc: Segher Boessenkool, Kewen.Lin, Chip Kerchner

On 3/17/23 7:17 PM, Peter Bergner wrote:
> On 3/17/23 5:35 PM, Peter Bergner wrote:
>> When we expand the __builtin_vec_xst_trunc built-in, we use the wrong mode
>> for the MEM operand which causes an unrecognizable insn ICE.  The solution
>> is to use the correct TMODE mode.
>>
>> Is this ok for trunk and gcc12 assuming my bootstraps and regtests show
>> no regressions?
> 
> The trunk bootstrap and regtests were clean.  I'm still waiting on the
> backport testing to finish.
...and the gcc12 backported bootstrap and regtest were clean too.

Peter


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

* Re: [PATCH] rs6000: Don't ICE when compiling the __builtin_vec_xst_trunc built-in [PR109178]
  2023-03-18  2:30   ` Peter Bergner
@ 2023-03-20  3:20     ` Kewen.Lin
  2023-03-21  2:24       ` Peter Bergner
  0 siblings, 1 reply; 5+ messages in thread
From: Kewen.Lin @ 2023-03-20  3:20 UTC (permalink / raw)
  To: Peter Bergner; +Cc: Segher Boessenkool, Chip Kerchner, GCC Patches

Hi Peter,

on 2023/3/18 10:30, Peter Bergner wrote:
> On 3/17/23 7:17 PM, Peter Bergner wrote:
>> On 3/17/23 5:35 PM, Peter Bergner wrote:
>>> When we expand the __builtin_vec_xst_trunc built-in, we use the wrong mode
>>> for the MEM operand which causes an unrecognizable insn ICE.  The solution
>>> is to use the correct TMODE mode.
>>>
>>> Is this ok for trunk and gcc12 assuming my bootstraps and regtests show
>>> no regressions?
>>
>> The trunk bootstrap and regtests were clean.  I'm still waiting on the
>> backport testing to finish.
> ...and the gcc12 backported bootstrap and regtest were clean too.
> 

Nice, OK for trunk and gcc12 branch, thanks!

BR,
Kewen

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

* Re: [PATCH] rs6000: Don't ICE when compiling the __builtin_vec_xst_trunc built-in [PR109178]
  2023-03-20  3:20     ` Kewen.Lin
@ 2023-03-21  2:24       ` Peter Bergner
  0 siblings, 0 replies; 5+ messages in thread
From: Peter Bergner @ 2023-03-21  2:24 UTC (permalink / raw)
  To: Kewen.Lin; +Cc: Segher Boessenkool, Chip Kerchner, GCC Patches

On 3/19/23 10:20 PM, Kewen.Lin via Gcc-patches wrote:
> Nice, OK for trunk and gcc12 branch, thanks!

Pushed to trunk and the GCC 12 release branch.  Thanks.

Peter



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

end of thread, other threads:[~2023-03-21  2:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-17 22:35 [PATCH] rs6000: Don't ICE when compiling the __builtin_vec_xst_trunc built-in [PR109178] Peter Bergner
2023-03-18  0:17 ` Peter Bergner
2023-03-18  2:30   ` Peter Bergner
2023-03-20  3:20     ` Kewen.Lin
2023-03-21  2:24       ` 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).