]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/CodeGen/PowerPC/crsave.ll
Vendor import of llvm tags/RELEASE_33/final r183502 (effectively, 3.3
[FreeBSD/FreeBSD.git] / test / CodeGen / PowerPC / crsave.ll
1 ; RUN: llc -O0 -disable-fp-elim -mtriple=powerpc-unknown-linux-gnu < %s | FileCheck %s -check-prefix=PPC32
2 ; RUN: llc -O0 -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=PPC64
3
4 declare void @foo()
5
6 define i32 @test_cr2() nounwind {
7 entry:
8   %ret = alloca i32, align 4
9   %0 = call i32 asm sideeffect "\0A\09mtcr $4\0A\09cmp 2,$2,$1\0A\09mfcr $0", "=r,r,r,r,r,~{cr2}"(i32 1, i32 2, i32 3, i32 0) nounwind
10   store i32 %0, i32* %ret, align 4
11   call void @foo()
12   %1 = load i32* %ret, align 4
13   ret i32 %1
14 }
15
16 ; PPC32: stw 31, -4(1)
17 ; PPC32: stwu 1, -32(1)
18 ; PPC32: mfcr 12
19 ; PPC32-NEXT: stw 12, 24(31)
20 ; PPC32: lwz 12, 24(31)
21 ; PPC32-NEXT: mtcrf 32, 12
22
23 ; PPC64: mfcr 12
24 ; PPC64: stw 12, 8(1)
25 ; PPC64: stdu 1, -[[AMT:[0-9]+]](1)
26 ; PPC64: addi 1, 1, [[AMT]]
27 ; PPC64: lwz 12, 8(1)
28 ; PPC64: mtcrf 32, 12
29
30 define i32 @test_cr234() nounwind {
31 entry:
32   %ret = alloca i32, align 4
33   %0 = call i32 asm sideeffect "\0A\09mtcr $4\0A\09cmp 2,$2,$1\0A\09cmp 3,$2,$2\0A\09cmp 4,$2,$3\0A\09mfcr $0", "=r,r,r,r,r,~{cr2},~{cr3},~{cr4}"(i32 1, i32 2, i32 3, i32 0) nounwind
34   store i32 %0, i32* %ret, align 4
35   call void @foo()
36   %1 = load i32* %ret, align 4
37   ret i32 %1
38 }
39
40 ; PPC32: stw 31, -4(1)
41 ; PPC32: stwu 1, -32(1)
42 ; PPC32: mfcr 12
43 ; PPC32-NEXT: stw 12, 24(31)
44 ; PPC32: lwz 12, 24(31)
45 ; PPC32-NEXT: mtcrf 32, 12
46 ; PPC32-NEXT: mtcrf 16, 12
47 ; PPC32-NEXT: mtcrf 8, 12
48
49 ; PPC64: mfcr 12
50 ; PPC64: stw 12, 8(1)
51 ; PPC64: stdu 1, -[[AMT:[0-9]+]](1)
52 ; PPC64: addi 1, 1, [[AMT]]
53 ; PPC64: lwz 12, 8(1)
54 ; PPC64: mtcrf 32, 12
55 ; PPC64: mtcrf 16, 12
56 ; PPC64: mtcrf 8, 12
57