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
0601d0cf
Commit
0601d0cf
authored
Sep 15, 2009
by
Revital Eres
Committed by
Revital Eres
Sep 15, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New function for checking misalignment
From-SVN: r151715
parent
e5e44796
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
125 additions
and
10 deletions
+125
-10
gcc/ChangeLog
+17
-0
gcc/config/rs6000/rs6000.c
+37
-1
gcc/doc/tm.texi
+8
-0
gcc/target-def.h
+5
-1
gcc/target.h
+5
-0
gcc/targhooks.c
+17
-0
gcc/targhooks.h
+4
-0
gcc/tree-vect-data-refs.c
+32
-8
No files found.
gcc/ChangeLog
View file @
0601d0cf
2009-09-15 Revital Eres <eres@il.ibm.com>
* doc/tm.texi (TARGET_SUPPORT_VECTOR_MISALIGNMENT): Document.
* targhooks.c (default_builtin_support_vector_misalignment):
New builtin function.
* targhooks.h (default_builtin_support_vector_misalignment):
Declare.
* target.h (builtin_support_vector_misalignment):
New field in struct gcc_target.
* tree-vect-data-refs.c (vect_supportable_dr_alignment): Call
new builtin function.
* target-def.h (TARGET_SUPPORT_VECTOR_MISALIGNMENT):
Define.
* config/rs6000/rs6000.c
(rs6000_builtin_support_vector_misalignment): New function.
(TARGET_SUPPORT_VECTOR_MISALIGNMENT): Define.
2009-09-15 Jie Zhang <jie.zhang@analog.com>
2009-09-15 Jie Zhang <jie.zhang@analog.com>
* config/bfin/bfin.c (length_for_loop): Use NONDEBUG_INSN_P
* config/bfin/bfin.c (length_for_loop): Use NONDEBUG_INSN_P
...
...
gcc/config/rs6000/rs6000.c
View file @
0601d0cf
...
@@ -919,6 +919,10 @@ static tree rs6000_builtin_mul_widen_even (tree);
...
@@ -919,6 +919,10 @@ static tree rs6000_builtin_mul_widen_even (tree);
static
tree
rs6000_builtin_mul_widen_odd
(
tree
);
static
tree
rs6000_builtin_mul_widen_odd
(
tree
);
static
tree
rs6000_builtin_conversion
(
unsigned
int
,
tree
);
static
tree
rs6000_builtin_conversion
(
unsigned
int
,
tree
);
static
tree
rs6000_builtin_vec_perm
(
tree
,
tree
*
);
static
tree
rs6000_builtin_vec_perm
(
tree
,
tree
*
);
static
bool
rs6000_builtin_support_vector_misalignment
(
enum
machine_mode
,
const_tree
,
int
,
bool
);
static
void
def_builtin
(
int
,
const
char
*
,
tree
,
int
);
static
void
def_builtin
(
int
,
const
char
*
,
tree
,
int
);
static
bool
rs6000_vector_alignment_reachable
(
const_tree
,
bool
);
static
bool
rs6000_vector_alignment_reachable
(
const_tree
,
bool
);
...
@@ -1300,7 +1304,9 @@ static const struct attribute_spec rs6000_attribute_table[] =
...
@@ -1300,7 +1304,9 @@ static const struct attribute_spec rs6000_attribute_table[] =
#define TARGET_VECTORIZE_BUILTIN_CONVERSION rs6000_builtin_conversion
#define TARGET_VECTORIZE_BUILTIN_CONVERSION rs6000_builtin_conversion
#undef TARGET_VECTORIZE_BUILTIN_VEC_PERM
#undef TARGET_VECTORIZE_BUILTIN_VEC_PERM
#define TARGET_VECTORIZE_BUILTIN_VEC_PERM rs6000_builtin_vec_perm
#define TARGET_VECTORIZE_BUILTIN_VEC_PERM rs6000_builtin_vec_perm
#undef TARGET_SUPPORT_VECTOR_MISALIGNMENT
#define TARGET_SUPPORT_VECTOR_MISALIGNMENT \
rs6000_builtin_support_vector_misalignment
#undef TARGET_VECTOR_ALIGNMENT_REACHABLE
#undef TARGET_VECTOR_ALIGNMENT_REACHABLE
#define TARGET_VECTOR_ALIGNMENT_REACHABLE rs6000_vector_alignment_reachable
#define TARGET_VECTOR_ALIGNMENT_REACHABLE rs6000_vector_alignment_reachable
...
@@ -2895,6 +2901,36 @@ rs6000_vector_alignment_reachable (const_tree type ATTRIBUTE_UNUSED, bool is_pac
...
@@ -2895,6 +2901,36 @@ rs6000_vector_alignment_reachable (const_tree type ATTRIBUTE_UNUSED, bool is_pac
}
}
}
}
/* Return true if the vector misalignment factor is supported by the
target. */
bool
rs6000_builtin_support_vector_misalignment
(
enum
machine_mode
mode
,
const_tree
type
,
int
misalignment
,
bool
is_packed
)
{
if
(
TARGET_VSX
)
{
/* Return if movmisalign pattern is not supported for this mode. */
if
(
optab_handler
(
movmisalign_optab
,
mode
)
->
insn_code
==
CODE_FOR_nothing
)
return
false
;
if
(
misalignment
==
-
1
)
{
/* misalignment factor is unknown at compile time but we know
it's word aligned. */
if
(
rs6000_vector_alignment_reachable
(
type
,
is_packed
))
return
true
;
return
false
;
}
/* VSX supports word-aligned vector. */
if
(
misalignment
%
4
==
0
)
return
true
;
}
return
false
;
}
/* Implement targetm.vectorize.builtin_vec_perm. */
/* Implement targetm.vectorize.builtin_vec_perm. */
tree
tree
rs6000_builtin_vec_perm
(
tree
type
,
tree
*
mask_element_type
)
rs6000_builtin_vec_perm
(
tree
type
,
tree
*
mask_element_type
)
...
...
gcc/doc/tm.texi
View file @
0601d0cf
...
@@ -5679,6 +5679,14 @@ the vectorized function shall be of vector type @var{vec_type_out} and the
...
@@ -5679,6 +5679,14 @@ the vectorized function shall be of vector type @var{vec_type_out} and the
argument
types
should
be
@var
{
vec_type_in
}.
argument
types
should
be
@var
{
vec_type_in
}.
@end
deftypefn
@end
deftypefn
@deftypefn
{
Target
Hook
}
bool
TARGET_SUPPORT_VECTOR_MISALIGNMENT
(
enum
machine_mode
@var
{
mode
},
tree
@var
{
type
},
int
@var
{
misalignment
},
bool
@var
{
is_packed
})
This
hook
should
return
true
if
the
target
supports
misaligned
vector
store
/
load
of
a
specific
factor
denoted
in
the
@var
{
misalignment
}
parameter
.
The
vector
store
/
load
should
be
of
machine
mode
@var
{
mode
}
and
the
elements
in
the
vectors
should
be
of
type
@var
{
type
}.
@var
{
is_packed
}
parameter
is
true
if
the
memory
access
is
defined
in
a
packed
struct
.
@end
deftypefn
@node
Anchored
Addresses
@node
Anchored
Addresses
@section
Anchored
Addresses
@section
Anchored
Addresses
@cindex
anchored
addresses
@cindex
anchored
addresses
...
...
gcc/target-def.h
View file @
0601d0cf
...
@@ -388,6 +388,9 @@
...
@@ -388,6 +388,9 @@
#define TARGET_VECTOR_ALIGNMENT_REACHABLE \
#define TARGET_VECTOR_ALIGNMENT_REACHABLE \
default_builtin_vector_alignment_reachable
default_builtin_vector_alignment_reachable
#define TARGET_VECTORIZE_BUILTIN_VEC_PERM 0
#define TARGET_VECTORIZE_BUILTIN_VEC_PERM 0
#define TARGET_SUPPORT_VECTOR_MISALIGNMENT \
default_builtin_support_vector_misalignment
#define TARGET_VECTORIZE \
#define TARGET_VECTORIZE \
{ \
{ \
...
@@ -398,7 +401,8 @@
...
@@ -398,7 +401,8 @@
TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_ODD, \
TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_ODD, \
TARGET_VECTORIZE_BUILTIN_VECTORIZATION_COST, \
TARGET_VECTORIZE_BUILTIN_VECTORIZATION_COST, \
TARGET_VECTOR_ALIGNMENT_REACHABLE, \
TARGET_VECTOR_ALIGNMENT_REACHABLE, \
TARGET_VECTORIZE_BUILTIN_VEC_PERM \
TARGET_VECTORIZE_BUILTIN_VEC_PERM, \
TARGET_SUPPORT_VECTOR_MISALIGNMENT \
}
}
#define TARGET_DEFAULT_TARGET_FLAGS 0
#define TARGET_DEFAULT_TARGET_FLAGS 0
...
...
gcc/target.h
View file @
0601d0cf
...
@@ -481,6 +481,11 @@ struct gcc_target
...
@@ -481,6 +481,11 @@ struct gcc_target
/* Target builtin that implements vector permute. */
/* Target builtin that implements vector permute. */
tree
(
*
builtin_vec_perm
)
(
tree
,
tree
*
);
tree
(
*
builtin_vec_perm
)
(
tree
,
tree
*
);
/* Return true if the target supports misaligned store/load of a
specific factor denoted in the third parameter. The last parameter
is true if the access is defined in a packed struct. */
bool
(
*
builtin_support_vector_misalignment
)
(
enum
machine_mode
,
const_tree
,
int
,
bool
);
}
vectorize
;
}
vectorize
;
/* The initial value of target_flags. */
/* The initial value of target_flags. */
...
...
gcc/targhooks.c
View file @
0601d0cf
...
@@ -771,6 +771,23 @@ default_builtin_vector_alignment_reachable (const_tree type, bool is_packed)
...
@@ -771,6 +771,23 @@ default_builtin_vector_alignment_reachable (const_tree type, bool is_packed)
return
true
;
return
true
;
}
}
/* By default, assume that a target supports any factor of misalignment
memory access if it supports movmisalign patten.
is_packed is true if the memory access is defined in a packed struct. */
bool
default_builtin_support_vector_misalignment
(
enum
machine_mode
mode
,
const_tree
type
ATTRIBUTE_UNUSED
,
int
misalignment
ATTRIBUTE_UNUSED
,
bool
is_packed
ATTRIBUTE_UNUSED
)
{
if
(
optab_handler
(
movmisalign_optab
,
mode
)
->
insn_code
!=
CODE_FOR_nothing
)
return
true
;
return
false
;
}
bool
bool
default_hard_regno_scratch_ok
(
unsigned
int
regno
ATTRIBUTE_UNUSED
)
default_hard_regno_scratch_ok
(
unsigned
int
regno
ATTRIBUTE_UNUSED
)
{
{
...
...
gcc/targhooks.h
View file @
0601d0cf
...
@@ -77,6 +77,10 @@ extern tree default_builtin_vectorized_conversion (unsigned int, tree);
...
@@ -77,6 +77,10 @@ extern tree default_builtin_vectorized_conversion (unsigned int, tree);
extern
tree
default_builtin_reciprocal
(
unsigned
int
,
bool
,
bool
);
extern
tree
default_builtin_reciprocal
(
unsigned
int
,
bool
,
bool
);
extern
bool
default_builtin_vector_alignment_reachable
(
const_tree
,
bool
);
extern
bool
default_builtin_vector_alignment_reachable
(
const_tree
,
bool
);
extern
bool
default_builtin_support_vector_misalignment
(
enum
machine_mode
mode
,
const_tree
,
int
,
bool
);
/* These are here, and not in hooks.[ch], because not all users of
/* These are here, and not in hooks.[ch], because not all users of
hooks.h include tm.h, and thus we don't have CUMULATIVE_ARGS. */
hooks.h include tm.h, and thus we don't have CUMULATIVE_ARGS. */
...
...
gcc/tree-vect-data-refs.c
View file @
0601d0cf
...
@@ -3455,6 +3455,9 @@ vect_supportable_dr_alignment (struct data_reference *dr)
...
@@ -3455,6 +3455,9 @@ vect_supportable_dr_alignment (struct data_reference *dr)
if
(
DR_IS_READ
(
dr
))
if
(
DR_IS_READ
(
dr
))
{
{
bool
is_packed
=
false
;
tree
type
=
(
TREE_TYPE
(
DR_REF
(
dr
)));
if
(
optab_handler
(
vec_realign_load_optab
,
mode
)
->
insn_code
!=
if
(
optab_handler
(
vec_realign_load_optab
,
mode
)
->
insn_code
!=
CODE_FOR_nothing
CODE_FOR_nothing
&&
(
!
targetm
.
vectorize
.
builtin_mask_for_load
&&
(
!
targetm
.
vectorize
.
builtin_mask_for_load
...
@@ -3468,18 +3471,39 @@ vect_supportable_dr_alignment (struct data_reference *dr)
...
@@ -3468,18 +3471,39 @@ vect_supportable_dr_alignment (struct data_reference *dr)
else
else
return
dr_explicit_realign_optimized
;
return
dr_explicit_realign_optimized
;
}
}
if
(
!
known_alignment_for_access_p
(
dr
))
if
(
optab_handler
(
movmisalign_optab
,
mode
)
->
insn_code
!=
{
CODE_FOR_nothing
)
tree
ba
=
DR_BASE_OBJECT
(
dr
);
if
(
ba
)
is_packed
=
contains_packed_reference
(
ba
);
}
if
(
targetm
.
vectorize
.
builtin_support_vector_misalignment
(
mode
,
type
,
DR_MISALIGNMENT
(
dr
),
is_packed
))
/* Can't software pipeline the loads, but can at least do them. */
/* Can't software pipeline the loads, but can at least do them. */
return
dr_unaligned_supported
;
return
dr_unaligned_supported
;
}
}
else
else
{
{
if
(
movmisalign_optab
->
handlers
[
mode
].
insn_code
!=
CODE_FOR_nothing
)
bool
is_packed
=
false
;
return
dr_unaligned_supported
;
tree
type
=
(
TREE_TYPE
(
DR_REF
(
dr
)));
}
if
(
!
known_alignment_for_access_p
(
dr
))
{
tree
ba
=
DR_BASE_OBJECT
(
dr
);
if
(
ba
)
is_packed
=
contains_packed_reference
(
ba
);
}
if
(
targetm
.
vectorize
.
builtin_support_vector_misalignment
(
mode
,
type
,
DR_MISALIGNMENT
(
dr
),
is_packed
))
return
dr_unaligned_supported
;
}
/* Unsupported. */
/* Unsupported. */
return
dr_unaligned_unsupported
;
return
dr_unaligned_unsupported
;
}
}
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