38 lines · c
1// RUN: %clang_cc1 -triple armebv7-arm-none-eabi -emit-llvm -w -o - %s | FileCheck %s2 3// this tests for AAPCS section 5.4:4// A Composite Type not larger than 4 bytes is returned in r0.5// The format is as if the result had been stored in memory at a6// word-aligned address and then loaded into r0 with an LDR instruction7 8extern union Us { short s; } us;9union Us callee_us(void) { return us; }10// CHECK-LABEL: callee_us()11// CHECK: zext i1612// CHECK: shl 13// CHECK: ret i3214 15void caller_us(void) {16 us = callee_us();17// CHECK-LABEL: caller_us()18// CHECK: call i3219// CHECK: lshr i3220// CHECK: trunc i3221}22 23extern struct Ss { short s; } ss;24struct Ss callee_ss(void) { return ss; }25// CHECK-LABEL: callee_ss()26// CHECK: zext i1627// CHECK: shl 28// CHECK: ret i3229 30void caller_ss(void) {31 ss = callee_ss();32// CHECK-LABEL: caller_ss()33// CHECK: call i3234// CHECK: lshr i3235// CHECK: trunc i3236}37 38