1; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s -check-prefix=COLDCC
2
3%struct.MyStruct = type { i32, i32, i32, i32 }
4
5@caller.s = internal unnamed_addr global %struct.MyStruct zeroinitializer, align 8
6
7define signext i32 @caller(i32 signext %a, i32 signext %b, i32 signext %cold) {
8entry:
9; COLDCC: bl callee
10; COLDCC: ld 4, 40(1)
11; COLDCC: ld 5, 32(1)
12  %call = tail call coldcc { i64, i64 } @callee(i32 signext %a, i32 signext %b)
13  %0 = extractvalue { i64, i64 } %call, 0
14  %1 = extractvalue { i64, i64 } %call, 1
15  store i64 %0, i64* bitcast (%struct.MyStruct* @caller.s to i64*), align 8
16  store i64 %1, i64* bitcast (i32* getelementptr inbounds (%struct.MyStruct, %struct.MyStruct* @caller.s, i64 0, i32 2) to i64*), align 8
17  %2 = lshr i64 %1, 32
18  %3 = trunc i64 %2 to i32
19  %sub = sub nsw i32 0, %3
20  ret i32 %sub
21}
22
23define internal coldcc { i64, i64 } @callee(i32 signext %a, i32 signext %b) {
24entry:
25; COLDCC: std {{[0-9]+}}, 0(3)
26; COLDCC: std {{[0-9]+}}, 8(3)
27  %0 = tail call i32 asm "add $0, $1, $2", "=r,r,r,~{r6},~{r7},~{r8},~{r9},~{r10}"(i32 %a, i32 %b)
28  %mul = mul nsw i32 %a, 3
29  %1 = mul i32 %b, -5
30  %add = add i32 %1, %mul
31  %sub = add i32 %add, %0
32  %mul5 = mul nsw i32 %b, %a
33  %add6 = add nsw i32 %sub, %mul5
34  %retval.sroa.0.0.insert.ext = zext i32 %0 to i64
35  %retval.sroa.3.8.insert.ext = zext i32 %sub to i64
36  %retval.sroa.3.12.insert.ext = zext i32 %add6 to i64
37  %retval.sroa.3.12.insert.shift = shl nuw i64 %retval.sroa.3.12.insert.ext, 32
38  %retval.sroa.3.12.insert.insert = or i64 %retval.sroa.3.12.insert.shift, %retval.sroa.3.8.insert.ext
39  %.fca.0.insert = insertvalue { i64, i64 } undef, i64 %retval.sroa.0.0.insert.ext, 0
40  %.fca.1.insert = insertvalue { i64, i64 } %.fca.0.insert, i64 %retval.sroa.3.12.insert.insert, 1
41  ret { i64, i64 } %.fca.1.insert
42}
43