Revert "[llvm] Improve llvm.objectsize computation by computing GEP, alloca and mallo...
[llvm-project.git] / clang / test / CodeGen / arm64-be-hfa-vararg.c
blobe3e678d75d7ab6c0171583e3d5f462a3d2ba5460
1 // RUN: %clang_cc1 -triple aarch64_be-linux-gnu -ffreestanding -emit-llvm -O0 -o - %s | FileCheck %s
3 #include <stdarg.h>
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 nuw %struct.__va_list, ptr [[VA:%.*]], i32 0, i32 2
8 // CHECK: [[REGP:%.*]] = load ptr, ptr [[REGPP]], align 8
9 // CHECK: [[OFFSET0:%.*]] = getelementptr inbounds i8, ptr [[REGP]], i32 {{.*}}
10 // CHECK: [[OFFSET1:%.*]] = getelementptr inbounds i8, ptr [[OFFSET0]], i64 8
12 // CHECK: [[MEMPP:%.*]] = getelementptr inbounds nuw %struct.__va_list, ptr [[VA:%.*]], i32 0, i32 0
13 // CHECK: [[MEMP:%.*]] = load ptr, ptr [[MEMPP]], align 8
14 // CHECK: [[NEXTP:%.*]] = getelementptr inbounds i8, ptr [[MEMP]], i64 8
15 // CHECK: store ptr [[NEXTP]], ptr [[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;