diff options
author | Aldy Hernandez <aldyh@gcc.gnu.org> | 2002-06-18 01:35:47 +0000 |
---|---|---|
committer | Aldy Hernandez <aldyh@gcc.gnu.org> | 2002-06-18 01:35:47 +0000 |
commit | cb2a532e9fe754ec238fe679a131e1fd1c8c340e (patch) | |
tree | 73deecdababef51a80958fcc5dee4038fb6bac71 /gcc/expr.c | |
parent | 147d5f6f769614edda4de1f400fc603496da5170 (diff) | |
download | gcc-cb2a532e9fe754ec238fe679a131e1fd1c8c340e.zip gcc-cb2a532e9fe754ec238fe679a131e1fd1c8c340e.tar.gz gcc-cb2a532e9fe754ec238fe679a131e1fd1c8c340e.tar.bz2 |
simd-1.c: New.
2002-06-16 Aldy Hernandez <aldyh@redhat.com>
* gcc.c-torture/execute/simd-1.c: New.
* gcc.dg/simd-1.c: New.
* doc/extend.texi (Vector Extensions): Document that we can
specify simd types not specifically supported by the hardware.
Document that simd types can be used as function arguments.
Document that signness does make a difference in SIMD types.
Misc cleanups and revisions to the "vector extensions" section.
* simplify-rtx.c (simplify_subreg): Simplify subregs of vector
constants.
* expr.c (vector_mode_valid_p): New.
* expr.h: Add vector_mode_valid_p.
* defaults.h (VECTOR_MODE_SUPPORTED_P): Set default.
* emit-rtl.c (immed_double_const): Do not abort on vectors.
* c-common.c (type_for_mode): Always build vector nodes regardless
of VECTOR_MODE_SUPPORTED_P.
(handle_mode_attribute): Error if we can't emulate a nonexisting
vector mode.
(handle_vector_size_attribute): Same.
* optabs.c (expand_binop): Open-code vector operations.
(expand_unop): Open-code vector unops.
(expand_vector_binop): New.
(expand_vector_unop): New.
* c-typeck.c (build_binary_op): Allow vectors in binops.
Allow vectors in conditional operatiors.
(build_unary_op): Allow vectors in unary minus.
* config/rs6000/rs6000.h (ALTIVEC_VECTOR_MODE): Conditionalize on
TARGET_ALTIVEC.
From-SVN: r54727
Diffstat (limited to 'gcc/expr.c')
-rw-r--r-- | gcc/expr.c | 30 |
1 files changed, 30 insertions, 0 deletions
@@ -10791,4 +10791,34 @@ try_tablejump (index_type, index_expr, minval, range, return 1; } +/* Nonzero if the mode is a valid vector mode for this architecture. + This returns nonzero even if there is no hardware support for the + vector mode, but we can emulate with narrower modes. */ + +int +vector_mode_valid_p (mode) + enum machine_mode mode; +{ + enum mode_class class = GET_MODE_CLASS (mode); + enum machine_mode innermode; + + /* Doh! What's going on? */ + if (class != MODE_VECTOR_INT + && class != MODE_VECTOR_FLOAT) + return 0; + + /* Hardware support. Woo hoo! */ + if (VECTOR_MODE_SUPPORTED_P (mode)) + return 1; + + innermode = GET_MODE_INNER (mode); + + /* We should probably return 1 if requesting V4DI and we have no DI, + but we have V2DI, but this is probably very unlikely. */ + + /* If we have support for the inner mode, we can safely emulate it. + We may not have V2DI, but me can emulate with a pair of DIs. */ + return mov_optab->handlers[innermode].insn_code != CODE_FOR_nothing; +} + #include "gt-expr.h" |