Weddington, Eric schrieb:
Hi Johann,
Can we hold off on this patch for just a little bit? I agree it would
be good to clean it up, but I would like to get in the attached patch
to add some builtin functions that Anatoly and I worked on. The patch
was (nominally) for 4.4. I need to see if it will patch cleanly to
trunk, and if not, then I'd like to keep the changes minimal.
Your patch is more elaborate, I just didn't know you planned to commit
builtin support, nothing exciting in my work.
+ case AVR_BUILTIN_DELAY_CYCLES:
+ {
+ arg0 = CALL_EXPR_ARG (exp, 0);
+ op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
+
+ if (!CONSTANT_P (op0))
+ error ("__builtin_avr_delay_cycles expects an integer
constant.");
Should be
if (!CONST_INT_P (op0))
error ("__builtin_avr_delay_cycles expects a compile time
constant.");
You use INTVAL in the insns, and symbols/addresses cannot be handled
reasonably.
AFAIR avr-libc casts float down to int, so no need to handle/cast float?
+ emit_insn (gen_delay_cycles (op0));
+ return 0;
+ }
+ }
+
+ for (i = 0, d = bdesc_1arg; i < ARRAY_SIZE (bdesc_1arg); i++, d++)
+ if (d->code == fcode)
+ return avr_expand_unop_builtin (d->icode, exp, target);
+
+ for (i = 0, d = bdesc_1arg; i < ARRAY_SIZE (bdesc_2arg); i++, d++)
-------------------------^
Tippo?
+ if (d->code == fcode)
+ return avr_expand_binop_builtin (d->icode, exp, target);
Johann