diff options
author | Bernd Schmidt <bernds@redhat.co.uk> | 2000-09-08 09:39:23 +0000 |
---|---|---|
committer | Bernd Schmidt <crux@gcc.gnu.org> | 2000-09-08 09:39:23 +0000 |
commit | 82be40f7eb85596f2d654e7eeee000972022d344 (patch) | |
tree | 4f6d42c06e9dfee4a87179059fbbc9be5d35507b /gcc/combine.c | |
parent | d5e5ec886e4928470e299aaee34ede9402a3325e (diff) | |
download | gcc-82be40f7eb85596f2d654e7eeee000972022d344.zip gcc-82be40f7eb85596f2d654e7eeee000972022d344.tar.gz gcc-82be40f7eb85596f2d654e7eeee000972022d344.tar.bz2 |
Some vector operation simplifications.
From-SVN: r36263
Diffstat (limited to 'gcc/combine.c')
-rw-r--r-- | gcc/combine.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/gcc/combine.c b/gcc/combine.c index 56bedce3..053b420 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -4539,6 +4539,45 @@ combine_simplify_rtx (x, op0_mode, last, in_dest) break; + case VEC_SELECT: + { + rtx op0 = XEXP (x, 0); + rtx op1 = XEXP (x, 1); + int len; + + if (GET_CODE (op1) != PARALLEL) + abort (); + len = XVECLEN (op1, 0); + if (len == 1 + && GET_CODE (XVECEXP (op1, 0, 0)) == CONST_INT + && GET_CODE (op0) == VEC_CONCAT) + { + int offset = INTVAL (XVECEXP (op1, 0, 0)) * GET_MODE_SIZE (GET_MODE (x)); + + /* Try to find the element in the VEC_CONCAT. */ + for (;;) + { + if (GET_MODE (op0) == GET_MODE (x)) + return op0; + if (GET_CODE (op0) == VEC_CONCAT) + { + HOST_WIDE_INT op0_size = GET_MODE_SIZE (GET_MODE (XEXP (op0, 0))); + if (op0_size < offset) + op0 = XEXP (op0, 0); + else + { + offset -= op0_size; + op0 = XEXP (op0, 1); + } + } + else + break; + } + } + } + + break; + default: break; } |