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
0b4565c9
Commit
0b4565c9
authored
Jun 24, 2000
by
Bernd Schmidt
Committed by
Bernd Schmidt
Jun 24, 2000
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Vector conversions support
From-SVN: r34680
parent
cf036e71
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
93 additions
and
5 deletions
+93
-5
gcc/ChangeLog
+13
-0
gcc/c-convert.c
+2
-0
gcc/convert.c
+37
-2
gcc/convert.h
+1
-0
gcc/expmed.c
+2
-1
gcc/expr.c
+17
-0
gcc/stor-layout.c
+11
-0
gcc/tree.def
+4
-0
gcc/tree.h
+6
-2
No files found.
gcc/ChangeLog
View file @
0b4565c9
2000-06-24 Bernd Schmidt <bernds@cygnus.co.uk>
* tree.def (VECTOR_TYPE): New node type.
* tree.h: Adjust some comments to reflect addition of vector types.
(TYPE_VECTOR_SUBPARTS): New macro.
* stor-layout.c (layout_type): Handle VECTOR_TYPE.
* c-convert.c (convert): Likewise.
* convert.c (convert_to_integer): Handle vector modes.
(convert_to_vector): New function.
* convert.h (convert_to_vector): Declare.
* expr.c (convert_move): Handle vector modes.
* expmed.c (extract_bit_field): Don't abort for vector modes.
2000-06-24 Marek Michalkiewicz <marekm@linux.org.pl>
2000-06-24 Marek Michalkiewicz <marekm@linux.org.pl>
* config/avr/avr-protos.h (avr_hard_regno_mode_ok): New prototype.
* config/avr/avr-protos.h (avr_hard_regno_mode_ok): New prototype.
...
...
gcc/c-convert.c
View file @
0b4565c9
...
@@ -94,6 +94,8 @@ convert (type, expr)
...
@@ -94,6 +94,8 @@ convert (type, expr)
return
fold
(
convert_to_real
(
type
,
e
));
return
fold
(
convert_to_real
(
type
,
e
));
if
(
code
==
COMPLEX_TYPE
)
if
(
code
==
COMPLEX_TYPE
)
return
fold
(
convert_to_complex
(
type
,
e
));
return
fold
(
convert_to_complex
(
type
,
e
));
if
(
code
==
VECTOR_TYPE
)
return
fold
(
convert_to_vector
(
type
,
e
));
error
(
"conversion to non-scalar type requested"
);
error
(
"conversion to non-scalar type requested"
);
return
error_mark_node
;
return
error_mark_node
;
...
...
gcc/convert.c
View file @
0b4565c9
...
@@ -108,8 +108,8 @@ convert_to_real (type, expr)
...
@@ -108,8 +108,8 @@ convert_to_real (type, expr)
/* Convert EXPR to some integer (or enum) type TYPE.
/* Convert EXPR to some integer (or enum) type TYPE.
EXPR must be pointer, integer, discrete (enum, char, or bool),
or float;
EXPR must be pointer, integer, discrete (enum, char, or bool),
float, or
in other cases error is called.
vector;
in other cases error is called.
The result of this is always supposed to be a newly created tree node
The result of this is always supposed to be a newly created tree node
not in use in any existing structure. */
not in use in any existing structure. */
...
@@ -383,6 +383,15 @@ convert_to_integer (type, expr)
...
@@ -383,6 +383,15 @@ convert_to_integer (type, expr)
fold
(
build1
(
REALPART_EXPR
,
fold
(
build1
(
REALPART_EXPR
,
TREE_TYPE
(
TREE_TYPE
(
expr
)),
expr
)));
TREE_TYPE
(
TREE_TYPE
(
expr
)),
expr
)));
case
VECTOR_TYPE
:
if
(
GET_MODE_SIZE
(
TYPE_MODE
(
type
))
!=
GET_MODE_SIZE
(
TYPE_MODE
(
TREE_TYPE
(
expr
))))
{
error
(
"can't convert between vector values of different size"
);
return
error_mark_node
;
}
return
build1
(
NOP_EXPR
,
type
,
expr
);
default
:
default
:
error
(
"aggregate value used where an integer was expected"
);
error
(
"aggregate value used where an integer was expected"
);
return
convert
(
type
,
integer_zero_node
);
return
convert
(
type
,
integer_zero_node
);
...
@@ -444,3 +453,29 @@ convert_to_complex (type, expr)
...
@@ -444,3 +453,29 @@ convert_to_complex (type, expr)
return
convert_to_complex
(
type
,
integer_zero_node
);
return
convert_to_complex
(
type
,
integer_zero_node
);
}
}
}
}
/* Convert EXPR to the vector type TYPE in the usual ways. */
tree
convert_to_vector
(
type
,
expr
)
tree
type
,
expr
;
{
tree
subtype
=
TREE_TYPE
(
type
);
switch
(
TREE_CODE
(
TREE_TYPE
(
expr
)))
{
case
INTEGER_TYPE
:
case
VECTOR_TYPE
:
if
(
GET_MODE_SIZE
(
TYPE_MODE
(
type
))
!=
GET_MODE_SIZE
(
TYPE_MODE
(
TREE_TYPE
(
expr
))))
{
error
(
"can't convert between vector values of different size"
);
return
error_mark_node
;
}
return
build1
(
NOP_EXPR
,
type
,
expr
);
default
:
error
(
"can't convert value to a vector"
);
return
convert_to_vector
(
type
,
integer_zero_node
);
}
}
gcc/convert.h
View file @
0b4565c9
...
@@ -22,3 +22,4 @@ extern tree convert_to_integer PARAMS ((tree, tree));
...
@@ -22,3 +22,4 @@ extern tree convert_to_integer PARAMS ((tree, tree));
extern
tree
convert_to_pointer
PARAMS
((
tree
,
tree
));
extern
tree
convert_to_pointer
PARAMS
((
tree
,
tree
));
extern
tree
convert_to_real
PARAMS
((
tree
,
tree
));
extern
tree
convert_to_real
PARAMS
((
tree
,
tree
));
extern
tree
convert_to_complex
PARAMS
((
tree
,
tree
));
extern
tree
convert_to_complex
PARAMS
((
tree
,
tree
));
extern
tree
convert_to_vector
PARAMS
((
tree
,
tree
));
gcc/expmed.c
View file @
0b4565c9
...
@@ -1072,7 +1072,8 @@ extract_bit_field (str_rtx, bitsize, bitnum, unsignedp,
...
@@ -1072,7 +1072,8 @@ extract_bit_field (str_rtx, bitsize, bitnum, unsignedp,
:
bitpos
==
0
))))
:
bitpos
==
0
))))
{
{
enum
machine_mode
mode1
enum
machine_mode
mode1
=
mode_for_size
(
bitsize
,
GET_MODE_CLASS
(
tmode
),
0
);
=
(
VECTOR_MODE_P
(
tmode
)
?
mode
:
mode_for_size
(
bitsize
,
GET_MODE_CLASS
(
tmode
),
0
));
if
(
mode1
!=
GET_MODE
(
op0
))
if
(
mode1
!=
GET_MODE
(
op0
))
{
{
...
...
gcc/expr.c
View file @
0b4565c9
...
@@ -545,6 +545,23 @@ convert_move (to, from, unsignedp)
...
@@ -545,6 +545,23 @@ convert_move (to, from, unsignedp)
return
;
return
;
}
}
if
(
VECTOR_MODE_P
(
to_mode
)
||
VECTOR_MODE_P
(
from_mode
))
{
if
(
GET_MODE_BITSIZE
(
from_mode
)
!=
GET_MODE_BITSIZE
(
to_mode
))
abort
();
if
(
VECTOR_MODE_P
(
to_mode
))
from
=
gen_rtx_SUBREG
(
to_mode
,
from
,
0
);
else
to
=
gen_rtx_SUBREG
(
from_mode
,
to
,
0
);
emit_move_insn
(
to
,
from
);
return
;
}
if
(
to_real
!=
from_real
)
abort
();
if
(
to_real
)
if
(
to_real
)
{
{
rtx
value
;
rtx
value
;
...
...
gcc/stor-layout.c
View file @
0b4565c9
...
@@ -1286,6 +1286,17 @@ layout_type (type)
...
@@ -1286,6 +1286,17 @@ layout_type (type)
TYPE_SIZE_UNIT
(
type
)
=
size_int
(
GET_MODE_SIZE
(
TYPE_MODE
(
type
)));
TYPE_SIZE_UNIT
(
type
)
=
size_int
(
GET_MODE_SIZE
(
TYPE_MODE
(
type
)));
break
;
break
;
case
VECTOR_TYPE
:
{
tree
subtype
;
subtype
=
TREE_TYPE
(
type
);
TREE_UNSIGNED
(
type
)
=
TREE_UNSIGNED
(
subtype
);
TYPE_SIZE
(
type
)
=
bitsize_int
(
GET_MODE_BITSIZE
(
TYPE_MODE
(
type
)));
TYPE_SIZE_UNIT
(
type
)
=
size_int
(
GET_MODE_SIZE
(
TYPE_MODE
(
type
)));
}
break
;
case
VOID_TYPE
:
case
VOID_TYPE
:
/* This is an incomplete type and so doesn't have a size. */
/* This is an incomplete type and so doesn't have a size. */
TYPE_ALIGN
(
type
)
=
1
;
TYPE_ALIGN
(
type
)
=
1
;
...
...
gcc/tree.def
View file @
0b4565c9
...
@@ -150,6 +150,10 @@ DEFTREECODE (REAL_TYPE, "real_type", 't', 0)
...
@@ -150,6 +150,10 @@ DEFTREECODE (REAL_TYPE, "real_type", 't', 0)
of the real and imaginary parts. */
of the real and imaginary parts. */
DEFTREECODE (COMPLEX_TYPE, "complex_type", 't', 0)
DEFTREECODE (COMPLEX_TYPE, "complex_type", 't', 0)
/* Vector types. The TREE_TYPE field is the data type of the vector
elements. */
DEFTREECODE (VECTOR_TYPE, "vector_type", 't', 0)
/* C enums. The type node looks just like an INTEGER_TYPE node.
/* C enums. The type node looks just like an INTEGER_TYPE node.
The symbols for the values of the enum type are defined by
The symbols for the values of the enum type are defined by
CONST_DECL nodes, but the type does not point to them;
CONST_DECL nodes, but the type does not point to them;
...
...
gcc/tree.h
View file @
0b4565c9
...
@@ -332,7 +332,8 @@ extern void tree_class_check_failed PARAMS ((const tree, int,
...
@@ -332,7 +332,8 @@ extern void tree_class_check_failed PARAMS ((const tree, int,
/* In all nodes that are expressions, this is the data type of the expression.
/* In all nodes that are expressions, this is the data type of the expression.
In POINTER_TYPE nodes, this is the type that the pointer points to.
In POINTER_TYPE nodes, this is the type that the pointer points to.
In ARRAY_TYPE nodes, this is the type of the elements. */
In ARRAY_TYPE nodes, this is the type of the elements.
In VECTOR_TYPE nodes, this is the type of the elements. */
#define TREE_TYPE(NODE) ((NODE)->common.type)
#define TREE_TYPE(NODE) ((NODE)->common.type)
/* Nodes are chained together for many purposes.
/* Nodes are chained together for many purposes.
...
@@ -1012,7 +1013,10 @@ struct tree_block
...
@@ -1012,7 +1013,10 @@ struct tree_block
object of the given ARRAY_TYPE. This allows temporaries to be allocated. */
object of the given ARRAY_TYPE. This allows temporaries to be allocated. */
#define TYPE_ARRAY_MAX_SIZE(ARRAY_TYPE) TYPE_MAX_VALUE (ARRAY_TYPE)
#define TYPE_ARRAY_MAX_SIZE(ARRAY_TYPE) TYPE_MAX_VALUE (ARRAY_TYPE)
/* Indicates that objects of this type must be initialized by calling a
/* For a VECTOR_TYPE, this is the number of sub-parts of the vector. */
#define TYPE_VECTOR_SUBPARTS(VECTOR_TYPE) (GET_MODE_NUNITS (TYPE_CHECK (VECTOR_TYPE)->type.mode))
/* Indicates that objects of this type must be initialized by calling a
function when they are created. */
function when they are created. */
#define TYPE_NEEDS_CONSTRUCTING(NODE) \
#define TYPE_NEEDS_CONSTRUCTING(NODE) \
(TYPE_CHECK (NODE)->type.needs_constructing_flag)
(TYPE_CHECK (NODE)->type.needs_constructing_flag)
...
...
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