| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -fdump-tree-fre-all -mvsx" } */ |
| 3 |
/* { dg-require-effective-target powerpc_vsx } */ |
| 4 |
|
| 5 |
/* Verify we remove a redundant load that occurs both before and after |
| 6 |
we call a vector load builtin. |
| 7 |
This testcase is introduced as we updated a number of our vector load |
| 8 |
built-ins with the attribute of PURE instead of MEM, to indicate that |
| 9 |
those builtins only read from memory, versus reading from and writing |
| 10 |
to the same. |
| 11 |
This means we can identify the redundant load instructions in an earlier |
| 12 |
pass, and optimize them away. */ |
| 13 |
|
| 14 |
#include <altivec.h> |
| 15 |
|
| 16 |
vector signed short load_data; |
| 17 |
|
| 18 |
vector signed short foo() |
| 19 |
{ |
| 20 |
vector signed short r11,r12,r13; |
| 21 |
r11 = load_data; |
| 22 |
r12 = vec_xl (0, &load_data[0]); |
| 23 |
r13 = load_data; |
| 24 |
return (r11 + r12 + r13); |
| 25 |
} |
| 26 |
|
| 27 |
vector signed short biz() |
| 28 |
{ |
| 29 |
vector signed short r21,r22,r23; |
| 30 |
r21 = load_data; |
| 31 |
r22 = vec_lvehx (0, &load_data[0]); |
| 32 |
r23 = load_data; |
| 33 |
return (r21 + r22 + r23); |
| 34 |
} |
| 35 |
|
| 36 |
vector signed short bar() |
| 37 |
{ |
| 38 |
vector signed short r31,r32,r33; |
| 39 |
r31 = load_data; |
| 40 |
r32 = vec_lvx (0, &load_data[0]); |
| 41 |
r33 = load_data; |
| 42 |
return (r31 + r32 + r33); |
| 43 |
} |
| 44 |
|
| 45 |
/* { dg-final { scan-tree-dump-times "Removing dead stmt r13_. = load_data;" 1 "fre1" } } */ |
| 46 |
/* { dg-final { scan-tree-dump-times "Removing dead stmt r23_. = load_data;" 1 "fre1" } } */ |
| 47 |
/* { dg-final { scan-tree-dump-times "Removing dead stmt r33_. = load_data;" 1 "fre1" } } */ |