middle-end/104496 - fix vectorized_internal_fn_supported_p
authorRichard Biener <rguenther@suse.de>
Fri, 11 Feb 2022 09:27:20 +0000 (10:27 +0100)
committerRichard Biener <rguenther@suse.de>
Fri, 11 Feb 2022 10:28:25 +0000 (11:28 +0100)
This fixes vectorized_internal_fn_supported_p behavior when
facing vector types with an integer mode.

2022-02-11  Richard Biener  <rguenther@suse.de>

PR middle-end/104496
* internal-fn.cc (vectorized_internal_fn_supported_p):
Bail out for integer mode vector types.

* gcc.target/i386/pr104496.c: New testcase.

gcc/internal-fn.cc
gcc/testsuite/gcc.target/i386/pr104496.c [new file with mode: 0644]

index 71ac483..3f1fbc6 100644 (file)
@@ -4392,7 +4392,8 @@ vectorized_internal_fn_supported_p (internal_fn ifn, tree type)
     return direct_internal_fn_supported_p (ifn, type, OPTIMIZE_FOR_SPEED);
 
   scalar_mode smode;
-  if (!is_a <scalar_mode> (TYPE_MODE (type), &smode))
+  if (VECTOR_TYPE_P (type)
+      || !is_a <scalar_mode> (TYPE_MODE (type), &smode))
     return false;
 
   machine_mode vmode = targetm.vectorize.preferred_simd_mode (smode);
diff --git a/gcc/testsuite/gcc.target/i386/pr104496.c b/gcc/testsuite/gcc.target/i386/pr104496.c
new file mode 100644 (file)
index 0000000..62d3bc6
--- /dev/null
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O -mgeneral-regs-only -msse" } */
+
+typedef int __attribute__((__vector_size__ (8))) V;
+V a, b;
+int c;
+
+void
+foo (void)
+{
+  b = 0 != a | b << c;
+}