public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] rs6000: Don't allow immediate value in the vsx_splat pattern [PR113950]
@ 2024-02-26  6:18 jeevitha
  2024-02-26 10:49 ` Kewen.Lin
  2024-02-26 20:32 ` [PATCH V2] " jeevitha
  0 siblings, 2 replies; 14+ messages in thread
From: jeevitha @ 2024-02-26  6:18 UTC (permalink / raw)
  To: GCC Patches, Kewen.Lin, Segher Boessenkool, Michael Meissner
  Cc: Peter Bergner

Hi All,

The following patch has been bootstrapped and regtested on powerpc64le-linux.

There is no immediate value splatting instruction in powerpc. Currently that
needs to be stored in a register or memory. For addressing this I have updated
the predicate for the second operand in vsx_splat to splat_input_operand,
which will handle the operands appropriately.

2024-02-26  Jeevitha Palanisamy  <jeevitha@linux.ibm.com>

gcc/
	PR target/113950
	* config/rs6000/vsx.md (vsx_splat_<mode>): Updated the predicates
	for second operand.

gcc/testsuite/
	PR target/113950
	* gcc.target/powerpc/pr113950.c: New testcase.

diff --git a/gcc/config/rs6000/vsx.md b/gcc/config/rs6000/vsx.md
index 6111cc90eb7..e5688ff972a 100644
--- a/gcc/config/rs6000/vsx.md
+++ b/gcc/config/rs6000/vsx.md
@@ -4660,7 +4660,7 @@
 (define_expand "vsx_splat_<mode>"
   [(set (match_operand:VSX_D 0 "vsx_register_operand")
 	(vec_duplicate:VSX_D
-	 (match_operand:<VEC_base> 1 "input_operand")))]
+	 (match_operand:<VEC_base> 1 "splat_input_operand")))]
   "VECTOR_MEM_VSX_P (<MODE>mode)"
 {
   rtx op1 = operands[1];
diff --git a/gcc/testsuite/gcc.target/powerpc/pr113950.c b/gcc/testsuite/gcc.target/powerpc/pr113950.c
new file mode 100644
index 00000000000..29ded29f683
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr113950.c
@@ -0,0 +1,24 @@
+/* PR target/113950 */
+/* { dg-do compile } */
+/* { dg-options "-O1" } */
+
+/* Verify we do not ICE on the following.  */
+
+void abort (void);
+
+int main ()
+{
+  int i;
+  vector signed long long vsll_result, vsll_expected_result;
+  signed long long sll_arg1;
+
+  sll_arg1 = 300;
+  vsll_expected_result = (vector signed long long) {300, 300};
+  vsll_result = __builtin_vsx_splat_2di (sll_arg1);  
+
+  for (i = 0; i < 2; i++)
+    if (vsll_result[i] != vsll_expected_result[i])
+      abort();
+
+  return 0;
+}



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

end of thread, other threads:[~2024-02-28 20:01 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-26  6:18 [PATCH] rs6000: Don't allow immediate value in the vsx_splat pattern [PR113950] jeevitha
2024-02-26 10:49 ` Kewen.Lin
2024-02-26 15:07   ` Peter Bergner
2024-02-26 15:12     ` jeevitha
2024-02-27  1:55     ` Kewen.Lin
2024-02-27  2:13       ` Peter Bergner
2024-02-27  2:56         ` Kewen.Lin
2024-02-27  9:07           ` jeevitha
2024-02-26 20:32 ` [PATCH V2] " jeevitha
2024-02-27 12:40   ` Segher Boessenkool
2024-02-27 22:50     ` Peter Bergner
2024-02-28 14:31       ` Segher Boessenkool
2024-02-28 17:58         ` Peter Bergner
2024-02-28 20:00           ` Segher Boessenkool

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).