Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
76fd2caa
Commit
76fd2caa
authored
Apr 22, 2007
by
Revital Eres
Committed by
Revital Eres
Apr 22, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extend MVE patterns
From-SVN: r124037
parent
8972bcd8
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
98 additions
and
11 deletions
+98
-11
gcc/ChangeLog
+7
-0
gcc/loop-unroll.c
+29
-11
gcc/testsuite/ChangeLog
+4
-0
gcc/testsuite/gcc.dg/var-expand3.c
+58
-0
No files found.
gcc/ChangeLog
View file @
76fd2caa
2007-04-22 Revital Eres <eres@il.ibm.com>
* loop-unroll.c (var_to_expand): New field to support also
insns of the form x = something + x.
(analyze_insn_to_expand_var): Use it.
(expand_var_during_unrolling): Likewise.
2007-04-21 Zdenek Dvorak <dvorakz@suse.cz>
* predict.c: Include pointer-set.h.
...
...
gcc/loop-unroll.c
View file @
76fd2caa
...
...
@@ -98,6 +98,10 @@ struct var_to_expand
the accumulator. If REUSE_EXPANSION is 0 reuse
the original accumulator. Else use
var_expansions[REUSE_EXPANSION - 1]. */
unsigned
accum_pos
;
/* The position in which the accumulator is placed in
the insn src. For example in x = x + something
accum_pos is 0 while in x = something + x accum_pos
is 1. */
};
/* Information about optimization applied in
...
...
@@ -1565,10 +1569,11 @@ referenced_in_one_insn_in_loop_p (struct loop *loop, rtx reg)
static
struct
var_to_expand
*
analyze_insn_to_expand_var
(
struct
loop
*
loop
,
rtx
insn
)
{
rtx
set
,
dest
,
src
,
op1
;
rtx
set
,
dest
,
src
,
op1
,
op2
,
something
;
struct
var_to_expand
*
ves
;
enum
machine_mode
mode1
,
mode2
;
unsigned
accum_pos
;
set
=
single_set
(
insn
);
if
(
!
set
)
return
NULL
;
...
...
@@ -1593,27 +1598,39 @@ analyze_insn_to_expand_var (struct loop *loop, rtx insn)
if
(
!
have_insn_for
(
GET_CODE
(
src
),
GET_MODE
(
src
)))
return
NULL
;
if
(
!
XEXP
(
src
,
0
))
return
NULL
;
op1
=
XEXP
(
src
,
0
);
op2
=
XEXP
(
src
,
1
);
if
(
!
REG_P
(
dest
)
&&
!
(
GET_CODE
(
dest
)
==
SUBREG
&&
REG_P
(
SUBREG_REG
(
dest
))))
return
NULL
;
if
(
!
rtx_equal_p
(
dest
,
op1
))
return
NULL
;
if
(
rtx_equal_p
(
dest
,
op1
))
accum_pos
=
0
;
else
if
(
rtx_equal_p
(
dest
,
op2
))
accum_pos
=
1
;
else
return
NULL
;
/* The method of expansion that we are using; which includes
the initialization of the expansions with zero and the summation of
the expansions at the end of the computation will yield wrong results
for (x = something - x) thus avoid using it in that case. */
if
(
accum_pos
==
1
&&
GET_CODE
(
src
)
==
MINUS
)
return
NULL
;
something
=
(
accum_pos
==
0
)
?
op2
:
op1
;
if
(
!
referenced_in_one_insn_in_loop_p
(
loop
,
dest
))
return
NULL
;
if
(
rtx_referenced_p
(
dest
,
XEXP
(
src
,
1
)
))
if
(
rtx_referenced_p
(
dest
,
something
))
return
NULL
;
mode1
=
GET_MODE
(
dest
);
mode2
=
GET_MODE
(
XEXP
(
src
,
1
)
);
mode2
=
GET_MODE
(
something
);
if
((
FLOAT_MODE_P
(
mode1
)
||
FLOAT_MODE_P
(
mode2
))
&&
!
flag_unsafe_math_optimizations
)
...
...
@@ -1635,6 +1652,7 @@ analyze_insn_to_expand_var (struct loop *loop, rtx insn)
ves
->
op
=
GET_CODE
(
src
);
ves
->
expansion_count
=
0
;
ves
->
reuse_expansion
=
0
;
ves
->
accum_pos
=
accum_pos
;
return
ves
;
}
...
...
@@ -1983,7 +2001,7 @@ expand_var_during_unrolling (struct var_to_expand *ve, rtx insn)
new_reg
=
get_expansion
(
ve
);
validate_change
(
insn
,
&
SET_DEST
(
set
),
new_reg
,
1
);
validate_change
(
insn
,
&
XEXP
(
SET_SRC
(
set
),
0
),
new_reg
,
1
);
validate_change
(
insn
,
&
XEXP
(
SET_SRC
(
set
),
ve
->
accum_pos
),
new_reg
,
1
);
if
(
apply_change_group
())
if
(
really_new_expansion
)
...
...
gcc/testsuite/ChangeLog
View file @
76fd2caa
2007
-
04
-
22
Revital
Eres
<
eres
@il
.
ibm
.
com
>
*
gcc
.
dg
/
var
-
expand3
.
c
:
New
test
.
2007
-
04
-
21
Jerry
DeLisle
<
jvdelisle
@gcc
.
gnu
.
org
>
PR
fortran
/
31495
gcc/testsuite/gcc.dg/var-expand3.c
0 → 100644
View file @
76fd2caa
/* { dg-do run { target { powerpc*-*-* && powerpc_altivec_ok } } }} */
/* { dg-options "-O2 -funroll-loops -ffast-math -fvariable-expansion-in-unroller -maltivec -dL" } */
#include "altivec.h"
extern
void
abort
(
void
);
extern
void
exit
(
int
);
#define N 256
float
in1
[
N
]
__attribute__
((
__aligned__
(
16
)))
=
{
0
,
3
,
6
,
9
,
12
,
15
,
18
,
21
,
24
,
27
,
30
,
33
,
36
,
39
,
42
,
45
,
48
,
51
,
54
,
57
};
float
in2
[
N
]
__attribute__
((
__aligned__
(
16
)))
=
{
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
,
12
,
13
,
14
,
15
,
16
,
17
,
18
,
19
};
float
foo
(
int
n
)
{
unsigned
i
;
vector
float
vp1
,
vp2
,
vp3
,
vaccum
,
vzero
,
vtmp
;
float
accum
=
1
.
0
;
vzero
=
(
vector
float
){
0
,
0
,
0
,
0
};
vaccum
=
vzero
;
for
(
i
=
0
;
i
<
n
;
i
++
)
{
vp1
=
vec_ld
(
i
*
16
,
in1
);
vp2
=
vec_ld
(
i
*
16
,
in2
);
vaccum
=
vec_madd
(
vp1
,
vp2
,
vaccum
);
}
vtmp
=
vec_sld
(
vaccum
,
vaccum
,
8
);
vp1
=
vec_add
(
vaccum
,
vtmp
);
vtmp
=
vec_sld
(
vp1
,
vp1
,
4
);
vp2
=
vec_add
(
vp1
,
vtmp
);
vec_ste
(
vp2
,
0
,
&
accum
);
if
(
accum
!=
1518
)
return
0
;
return
accum
;
}
int
main
(
void
)
{
if
(
!
foo
(
3
))
abort
();
exit
(
0
);
}
/* { dg-final { scan-rtl-dump "Expanding Accumulator" "loop2_unroll" } } */
/* { dg-final { cleanup-rtl-dump "loop*" } } */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment