diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2016-07-23 20:44:14 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2016-07-23 20:44:14 +0000 |
commit | 2b6b257f4e5503a7a2675bdb8735693db769f75c (patch) | |
tree | e85e046ae7003fe3bcc8b5454cd0fa3f7407b470 /test/CodeGen/arm64-arguments.c | |
parent | b4348ed0b7e90c0831b925fbee00b5f179a99796 (diff) |
Notes
Diffstat (limited to 'test/CodeGen/arm64-arguments.c')
-rw-r--r-- | test/CodeGen/arm64-arguments.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/test/CodeGen/arm64-arguments.c b/test/CodeGen/arm64-arguments.c index 93a1a198955e4..f90b8e3b93a8d 100644 --- a/test/CodeGen/arm64-arguments.c +++ b/test/CodeGen/arm64-arguments.c @@ -714,3 +714,34 @@ int32x4_t test_toobig_hva(int n, ...) { struct TooBigHVA h = __builtin_va_arg(thelist, struct TooBigHVA); return h.d; } + +typedef __attribute__((__ext_vector_type__(3))) float float32x3_t; +typedef struct { float32x3_t arr[4]; } HFAv3; + +float32x3_t test_hva_v3(int n, ...) { +// CHECK-LABEL: define <3 x float> @test_hva_v3(i32 %n, ...) +// CHECK: [[THELIST:%.*]] = alloca i8* +// CHECK: [[CURLIST:%.*]] = load i8*, i8** [[THELIST]] + + // HVA is not indirect, so occupies its full 16 bytes on the stack. but it + // must be properly aligned. +// CHECK: [[ALIGN0:%.*]] = ptrtoint i8* [[CURLIST]] to i64 +// CHECK: [[ALIGN1:%.*]] = add i64 [[ALIGN0]], 15 +// CHECK: [[ALIGN2:%.*]] = and i64 [[ALIGN1]], -16 +// CHECK: [[ALIGNED_LIST:%.*]] = inttoptr i64 [[ALIGN2]] to i8* + +// CHECK: [[NEXTLIST:%.*]] = getelementptr inbounds i8, i8* [[ALIGNED_LIST]], i64 64 +// CHECK: store i8* [[NEXTLIST]], i8** [[THELIST]] + +// CHECK: bitcast i8* [[ALIGNED_LIST]] to %struct.HFAv3* + __builtin_va_list l; + __builtin_va_start(l, n); + HFAv3 r = __builtin_va_arg(l, HFAv3); + return r.arr[2]; +} + +float32x3_t test_hva_v3_call(HFAv3 *a) { +// CHECK-LABEL: define <3 x float> @test_hva_v3_call(%struct.HFAv3* %a) +// CHECK: call <3 x float> (i32, ...) @test_hva_v3(i32 1, [4 x <4 x float>] {{.*}}) + return test_hva_v3(1, *a); +} |