72 lines · c
1// RUN: %clang_cc1 -triple mipsel-unknown-linux -O3 -o - -emit-llvm %s | FileCheck %s -check-prefix=O322// RUN: %clang_cc1 -triple mips64el-unknown-linux -O3 -target-abi n64 -o - -emit-llvm %s | FileCheck %s -check-prefix=N643// RUN: %clang_cc1 -triple mipsel-unknown-linux -target-feature "+fp64" -O3 -o - -emit-llvm %s | FileCheck %s -check-prefix=O324 5typedef struct {6 double d;7 long double ld;8} S0;9 10// Insert padding to ensure arguments of type S0 are aligned to 16-byte boundaries.11 12// N64-LABEL: define{{.*}} void @foo1(i32 noundef signext %a0, i64 %0, double inreg %a1.coerce0, i64 inreg %a1.coerce1, i64 inreg %a1.coerce2, i64 inreg %a1.coerce3, double inreg %a2.coerce0, i64 inreg %a2.coerce1, i64 inreg %a2.coerce2, i64 inreg %a2.coerce3, i32 noundef signext %b, i64 %1, double inreg %a3.coerce0, i64 inreg %a3.coerce1, i64 inreg %a3.coerce2, i64 inreg %a3.coerce3)13// N64: tail call void @foo2(i32 noundef signext 1, i32 noundef signext 2, i32 noundef signext %a0, i64 undef, double inreg %a1.coerce0, i64 inreg %a1.coerce1, i64 inreg %a1.coerce2, i64 inreg %a1.coerce3, double inreg %a2.coerce0, i64 inreg %a2.coerce1, i64 inreg %a2.coerce2, i64 inreg %a2.coerce3, i32 noundef signext 3, i64 undef, double inreg %a3.coerce0, i64 inreg %a3.coerce1, i64 inreg %a3.coerce2, i64 inreg %a3.coerce3)14// N64: declare void @foo2(i32 noundef signext, i32 noundef signext, i32 noundef signext, i64, double inreg, i64 inreg, i64 inreg, i64 inreg, double inreg, i64 inreg, i64 inreg, i64 inreg, i32 noundef signext, i64, double inreg, i64 inreg, i64 inreg, i64 inreg)15 16extern void foo2(int, int, int, S0, S0, int, S0);17 18void foo1(int a0, S0 a1, S0 a2, int b, S0 a3) {19 foo2(1, 2, a0, a1, a2, 3, a3);20}21 22// Insert padding before long double argument.23//24// N64-LABEL: define{{.*}} void @foo3(i32 noundef signext %a0, i64 %0, fp128 noundef %a1)25// N64: tail call void @foo4(i32 noundef signext 1, i32 noundef signext 2, i32 noundef signext %a0, i64 undef, fp128 noundef %a1)26// N64: declare void @foo4(i32 noundef signext, i32 noundef signext, i32 noundef signext, i64, fp128 noundef)27 28extern void foo4(int, int, int, long double);29 30void foo3(int a0, long double a1) {31 foo4(1, 2, a0, a1);32}33 34// Insert padding after hidden argument.35//36// N64-LABEL: define{{.*}} void @foo5(ptr dead_on_unwind noalias writable sret(%struct.S0) align 16 %agg.result, i64 %0, fp128 noundef %a0)37// N64: call void @foo6(ptr dead_on_unwind writable sret(%struct.S0) align 16 %agg.result, i32 noundef signext 1, i32 noundef signext 2, i64 undef, fp128 noundef %a0)38// N64: declare void @foo6(ptr dead_on_unwind writable sret(%struct.S0) align 16, i32 noundef signext, i32 noundef signext, i64, fp128 noundef)39 40extern S0 foo6(int, int, long double);41 42S0 foo5(long double a0) {43 return foo6(1, 2, a0);44}45 46// Do not insert padding if ABI is O32.47//48// O32-LABEL: define{{.*}} void @foo7(float noundef %a0, double noundef %a1)49// O32: declare void @foo8(float noundef, double noundef)50 51extern void foo8(float, double);52 53void foo7(float a0, double a1) {54 foo8(a0 + 1.0f, a1 + 2.0);55}56 57// O32-LABEL: define{{.*}} void @foo9()58// O32: declare void @foo10(i32 noundef signext, i3259 60typedef struct __attribute__((aligned(16))) {61 int a;62} S16;63 64S16 s16;65 66void foo10(int, S16);67 68void foo9(void) {69 foo10(1, s16);70}71 72