[llvm-commits] [PATCH]: ppc32 va_arg() implementation

Roman Divacky rdivacky at freebsd.org
Tue Jun 14 13:02:30 PDT 2011


On Tue, Jun 14, 2011 at 12:59:18PM -0700, Eli Friedman wrote:
> On Tue, Jun 14, 2011 at 12:47 PM, Roman Divacky <rdivacky at freebsd.org> wrote:
> > Hi,
> >
> > the attached patch implements va_arg() lowering on ppc32.
> > Ints (8, 16, 32 and also 64 bits that need special treatment) work,
> > floats don't work (neither with gcc - we should warn when someone tries
> > to use them on ppc32 probably), doubles do work.
> 
> It's impossible to make any C frontend generate a call to a varargs
> function that actually passes in something of type "float"... are you
> sure you're testing correctly?

This is an example with doubles, to change it to floats you just
change the type and the literal passed in. Am I doing something wrong?:

void bar(int w, ...) {
  double d;
  va_list ap;
  va_start(ap, w);

  printf("\n\n");
  do {
    d = va_arg(ap, double);
    printf("d = %f\n", d);
  } while (d != 0.0);
  va_end(ap);
}

int main() {
  bar(1, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 0.0);
}




More information about the llvm-commits mailing list