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 --check-prefix=CHECK-AIX64
9 declare i64 @llvm.ppc.mfspr.i64(i32 immarg)
10 declare void @llvm.ppc.mtspr.i64(i32 immarg, i64)
12 @ula = external local_unnamed_addr global i64, align 8
14 define dso_local i64 @test_mfxer() {
15 ; CHECK-LABEL: test_mfxer:
16 ; CHECK: # %bb.0: # %entry
20 ; CHECK-AIX64-LABEL: test_mfxer:
21 ; CHECK-AIX64: # %bb.0: # %entry
22 ; CHECK-AIX64-NEXT: mfxer 3
23 ; CHECK-AIX64-NEXT: blr
25 %0 = call i64 @llvm.ppc.mfspr.i64(i32 1)
29 define dso_local i64 @test_mflr() {
30 ; CHECK-LABEL: test_mflr:
31 ; CHECK: # %bb.0: # %entry
35 ; CHECK-AIX64-LABEL: test_mflr:
36 ; CHECK-AIX64: # %bb.0: # %entry
37 ; CHECK-AIX64-NEXT: mfspr 3, 8
38 ; CHECK-AIX64-NEXT: blr
40 %0 = call i64 @llvm.ppc.mfspr.i64(i32 8)
44 define dso_local i64 @test_mfctr() {
45 ; CHECK-LABEL: test_mfctr:
46 ; CHECK: # %bb.0: # %entry
50 ; CHECK-AIX64-LABEL: test_mfctr:
51 ; CHECK-AIX64: # %bb.0: # %entry
52 ; CHECK-AIX64-NEXT: mfspr 3, 9
53 ; CHECK-AIX64-NEXT: blr
55 %0 = call i64 @llvm.ppc.mfspr.i64(i32 9)
59 define dso_local i64 @test_mfppr() {
60 ; CHECK-LABEL: test_mfppr:
61 ; CHECK: # %bb.0: # %entry
62 ; CHECK-NEXT: mfspr 3, 896
65 ; CHECK-AIX64-LABEL: test_mfppr:
66 ; CHECK-AIX64: # %bb.0: # %entry
67 ; CHECK-AIX64-NEXT: mfspr 3, 896
68 ; CHECK-AIX64-NEXT: blr
70 %0 = call i64 @llvm.ppc.mfspr.i64(i32 896)
74 define dso_local i64 @test_mfppr32() {
75 ; CHECK-LABEL: test_mfppr32:
76 ; CHECK: # %bb.0: # %entry
77 ; CHECK-NEXT: mfspr 3, 898
80 ; CHECK-AIX64-LABEL: test_mfppr32:
81 ; CHECK-AIX64: # %bb.0: # %entry
82 ; CHECK-AIX64-NEXT: mfspr 3, 898
83 ; CHECK-AIX64-NEXT: blr
85 %0 = call i64 @llvm.ppc.mfspr.i64(i32 898)
89 define dso_local void @test_mtxer() {
90 ; CHECK-LABEL: test_mtxer:
91 ; CHECK: # %bb.0: # %entry
92 ; CHECK-NEXT: addis 3, 2, .LC0@toc@ha
93 ; CHECK-NEXT: ld 3, .LC0@toc@l(3)
94 ; CHECK-NEXT: ld 3, 0(3)
98 ; CHECK-AIX64-LABEL: test_mtxer:
99 ; CHECK-AIX64: # %bb.0: # %entry
100 ; CHECK-AIX64-NEXT: ld 3, L..C0(2) # @ula
101 ; CHECK-AIX64-NEXT: ld 3, 0(3)
102 ; CHECK-AIX64-NEXT: mtxer 3
103 ; CHECK-AIX64-NEXT: blr
105 %0 = load i64, ptr @ula, align 8
106 tail call void @llvm.ppc.mtspr.i64(i32 1, i64 %0)
110 define dso_local void @test_mtlr() {
111 ; CHECK-LABEL: test_mtlr:
112 ; CHECK: # %bb.0: # %entry
113 ; CHECK-NEXT: addis 3, 2, .LC0@toc@ha
114 ; CHECK-NEXT: ld 3, .LC0@toc@l(3)
115 ; CHECK-NEXT: ld 3, 0(3)
119 ; CHECK-AIX64-LABEL: test_mtlr:
120 ; CHECK-AIX64: # %bb.0: # %entry
121 ; CHECK-AIX64-NEXT: ld 3, L..C0(2) # @ula
122 ; CHECK-AIX64-NEXT: ld 3, 0(3)
123 ; CHECK-AIX64-NEXT: mtspr 8, 3
124 ; CHECK-AIX64-NEXT: blr
126 %0 = load i64, ptr @ula, align 8
127 tail call void @llvm.ppc.mtspr.i64(i32 8, i64 %0)
131 define dso_local void @test_mtctr() {
132 ; CHECK-LABEL: test_mtctr:
133 ; CHECK: # %bb.0: # %entry
134 ; CHECK-NEXT: addis 3, 2, .LC0@toc@ha
135 ; CHECK-NEXT: ld 3, .LC0@toc@l(3)
136 ; CHECK-NEXT: ld 3, 0(3)
137 ; CHECK-NEXT: mtctr 3
140 ; CHECK-AIX64-LABEL: test_mtctr:
141 ; CHECK-AIX64: # %bb.0: # %entry
142 ; CHECK-AIX64-NEXT: ld 3, L..C0(2) # @ula
143 ; CHECK-AIX64-NEXT: ld 3, 0(3)
144 ; CHECK-AIX64-NEXT: mtspr 9, 3
145 ; CHECK-AIX64-NEXT: blr
147 %0 = load i64, ptr @ula, align 8
148 tail call void @llvm.ppc.mtspr.i64(i32 9, i64 %0)
152 define dso_local void @test_mtppr() {
153 ; CHECK-LABEL: test_mtppr:
154 ; CHECK: # %bb.0: # %entry
155 ; CHECK-NEXT: addis 3, 2, .LC0@toc@ha
156 ; CHECK-NEXT: ld 3, .LC0@toc@l(3)
157 ; CHECK-NEXT: ld 3, 0(3)
158 ; CHECK-NEXT: mtspr 896, 3
161 ; CHECK-AIX64-LABEL: test_mtppr:
162 ; CHECK-AIX64: # %bb.0: # %entry
163 ; CHECK-AIX64-NEXT: ld 3, L..C0(2) # @ula
164 ; CHECK-AIX64-NEXT: ld 3, 0(3)
165 ; CHECK-AIX64-NEXT: mtspr 896, 3
166 ; CHECK-AIX64-NEXT: blr
168 %0 = load i64, ptr @ula, align 8
169 tail call void @llvm.ppc.mtspr.i64(i32 896, i64 %0)
173 define dso_local void @test_mtppr32() {
174 ; CHECK-LABEL: test_mtppr32:
175 ; CHECK: # %bb.0: # %entry
176 ; CHECK-NEXT: addis 3, 2, .LC0@toc@ha
177 ; CHECK-NEXT: ld 3, .LC0@toc@l(3)
178 ; CHECK-NEXT: ld 3, 0(3)
179 ; CHECK-NEXT: mtspr 898, 3
182 ; CHECK-AIX64-LABEL: test_mtppr32:
183 ; CHECK-AIX64: # %bb.0: # %entry
184 ; CHECK-AIX64-NEXT: ld 3, L..C0(2) # @ula
185 ; CHECK-AIX64-NEXT: ld 3, 0(3)
186 ; CHECK-AIX64-NEXT: mtspr 898, 3
187 ; CHECK-AIX64-NEXT: blr
189 %0 = load i64, ptr @ula, align 8
190 tail call void @llvm.ppc.mtspr.i64(i32 898, i64 %0)