Roman Divacky | 9d760ae | 2012-09-12 14:47:47 +0000 | [diff] [blame] | 1 | ; RUN: llc -O0 -disable-fp-elim -mtriple=powerpc-unknown-linux-gnu < %s | FileCheck %s -check-prefix=PPC32 |
Hal Finkel | b99c995 | 2013-04-13 08:09:20 +0000 | [diff] [blame^] | 2 | ; RUN: llc -O0 -disable-fp-elim -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=PPC64-FP |
| 3 | ; RUN: llc -O0 -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=PPC64 |
Roman Divacky | 9d760ae | 2012-09-12 14:47:47 +0000 | [diff] [blame] | 4 | |
| 5 | declare void @foo() |
| 6 | |
| 7 | define i32 @test_cr2() nounwind { |
| 8 | entry: |
| 9 | %ret = alloca i32, align 4 |
| 10 | %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 |
| 11 | store i32 %0, i32* %ret, align 4 |
| 12 | call void @foo() |
| 13 | %1 = load i32* %ret, align 4 |
| 14 | ret i32 %1 |
| 15 | } |
| 16 | |
| 17 | ; PPC32: mfcr 12 |
| 18 | ; PPC32-NEXT: stw 12, {{[0-9]+}}(31) |
| 19 | ; PPC32: lwz 12, {{[0-9]+}}(31) |
| 20 | ; PPC32-NEXT: mtcrf 32, 12 |
| 21 | |
| 22 | ; PPC64: mfcr 12 |
| 23 | ; PPC64-NEXT: stw 12, 8(1) |
| 24 | ; PPC64: lwz 12, 8(1) |
| 25 | ; PPC64-NEXT: mtcrf 32, 12 |
| 26 | |
Hal Finkel | b99c995 | 2013-04-13 08:09:20 +0000 | [diff] [blame^] | 27 | ; PPC64-FP: mfcr 12 |
| 28 | ; PPC64-FP-NEXT: stw 12, 8(31) |
| 29 | ; PPC64-FP: lwz 12, 8(31) |
| 30 | ; PPC64-FP-NEXT: mtcrf 32, 12 |
| 31 | |
Roman Divacky | 9d760ae | 2012-09-12 14:47:47 +0000 | [diff] [blame] | 32 | define i32 @test_cr234() nounwind { |
| 33 | entry: |
| 34 | %ret = alloca i32, align 4 |
| 35 | %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 |
| 36 | store i32 %0, i32* %ret, align 4 |
| 37 | call void @foo() |
| 38 | %1 = load i32* %ret, align 4 |
| 39 | ret i32 %1 |
| 40 | } |
| 41 | |
| 42 | ; PPC32: mfcr 12 |
| 43 | ; PPC32-NEXT: stw 12, {{[0-9]+}}(31) |
| 44 | ; PPC32: lwz 12, {{[0-9]+}}(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-NEXT: stw 12, 8(1) |
| 51 | ; PPC64: lwz 12, 8(1) |
| 52 | ; PPC64-NEXT: mtcrf 32, 12 |
| 53 | ; PPC64-NEXT: mtcrf 16, 12 |
| 54 | ; PPC64-NEXT: mtcrf 8, 12 |
| 55 | |
Hal Finkel | b99c995 | 2013-04-13 08:09:20 +0000 | [diff] [blame^] | 56 | ; PPC64-FP: mfcr 12 |
| 57 | ; PPC64-FP-NEXT: stw 12, 8(31) |
| 58 | ; PPC64-FP: lwz 12, 8(31) |
| 59 | ; PPC64-FP-NEXT: mtcrf 32, 12 |
| 60 | ; PPC64-FP-NEXT: mtcrf 16, 12 |
| 61 | ; PPC64-FP-NEXT: mtcrf 8, 12 |
| 62 | |