[RISC-V] Avoid unnecessary extensions when value is already extended
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-46.c
blobfee60f36281cb3bf9fd98f80fb0378660cbf979f
1 /* { dg-require-effective-target vect_float } */
2 /* { dg-add-options double_vectors } */
3 /* { dg-additional-options "-fdump-tree-optimized-details-blocks" } */
5 #include <stdarg.h>
6 #include "tree-vect.h"
8 #define N 256
10 __attribute__ ((noinline))
11 void bar (float *pa, float *pb, float *pc)
13 int i;
15 /* check results: */
16 #pragma GCC novector
17 for (i = 0; i < N; i++)
19 if (pa[i] != (pb[i] * pc[i]))
20 abort();
23 return;
26 /* Aligned pointer accesses.
27 The loop bound is unknown.
28 No aliasing problems.
29 vect-40.c is similar to this one with one difference:
30 the loop bound is known. */
32 float b[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)))
33 = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
34 float c[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)))
35 = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
37 __attribute__ ((noinline)) int
38 main1 (int n)
40 int i;
41 float a[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
42 float *pa = a;
43 float *pb = b;
44 float *pc = c;
46 for (i = 0; i < n; i++)
48 pa[i] = pb[i] * pc[i];
51 bar (pa,pb,pc);
53 return 0;
56 int main (void)
58 int i;
59 int n=N;
60 check_vect ();
61 main1 (n);
62 return 0;
65 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
66 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" { xfail { ! vect_align_stack_vars } } } } */
67 /* { dg-final { scan-tree-dump-not "Invalid sum" "optimized" } } */