https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97249

--- Comment #6 from Hongtao.liu <crazylht at gmail dot com> ---
We all ready have bellow in simplify-rtx.c, it seems we can also handle such
situation here.

---
3954     case VEC_SELECT:
3955       if (!VECTOR_MODE_P (mode))
3956         {
3957           gcc_assert (VECTOR_MODE_P (GET_MODE (trueop0)));
3958           gcc_assert (mode == GET_MODE_INNER (GET_MODE (trueop0)));
3959           gcc_assert (GET_CODE (trueop1) == PARALLEL);
3960           gcc_assert (XVECLEN (trueop1, 0) == 1);
3961 
3962           /* We can't reason about selections made at runtime.  */
3963           if (!CONST_INT_P (XVECEXP (trueop1, 0, 0)))
3964             return 0;
3965 
3966           if (vec_duplicate_p (trueop0, &elt0))
3967             return elt0;
3968 
3969           if (GET_CODE (trueop0) == CONST_VECTOR)
3970             return CONST_VECTOR_ELT (trueop0, INTVAL (XVECEXP
3971                                                       (trueop1, 0, 0)));
3972 
3973           /* Extract a scalar element from a nested VEC_SELECT expression
3974              (with optional nested VEC_CONCAT expression).  Some targets
3975              (i386) extract scalar element from a vector using chain of
3976              nested VEC_SELECT expressions.  When input operand is a
memory
3977              operand, this operation can be simplified to a simple scalar
3978              load from an offseted memory address.  */

---

Reply via email to