1; RUN: llc -mtriple=powerpc64-unknown-aix-xcoff -mcpu=pwr4 --mattr=-altivec \
2; RUN: --verify-machineinstrs < %s | FileCheck --check-prefix=64BIT %s
3
4; RUN: llc -mtriple=powerpc-unknown-aix-xcoff -mcpu=pwr4 --mattr=-altivec \
5; RUN: --verify-machineinstrs < %s | FileCheck --check-prefix=32BIT %s
6
7define dso_local signext i32 @killOne(i32 signext %i) {
8entry:
9  tail call void asm sideeffect "# Clobber CR", "~{cr4}"()
10  %call = call signext i32 @do_something(i32 %i)
11  ret i32 %call
12}
13
14define dso_local signext i32 @killAll(i32 signext %i) {
15entry:
16  tail call void asm sideeffect "# Clobber CR", "~{cr0},~{cr1},~{cr2},~{cr3},~{cr4},~{cr5},~{cr6},~{cr7}" ()
17  %call = call signext i32 @do_something(i32 %i)
18  ret i32 %call
19}
20
21declare signext i32 @do_something(i32 signext)
22
23; 64BIT-LABEL: .killOne:
24
25; 64BIT:       mflr 0
26; 64BIT-NEXT:  std 0, 16(1)
27; 64BIT-NEXT:  mfcr 12
28; 64BIT-NEXT:  stw 12, 8(1)
29; 64BIT:       stdu 1, -112(1)
30
31; 64BIT:       # Clobber CR
32; 64BIT:       bl .do_something
33
34; 64BIT:       addi 1, 1, 112
35; 64BIT-NEXT:  ld 0, 16(1)
36; 64BIT-NEXT:  lwz 12, 8(1)
37; 64BIT-NEXT:  mtlr 0
38; 64BIT-NEXT:  mtocrf 8, 12
39; 64BIT:       blr
40
41; 32BIT-LABEL: .killOne:
42
43; 32BIT:       mflr 0
44; 32BIT-NEXT:  stw 0, 8(1)
45; 32BIT-NEXT:  mfcr 12
46; 32BIT-NEXT:  stw 12, 4(1)
47; 32BIT:       stwu 1, -64(1)
48
49; 32BIT:       # Clobber CR
50; 32BIT:       bl .do_something
51
52; 32BIT:       addi 1, 1, 64
53; 32BIT-NEXT:  lwz 0, 8(1)
54; 32BIT-NEXT:  lwz 12, 4(1)
55; 32BIT-NEXT:  mtlr 0
56; 32BIT-NEXT:  mtocrf 8, 12
57; 32BIT:       blr
58
59
60; 64BIT-LABEL: .killAll:
61
62; 64BIT:        addi 1, 1, 112
63; 64BIT-NEXT:   ld 0, 16(1)
64; 64BIT-NEXT:   lwz 12, 8(1)
65; 64BIT-NEXT:   mtlr 0
66; 64BIT-NEXT:   mtocrf 32, 12
67; 64BIT-NEXT:   mtocrf 16, 12
68; 64BIT-NEXT:   mtocrf 8, 12
69; 64BIT-NEXT:   blr
70
71
72; 32BIT-LABEL: .killAll:
73
74; 32BIT:        addi 1, 1, 64
75; 32BIT-NEXT:   lwz 0, 8(1)
76; 32BIT-NEXT:   lwz 12, 4(1)
77; 32BIT-NEXT:   mtlr 0
78; 32BIT-NEXT:   mtocrf 32, 12
79; 32BIT-NEXT:   mtocrf 16, 12
80; 32BIT-NEXT:   mtocrf 8, 12
81; 32BIT-NEXT:   blr
82