• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -triple armebv7-arm-none-eabi -emit-llvm -w -o - %s | FileCheck %s
2 
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 a
6 // word-aligned address and then loaded into r0 with an LDR instruction
7 
8 extern union Us { short s; } us;
callee_us()9 union Us callee_us() { return us; }
10 // CHECK-LABEL: callee_us()
11 // CHECK: zext i16
12 // CHECK: shl
13 // CHECK: ret i32
14 
caller_us()15 void caller_us() {
16   us = callee_us();
17 // CHECK-LABEL: caller_us()
18 // CHECK: call i32
19 // CHECK: lshr i32
20 // CHECK: trunc i32
21 }
22 
23 extern struct Ss { short s; } ss;
callee_ss()24 struct Ss callee_ss() { return ss; }
25 // CHECK-LABEL: callee_ss()
26 // CHECK: zext i16
27 // CHECK: shl
28 // CHECK: ret i32
29 
caller_ss()30 void caller_ss() {
31   ss = callee_ss();
32 // CHECK-LABEL: caller_ss()
33 // CHECK: call i32
34 // CHECK: lshr i32
35 // CHECK: trunc i32
36 }
37 
38