Liu <pro...@gmail.com> writes:
> I write a pattern like this:
> (define_insn "extrv4di"
>   [(set (match_operand:V4DI 0 "register_operand" "=Z")
>       (unspec:V4DI
>         [(match_operand:V4DI 1 "register_operand" "Z")
>          (match_operand:SI 2 "immediate_operand" "")]
>         UNSPEC_EXTR))]
>   "TARGET_VECTORS"
>   "extrd\t%0,%1,%2"
>   [(set_attr "type" "vadd")])
>
> and the the code in mips.c:
> #define CODE_FOR_extrd CODE_FOR_extrv4di
>   XX_BUILTIN (extrd, MIPS_V4DI_FTYPE_V4DI_INT),
>
> define a macro in mips.md:
>    (UNSPEC_EXTR               821)
>
> the xx.h:
> __extension__ static __inline int64x4_t __attribute__ ((__always_inline__))
> extrd (int64x4_t s, const int i)
> {
>   return __builtin_extrd (s, i);
> }
>
> When I write a testcase like:
> int64x4_t vec_vpextrd (int64x4_t s, const int t)
> {
>   int64x4_t r;
>   r = vpextrd (s, t);
>   return r;
> }
>
> I get a error:
> /opt/cross-tools/bin/../lib/gcc/mips64el-unknown-linux-gnu/4.5.1/include/xx.h:1535:31:
> error: invalid argument to built-in function
>
> What should I do? What's the type of imm8/imm16 in builtin-func?

Not sure if you've already worked this out, but I think the problem
is that the "t" in vec_vpextrd is not a _known_ constant integer.
vec_vpextrd must either pass a specific integer itself or must
also be marked as always_inline (like vpextrd already is).

Richard

Reply via email to