xref: /aosp_15_r20/external/clang/test/CodeGen/sparc-arguments.c (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // RUN: %clang_cc1 -triple sparc-unknown-unknown -emit-llvm -o - %s | FileCheck %s
2*67e74705SXin Li 
3*67e74705SXin Li // Ensure that we pass proper alignment to llvm in the call
4*67e74705SXin Li // instruction. The proper alignment for the type is sometimes known
5*67e74705SXin Li // only by clang, and is not manifest in the LLVM-type. So, it must be
6*67e74705SXin Li // explicitly passed through. (Besides the case of the user specifying
7*67e74705SXin Li // alignment, as here, this situation also occurrs for non-POD C++
8*67e74705SXin Li // structs with tail-padding: clang emits these as packed llvm-structs
9*67e74705SXin Li // for ABI reasons.)
10*67e74705SXin Li 
11*67e74705SXin Li struct s1 {
12*67e74705SXin Li   int x;
13*67e74705SXin Li } __attribute__((aligned(8)));
14*67e74705SXin Li 
15*67e74705SXin Li struct s1 x1;
16*67e74705SXin Li 
17*67e74705SXin Li 
18*67e74705SXin Li // Ensure the align 8 is passed through:
19*67e74705SXin Li // CHECK-LABEL: define void @f1()
20*67e74705SXin Li // CHECK: call void @f1_helper(%struct.s1* byval align 8 @x1)
21*67e74705SXin Li // Also ensure the declaration of f1_helper includes it
22*67e74705SXin Li // CHECK: declare void @f1_helper(%struct.s1* byval align 8)
23*67e74705SXin Li 
24*67e74705SXin Li void f1_helper(struct s1);
f1()25*67e74705SXin Li void f1() {
26*67e74705SXin Li   f1_helper(x1);
27*67e74705SXin Li }
28