This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Alpha CPU-specific builtins


Richard Henderson <rth@redhat.com> writes:

> On Sun, May 26, 2002 at 05:16:19PM +0200, Falk Hueffner wrote:
> > +(define_insn "minub8"
> > +  [(set (match_operand:DI 0 "register_operand" "=r")
> > +	(unspec:DI [(match_operand:DI 1 "reg_or_0_operand" "%rJ")
> > +		    (match_operand:DI 2 "reg_or_8bit_operand" "rI")]
> > +		   UNSPEC_MINUB8))]
> > +  ""
> > +  "minub8 %r1,%2,%0"
> > +  [(set_attr "type" "mvi")])
> 
> All of these can and should be described with vector modes.  E.g.
> 
> (define_insn "uminv8qi3"
>   [(set (match_operand:V8QI 0 "register_operand" "=r")
> 	(umin:V8QI (match_operand:V8QI "reg_or_0_operand" "rJ")
> 		   (match_operand:V8QI "reg_or_0_operand" "rJ")))]

                                      ^ missing 1 and 2 here, right?

>   "TARGET_MAX"
>   "minub8 %r1,%r2,%0"
>   [(set_attr "type" "mvi")])
> 
> (define_expand "minub8"
>   [(match_operand:DI 0 "register_operand" "")
>    (match_operand:DI 1 "reg_or_0_operand" "")
>    (match_operand:DI 2 "reg_or_0_operand" "")]
>   "TARGET_MAX"
> {
>   operands[0] = gen_lowpart (V8QImode, operands[0]);
>   if (operands[1] == const0_rtx)
>     operands[1] = CONST0_RTX (V8QImode);
>   else
>     operands[1] = gen_lowpart (V8QImode, operands[1]);
>   if (operands[2] == const0_rtx)
>     operands[2] = CONST0_RTX (V8QImode);
>   else
>     operands[2] = gen_lowpart (V8QImode, operands[2]);
>   emit_insn (gen_uminv8qi3 (operands[0], operands[1], operands[2]));
>   DONE;
> })

Ok, I've tried this, but when I actually use 0 literals, like in:

unsigned long f(unsigned long a) { return __builtin_alpha_minub8(a, 0); }

I get

x.c:2: unrecognizable insn:
(insn 13 5 18 (set (subreg:V8QI (reg:DI 71) 0)
        (umin:V8QI (subreg:V8QI (reg/v:DI 70) 0)
            (const_vector:V8QI[ 
                    (const_int 0 [0x0])
                    (const_int 0 [0x0])
                    (const_int 0 [0x0])
                    (const_int 0 [0x0])
                    (const_int 0 [0x0])
                    (const_int 0 [0x0])
                    (const_int 0 [0x0])
                    (const_int 0 [0x0])
                ] ))) -1 (insn_list 4 (nil))
    (expr_list:REG_DEAD (reg/v:DI 70)
        (nil)))
x.c:2: Internal compiler error in extract_insn, at recog.c:2133

Sorry, I don't understand what's going wrong here, could you give me a
hint?

Also, with this formulation, minub8 won't ever be emitted with an
immediate, right? (Not that I could think of any reasonable
application for an immediate != 0 here, but...)

-- 
	Falk


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]