1 ; RUN: llc < %s -march=xcore | FileCheck %s 2 3 %0 = type { i32, i32, i32, i32 } 4 %1 = type { i32, i32, i32, i32, i32 } 5 6 ; Structs of 4 words can be returned in registers 7 define internal fastcc %0 @ReturnBigStruct() nounwind readnone { 8 entry: 9 %0 = insertvalue %0 zeroinitializer, i32 12, 0 10 %1 = insertvalue %0 %0, i32 24, 1 11 %2 = insertvalue %0 %1, i32 48, 2 12 %3 = insertvalue %0 %2, i32 24601, 3 13 ret %0 %3 14 } 15 ; CHECK: ReturnBigStruct: 16 ; CHECK: ldc r0, 12 17 ; CHECK: ldc r1, 24 18 ; CHECK: ldc r2, 48 19 ; CHECK: ldc r3, 24601 20 ; CHECK: retsp 0 21 22 ; Structs bigger than 4 words are returned via a hidden hidden sret-parameter 23 define internal fastcc %1 @ReturnBigStruct2() nounwind readnone { 24 entry: 25 %0 = insertvalue %1 zeroinitializer, i32 12, 0 26 %1 = insertvalue %1 %0, i32 24, 1 27 %2 = insertvalue %1 %1, i32 48, 2 28 %3 = insertvalue %1 %2, i32 24601, 3 29 %4 = insertvalue %1 %3, i32 4321, 4 30 ret %1 %4 31 } 32 ; CHECK: ReturnBigStruct2: 33 ; CHECK: ldc r1, 4321 34 ; CHECK: stw r1, r0[4] 35 ; CHECK: ldc r1, 24601 36 ; CHECK: stw r1, r0[3] 37 ; CHECK: ldc r1, 48 38 ; CHECK: stw r1, r0[2] 39 ; CHECK: ldc r1, 24 40 ; CHECK: stw r1, r0[1] 41 ; CHECK: ldc r1, 12 42 ; CHECK: stw r1, r0[0] 43 ; CHECK: retsp 0 44