1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \
3 ; RUN: -mcpu=pwr8 < %s | FileCheck %s
4 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu \
5 ; RUN: -mcpu=pwr7 < %s | FileCheck %s
6 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-aix \
7 ; RUN: -mcpu=pwr7 < %s | FileCheck %s
8 ; RUN: llc -verify-machineinstrs -mtriple=powerpc-unknown-aix \
9 ; RUN: -mcpu=pwr7 < %s | FileCheck %s --check-prefix=CHECK-32BIT
11 declare i32 @llvm.ppc.mftbu()
12 declare i32 @llvm.ppc.mfmsr()
13 declare void @llvm.ppc.mtmsr(i32)
15 @ula = external local_unnamed_addr global i64, align 8
17 define dso_local zeroext i32 @test_mftbu() {
18 ; CHECK-LABEL: test_mftbu:
19 ; CHECK: # %bb.0: # %entry
21 ; CHECK-NEXT: clrldi 3, 3, 32
24 ; CHECK-32BIT-LABEL: test_mftbu:
25 ; CHECK-32BIT: # %bb.0: # %entry
26 ; CHECK-32BIT-NEXT: mftbu 3
27 ; CHECK-32BIT-NEXT: blr
29 %0 = tail call i32 @llvm.ppc.mftbu()
33 define dso_local i64 @test_mfmsr() {
34 ; CHECK-LABEL: test_mfmsr:
35 ; CHECK: # %bb.0: # %entry
37 ; CHECK-NEXT: clrldi 3, 3, 32
40 ; CHECK-32BIT-LABEL: test_mfmsr:
41 ; CHECK-32BIT: # %bb.0: # %entry
42 ; CHECK-32BIT-NEXT: mfmsr 4
43 ; CHECK-32BIT-NEXT: li 3, 0
44 ; CHECK-32BIT-NEXT: blr
46 %0 = tail call i32 @llvm.ppc.mfmsr()
47 %conv = zext i32 %0 to i64
51 define dso_local void @test_mtmsr() {
52 ; CHECK-LABEL: test_mtmsr:
56 ; CHECK-32BIT-LABEL: test_mtmsr:
57 ; CHECK-32BIT: # %bb.0: # %entry
58 ; CHECK-32BIT-NEXT: lwz 3, L..C0(2) # @ula
59 ; CHECK-32BIT-NEXT: lwz 3, 4(3)
60 ; CHECK-32BIT-NEXT: mtmsr 3, 0
61 ; CHECK-32BIT-NEXT: blr
63 %0 = load i64, ptr @ula, align 8
64 %conv = trunc i64 %0 to i32
65 call void @llvm.ppc.mtmsr(i32 %conv)