[PowerPC] Reduce register pressure by not materializing a constant just for use as an index register for X-Form loads/stores.
For this example:
float test (int *arr) {
return arr[2];
}
We currently generate the following code:
li r4, 8
lxsiwax f0, r3, r4
xscvsxdsp f1, f0
With this patch, we will now generate:
addi r3, r3, 8
lxsiwax f0, 0, r3
xscvsxdsp f1, f0
Originally reported in: https://bugs.llvm.org/show_bug.cgi?id=27204
Differential Revision: https://reviews.llvm.org/D35027
llvm-svn: 307553
2017-07-11 00:44:45 +08:00
|
|
|
; RUN: llc -mcpu=pwr8 -mtriple=powerpc64le-unknown-unknown -verify-machineinstrs < %s | FileCheck %s
|
|
|
|
; RUN: llc -mcpu=pwr8 -mtriple=powerpc64-unknown-unknown -verify-machineinstrs < %s | FileCheck %s
|
|
|
|
|
|
|
|
; Function Attrs: norecurse nounwind readonly
|
|
|
|
define float @testSingleAccess(i32* nocapture readonly %arr) local_unnamed_addr #0 {
|
|
|
|
; CHECK-LABEL: testSingleAccess:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK: # %bb.0: # %entry
|
[PowerPC] Reduce register pressure by not materializing a constant just for use as an index register for X-Form loads/stores.
For this example:
float test (int *arr) {
return arr[2];
}
We currently generate the following code:
li r4, 8
lxsiwax f0, r3, r4
xscvsxdsp f1, f0
With this patch, we will now generate:
addi r3, r3, 8
lxsiwax f0, 0, r3
xscvsxdsp f1, f0
Originally reported in: https://bugs.llvm.org/show_bug.cgi?id=27204
Differential Revision: https://reviews.llvm.org/D35027
llvm-svn: 307553
2017-07-11 00:44:45 +08:00
|
|
|
; CHECK-NEXT: addi 3, 3, 8
|
2017-11-20 22:38:30 +08:00
|
|
|
; CHECK-NEXT: lfiwax 0, 0, 3
|
[PowerPC] Reduce register pressure by not materializing a constant just for use as an index register for X-Form loads/stores.
For this example:
float test (int *arr) {
return arr[2];
}
We currently generate the following code:
li r4, 8
lxsiwax f0, r3, r4
xscvsxdsp f1, f0
With this patch, we will now generate:
addi r3, r3, 8
lxsiwax f0, 0, r3
xscvsxdsp f1, f0
Originally reported in: https://bugs.llvm.org/show_bug.cgi?id=27204
Differential Revision: https://reviews.llvm.org/D35027
llvm-svn: 307553
2017-07-11 00:44:45 +08:00
|
|
|
; CHECK-NEXT: xscvsxdsp 1, 0
|
|
|
|
; CHECK-NEXT: blr
|
|
|
|
entry:
|
|
|
|
%arrayidx = getelementptr inbounds i32, i32* %arr, i64 2
|
|
|
|
%0 = load i32, i32* %arrayidx, align 4
|
|
|
|
%conv = sitofp i32 %0 to float
|
|
|
|
ret float %conv
|
|
|
|
}
|
|
|
|
|
|
|
|
; Function Attrs: norecurse nounwind readonly
|
|
|
|
define float @testMultipleAccess(i32* nocapture readonly %arr) local_unnamed_addr #0 {
|
|
|
|
; CHECK-LABEL: testMultipleAccess:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK: # %bb.0: # %entry
|
[PowerPC] Reduce register pressure by not materializing a constant just for use as an index register for X-Form loads/stores.
For this example:
float test (int *arr) {
return arr[2];
}
We currently generate the following code:
li r4, 8
lxsiwax f0, r3, r4
xscvsxdsp f1, f0
With this patch, we will now generate:
addi r3, r3, 8
lxsiwax f0, 0, r3
xscvsxdsp f1, f0
Originally reported in: https://bugs.llvm.org/show_bug.cgi?id=27204
Differential Revision: https://reviews.llvm.org/D35027
llvm-svn: 307553
2017-07-11 00:44:45 +08:00
|
|
|
; CHECK-NEXT: lwz 4, 8(3)
|
2018-07-05 02:54:25 +08:00
|
|
|
; CHECK-NEXT: lwz 3, 12(3)
|
|
|
|
; CHECK-NEXT: add 3, 3, 4
|
[PowerPC] Reduce register pressure by not materializing a constant just for use as an index register for X-Form loads/stores.
For this example:
float test (int *arr) {
return arr[2];
}
We currently generate the following code:
li r4, 8
lxsiwax f0, r3, r4
xscvsxdsp f1, f0
With this patch, we will now generate:
addi r3, r3, 8
lxsiwax f0, 0, r3
xscvsxdsp f1, f0
Originally reported in: https://bugs.llvm.org/show_bug.cgi?id=27204
Differential Revision: https://reviews.llvm.org/D35027
llvm-svn: 307553
2017-07-11 00:44:45 +08:00
|
|
|
; CHECK-NEXT: mtvsrwa 0, 3
|
|
|
|
; CHECK-NEXT: xscvsxdsp 1, 0
|
|
|
|
; CHECK-NEXT: blr
|
|
|
|
entry:
|
|
|
|
%arrayidx = getelementptr inbounds i32, i32* %arr, i64 2
|
|
|
|
%0 = load i32, i32* %arrayidx, align 4
|
|
|
|
%arrayidx1 = getelementptr inbounds i32, i32* %arr, i64 3
|
|
|
|
%1 = load i32, i32* %arrayidx1, align 4
|
|
|
|
%add = add nsw i32 %1, %0
|
|
|
|
%conv = sitofp i32 %add to float
|
|
|
|
ret float %conv
|
|
|
|
}
|