Home | History | Annotate | Download | only in CodeGen
      1 // RUN:  %clang_cc1 -triple aarch64_be-linux-gnu -ffreestanding -emit-llvm -O0 -o - %s | FileCheck %s
      2 
      3 #include <stdarg.h>
      4 
      5 // A single member HFA must be aligned just like a non-HFA register argument.
      6 double callee(int a, ...) {
      7 // CHECK: [[REGPP:%.*]] = getelementptr inbounds %struct.__va_list, %struct.__va_list* [[VA:%.*]], i32 0, i32 2
      8 // CHECK: [[REGP:%.*]] = load i8*, i8** [[REGPP]], align 8
      9 // CHECK: [[OFFSET0:%.*]] = getelementptr inbounds i8, i8* [[REGP]], i32 {{.*}}
     10 // CHECK: [[OFFSET1:%.*]] = getelementptr inbounds i8, i8* [[OFFSET0]], i64 8
     11 
     12 // CHECK: [[MEMPP:%.*]] = getelementptr inbounds %struct.__va_list, %struct.__va_list* [[VA:%.*]], i32 0, i32 0
     13 // CHECK: [[MEMP:%.*]] = load i8*, i8** [[MEMPP]], align 8
     14 // CHECK: [[NEXTP:%.*]] = getelementptr inbounds i8, i8* [[MEMP]], i64 8
     15 // CHECK: store i8* [[NEXTP]], i8** [[MEMPP]], align 8
     16   va_list vl;
     17   va_start(vl, a);
     18   double result = va_arg(vl, struct { double a; }).a;
     19   va_end(vl);
     20   return result;
     21 }
     22