brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · 3bbdbeb Raw
78 lines · plain
1// RUN: %clang_cc1 -triple aarch64-pc-windows-msvc -fobjc-runtime=gnustep-2.2 -fobjc-dispatch-method=non-legacy -emit-llvm -o - %s | FileCheck %s2 3// Pass and return for type size <= 8 bytes.4struct S1 {5  int a[2];6};7 8// Pass and return hfa <= 8 bytes9struct F1 {10  float a[2];11};12 13// Pass and return for type size > 16 bytes.14struct S2 {15  int a[5];16};17 18// Pass and return aggregate (of size < 16 bytes) with non-trivial destructor.19// Sret and inreg: Returned in x020struct S3 {21  int a[3];22  ~S3();23};24S3::~S3() {25}26 27 28@interface MsgTest { id isa; } @end29@implementation MsgTest 30- (S1) smallS1 {31  S1 x;32  x.a[0] = 0;33  x.a[1] = 1;34  return x;35 36}37- (F1) smallF1 {38  F1 x;39  x.a[0] = 0.2f;40  x.a[1] = 0.5f;41  return x;42}43- (S2) stretS2 {44  S2 x;45  for (int i = 0; i < 5; i++) {46    x.a[i] = i;47  }48  return x;49}50- (S3) stretInRegS3 {51  S3 x;52  for (int i = 0; i < 3; i++) {53    x.a[i] = i;54  }55  return x;56}57+ (S3) msgTestStretInRegS3 {58  S3 x;59  for (int i = 0; i < 3; i++) {60    x.a[i] = i;61  }62  return x;63}64@end65 66void test0(MsgTest *t) {67    // CHECK: call {{.*}} @objc_msgSend68    S1 ret = [t smallS1];69    // CHECK: call {{.*}} @objc_msgSend70    F1 ret2 = [t smallF1];71    // CHECK: call {{.*}} @objc_msgSend_stret72    S2 ret3 = [t stretS2];73    // CHECK: call {{.*}} @objc_msgSend_stret274    S3 ret4 = [t stretInRegS3];75    // CHECK: call {{.*}} @objc_msgSend_stret276    S3 ret5 = [MsgTest msgTestStretInRegS3];77}78