]>
Commit | Line | Data |
---|---|---|
46f8e3b0 | 1 | /* Test whether using attribute((hot)) really turns on -O3. Do this test |
2 | by checking whether we vectorize a simple loop. */ | |
3 | /* { dg-do compile } */ | |
4 | /* { dg-options "-O1 -msse2 -mfpmath=sse -march=k8" } */ | |
5 | /* { dg-final { scan-assembler "addps" } } */ | |
6 | /* { dg-final { scan-assembler "subss" } } */ | |
7 | ||
8 | #define SIZE 1024 | |
9 | float a[SIZE] __attribute__((__aligned__(32))); | |
10 | float b[SIZE] __attribute__((__aligned__(32))); | |
11 | float c[SIZE] __attribute__((__aligned__(32))); | |
12 | ||
13 | /* This should vectorize. */ | |
14 | void hot (void) __attribute__((__hot__)); | |
15 | ||
16 | void | |
17 | hot (void) | |
18 | { | |
19 | int i; | |
20 | ||
21 | for (i = 0; i < SIZE; i++) | |
22 | a[i] = b[i] + c[i]; | |
23 | } | |
24 | ||
25 | /* This should not vectorize. */ | |
26 | void | |
27 | not_hot (void) | |
28 | { | |
29 | int i; | |
30 | ||
31 | for (i = 0; i < SIZE; i++) | |
32 | a[i] = b[i] - c[i]; | |
33 | } |