// RUN: %clang_cc1 -triple avr -target-cpu atmega328 -emit-llvm %s -o - \
// RUN: | FileCheck %s --check-prefix AVR
// RUN: %clang_cc1 -triple avr -target-cpu attiny40 -emit-llvm %s -o - \
// RUN: | FileCheck %s --check-prefix TINY
// NOTE: All arguments are passed via the stack for functions with variable arguments.
// AVR: define {{.*}} i8 @foo0(i8 {{.*}}, i8 {{.*}}, ...)
// TINY: define {{.*}} i8 @foo0(i8 {{.*}}, i8 {{.*}}, ...)
// AVR-NOT: define {{.*}} i8 @foo0(i8 {{.*}} signext {{.*}}, i8 {{.*}} signext {{.*}}, ...)
// TINY-NOT: define {{.*}} i8 @foo0(i8 {{.*}} signext {{.*}}, i8 {{.*}} signext {{.*}}, ...)
char
// NOTE: All arguments are passed via registers on both avr and avrtiny.
// AVR: define {{.*}} i8 @foo1(i32 {{.*}}, i8 {{.*}} signext {{.*}})
// TINY: define {{.*}} i8 @foo1(i32 {{.*}}, i8 {{.*}} signext {{.*}})
char
// NOTE: The argument `char c` is passed via registers on avr, while via the stack on avrtiny.
// The argument `char b` costs 2 registers, so there is no vacant register left for
// `char c` on avrtiny.
// AVR: define {{.*}} i8 @foo2(i32 {{.*}}, i8 {{.*}} signext {{.*}}, i8 {{.*}} signext {{.*}})
// TINY: define {{.*}} i8 @foo2(i32 {{.*}}, i8 {{.*}} signext {{.*}}, i8 {{.*}})
// TINY-NOT: define {{.*}} i8 @foo2(i32 {{.*}}, i8 {{.*}} signext {{.*}}, i8 {{.*}} signext {{.*}})
char
// NOTE: On avr, the argument `a` costs 16 registers and `b` costs 2 registers, so
// `c` has to be passed via the stack.
// AVR: define {{.*}} i8 @foo3({{.*}}, i8 {{.*}} signext {{.*}}, i8 {{.*}})
// AVR-NOT: define {{.*}} i8 @foo3({{.*}}, i8 {{.*}} signext {{.*}}, i8 {{.*}} signext {{.*}})
// TINY: define {{.*}} i8 @foo3({{.*}}, i8 {{.*}}, i8 {{.*}})
// TINY-NOT: define {{.*}} i8 @foo3({{.*}}, i8 {{.*}} signext {{.*}}, i8 {{.*}} signext {{.*}})
;
char
// NOTE: On avr, `a` only costs 16 registers, though there are 2 vacant registers,
// both `b` and `c` have to be passed via the stack.
// AVR: define {{.*}} i8 @foo4({{.*}}, i32 {{.*}}, i8 {{.*}})
// AVR-NOT: define {{.*}} i8 @foo4({{.*}}, i32 {{.*}}, i8 {{.*}} signext {{.*}})
// TINY: define {{.*}} i8 @foo4({{.*}}, i32 {{.*}}, i8 {{.*}})
// TINY-NOT: define {{.*}} i8 @foo4({{.*}}, i32 {{.*}}, i8 {{.*}} signext {{.*}})
char
// NOTE: On avrtiny, `a` only costs 4 registers, though there are 2 vacant
// registers, both `b` and `c` are passed via the stack.
// AVR: define {{.*}} i8 @foo5(i32 {{.*}}, i32 {{.*}}, i8 {{.*}} signext {{.*}})
// TINY: define {{.*}} i8 @foo5(i32 {{.*}}, i32 {{.*}}, i8 {{.*}})
// TINY-NOT: define {{.*}} i8 @foo5(i32 {{.*}}, i32 {{.*}}, i8 {{.*}} signext {{.*}})
char
// NOTE: All arguments are passed via the stack, though all registers are vacant.
// AVR: define {{.*}} i8 @foo6({{.*}}, i8 {{.*}})
// AVR-NOT: define {{.*}} i8 @foo6({{.*}}, i8 {{.*}} signext {{.*}})
// TINY: define {{.*}} i8 @foo6({{.*}}, i8 {{.*}})
// TINY-NOT: define {{.*}} i8 @foo6({{.*}}, i8 {{.*}} signext {{.*}})
;
char
// NOTE: All arguments are passed via registers on avr. While all arguments are passed
// via the stack on avrtiny, though all registers are vacant.
// AVR: define {{.*}} i8 @foo7({{.*}}, i8 {{.*}} signext {{.*}})
// TINY: define {{.*}} i8 @foo7({{.*}}, i8 {{.*}})
// TINY-NOT: define {{.*}} i8 @foo7({{.*}}, i8 {{.*}} signext {{.*}})
char
// NOTE: On avr, though `a` only cost 16 registers, `b` has to be passed via the
// stack, since there is an implicit pointer argument costs 2 registers.
// AVR: define {{.*}} @foo8({{.*}}, {{.*}}, i8 {{.*}})
// AVR-NOT: define {{.*}} @foo8({{.*}}, {{.*}}, i8 {{.*}} signext {{.*}})
// TINY: define {{.*}} @foo8({{.*}}, {{.*}}, i8 {{.*}})
// TINY-NOT: define {{.*}} @foo8({{.*}}, {{.*}}, i8 {{.*}} signext {{.*}})
struct s15
// NOTE: On avrtiny, `b` has to be passed via the stack, since there is an
// implicit pointer argument costs 2 registers.
// AVR: define {{.*}} @foo9({{.*}}, i32 {{.*}}, i8 {{.*}} signext {{.*}})
// TINY: define {{.*}} @foo9({{.*}}, i32 {{.*}}, i8 {{.*}})
// TINY-NOT: define {{.*}} @foo9({{.*}}, i32 {{.*}}, i8 {{.*}} signext {{.*}})
struct s15
// NOTE: All arguments are passed via registers, though there is an implicit
// pointer argument costs 2 registers.
// AVR: define {{.*}} @fooa({{.*}}, i8 {{.*}} signext {{.*}}, i8 {{.*}} signext {{.*}})
// TINY: define {{.*}} @fooa({{.*}}, i8 {{.*}} signext {{.*}}, i8 {{.*}} signext {{.*}})
struct s15