1 // RUN: %clang_cc1 -triple arm64-linux-gnu -target-feature +neon -target-abi aapcs -ffreestanding -emit-llvm -w -o - %s | FileCheck %s 2 3 // AAPCS clause C.8 says: If the argument has an alignment of 16 then the NGRN 4 // is rounded up to the next even number. 5 6 // CHECK: void @test1(i32 %x0, i128 %x2_x3, i128 %x4_x5, i128 %x6_x7, i128 %sp.coerce) 7 typedef union { __int128 a; } Small; 8 void test1(int x0, __int128 x2_x3, __int128 x4_x5, __int128 x6_x7, Small sp) { 9 } 10 11 12 // CHECK: void @test2(i32 %x0, i128 %x2_x3.coerce, i32 %x4, i128 %x6_x7.coerce, i32 %sp, i128 %sp16.coerce) 13 void test2(int x0, Small x2_x3, int x4, Small x6_x7, int sp, Small sp16) { 14 } 15 16 // We coerce HFAs into a contiguous [N x double] type if they're going on the 17 // stack in order to avoid holes. Make sure we get all of them, and not just the 18 // first: 19 20 // CHECK: void @test3(float %s0_s3.0, float %s0_s3.1, float %s0_s3.2, float %s0_s3.3, float %s4, [3 x float], [2 x double] %sp.coerce, [2 x double] %sp16.coerce) 21 typedef struct { float arr[4]; } HFA; 22 void test3(HFA s0_s3, float s4, HFA sp, HFA sp16) { 23 } 24 25 26 // However, we shouldn't perform the [N x double] coercion on types which have 27 // sufficient alignment to avoid holes on their own. We could coerce to [N x 28 // fp128] or something, but leaving them as-is retains more information for 29 // users to debug. 30 31 // CHECK: void @test4(<16 x i8> %v0_v2.0, <16 x i8> %v0_v2.1, <16 x i8> %v0_v2.2, <16 x i8> %v3_v5.0, <16 x i8> %v3_v5.1, <16 x i8> %v3_v5.2, [2 x float], <16 x i8> %sp.0, <16 x i8> %sp.1, <16 x i8> %sp.2, double %sp48, <16 x i8> %sp64.0, <16 x i8> %sp64.1, <16 x i8> %sp64.2) 32 typedef __attribute__((neon_vector_type(16))) signed char int8x16_t; 33 typedef struct { int8x16_t arr[3]; } BigHFA; 34 void test4(BigHFA v0_v2, BigHFA v3_v5, BigHFA sp, double sp48, BigHFA sp64) { 35 } 36 37 // It's the job of the argument *consumer* to perform the required sign & zero 38 // extensions under AAPCS. There shouldn't be 39 40 // CHECK: define i8 @test5(i8 %a, i16 %b) 41 unsigned char test5(unsigned char a, signed short b) { 42 } 43