summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/sse2-lrintf-vec.c
diff options
context:
space:
mode:
authorUros Bizjak <ubizjak@gmail.com>2007-06-29 12:30:06 +0200
committerUros Bizjak <uros@gcc.gnu.org>2007-06-29 12:30:06 +0200
commitb40c4f68160a4b556135185e8b5e013ab77ba2ec (patch)
tree332c2a8a980e60c5f65e31276d3aa5472059f7e9 /gcc/testsuite/gcc.target/i386/sse2-lrintf-vec.c
parent690f48b1b48b5626cb9b78944f1da201d11e00ec (diff)
downloadgcc-b40c4f68160a4b556135185e8b5e013ab77ba2ec.tar.gz
re PR tree-optimization/24659 (Conversions are not vectorized)
PR tree-optimization/24659 * tree-vect-transform.c (vectorizable_call): Handle (nunits_in == nunits_out / 2) and (nunits_out == nunits_in / 2) cases. * config/i386/sse.md (vec_pack_sfix_v2df): New expander. * config/i386/i386.c (enum ix86_builtins) [IX86_BUILTIN_VEC_PACK_SFIX]: New constant. (struct bdesc_2arg) [__builtin_ia32_vec_pack_sfix]: New builtin description. (ix86_init_mmx_sse_builtins): Define all builtins with 2 arguments as const using def_builtin_const. (ix86_expand_binop_builtin): Remove bogus assert() that insn wants input operands in the same modes as the result. (ix86_builtin_vectorized_function): Handle BUILT_IN_LRINT. testsuite/ChangeLog: PR tree-optimization/24659 * gcc.target/i386/vectorize2.c: New test. * gcc.target/i386/sse2-lrint-vec.c: New runtime test. * gcc.target/i386/sse2-lrintf-vec.c: Ditto. From-SVN: r126111
Diffstat (limited to 'gcc/testsuite/gcc.target/i386/sse2-lrintf-vec.c')
-rw-r--r--gcc/testsuite/gcc.target/i386/sse2-lrintf-vec.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/i386/sse2-lrintf-vec.c b/gcc/testsuite/gcc.target/i386/sse2-lrintf-vec.c
new file mode 100644
index 00000000000..dc4ae93b7a2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/sse2-lrintf-vec.c
@@ -0,0 +1,48 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -ffast-math -ftree-vectorize -msse2" } */
+
+#include "../../gcc.dg/i386-cpuid.h"
+
+extern long lrintf (float);
+extern void abort (void);
+
+#define N 32
+
+int __attribute__((noinline))
+main1 ()
+{
+ float a[N] = {0.4,3.5,6.6,9.4,12.5,15.6,18.4,21.5,24.6,27.4,30.5,33.6,36.4,39.5,42.6,45.4,0.5,3.6,6.4,9.5,12.6,15.4,18.5,21.6,24.4,27.5,30.6,33.4,36.5,39.6,42.4,45.5};
+ long r[N];
+
+ int i;
+
+ for (i = 0; i < N; i++)
+ {
+ r[i] = lrintf (a[i]);
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (r[i] != lrintf (a[i]))
+ abort();
+ }
+
+ return 0;
+}
+
+int
+main ()
+{
+ unsigned long cpu_facilities;
+
+ cpu_facilities = i386_cpuid ();
+
+ if ((cpu_facilities & (bit_MMX | bit_SSE | bit_SSE2 | bit_CMOV))
+ != (bit_MMX | bit_SSE | bit_SSE2 | bit_CMOV))
+ /* If host has no vector support, pass. */
+ return 0;
+
+ main1 ();
+ return 0;
+}