[PowerPC] folding rlwinm + rlwinm to rlwinm
For example:
x3 = rlwinm x3, 27, 5, 31
x3 = rlwinm x3, 19, 0, 12
can be combined to
x3 = rlwinm x3, 14, 0, 12
Reviewed by: steven.zhang, lkail
Differential Revision: https://reviews.llvm.org/D70374
2019-12-04 10:48:12 +08:00
|
|
|
# RUN: llc -ppc-asm-full-reg-names -mtriple=powerpc64le-unknown-linux-gnu \
|
|
|
|
# RUN: -run-pass ppc-mi-peepholes %s -o - -verify-machineinstrs | FileCheck %s
|
|
|
|
|
|
|
|
---
|
|
|
|
name: testFoldRLWINM
|
|
|
|
#CHECK : name : testFoldRLWINM
|
|
|
|
tracksRegLiveness: true
|
|
|
|
body: |
|
|
|
|
bb.0.entry:
|
|
|
|
liveins: $x3
|
|
|
|
%0:g8rc = COPY $x3
|
|
|
|
%1:gprc = COPY %0.sub_32:g8rc
|
|
|
|
%2:gprc = RLWINM %1:gprc, 27, 5, 31
|
2019-12-23 23:26:41 +08:00
|
|
|
; CHECK-NOT: %2:gprc = RLWINM %1, 27, 5, 31
|
[PowerPC] folding rlwinm + rlwinm to rlwinm
For example:
x3 = rlwinm x3, 27, 5, 31
x3 = rlwinm x3, 19, 0, 12
can be combined to
x3 = rlwinm x3, 14, 0, 12
Reviewed by: steven.zhang, lkail
Differential Revision: https://reviews.llvm.org/D70374
2019-12-04 10:48:12 +08:00
|
|
|
%3:gprc = RLWINM %2:gprc, 19, 0, 12
|
|
|
|
; CHECK: %3:gprc = RLWINM %1, 14, 0, 12
|
|
|
|
BLR8 implicit $lr8, implicit $rm
|
|
|
|
...
|
|
|
|
---
|
|
|
|
name: testFoldRLWINMSrcFullMask1
|
|
|
|
#CHECK : name : testFoldRLWINMSrcFullMask1
|
|
|
|
tracksRegLiveness: true
|
|
|
|
body: |
|
|
|
|
bb.0.entry:
|
|
|
|
liveins: $x3
|
|
|
|
%0:g8rc = COPY $x3
|
|
|
|
%1:gprc = COPY %0.sub_32:g8rc
|
|
|
|
%2:gprc = RLWINM %1:gprc, 27, 0, 31
|
2019-12-23 23:26:41 +08:00
|
|
|
; CHECK-NOT: %2:gprc = RLWINM %1, 27, 0, 31
|
[PowerPC] folding rlwinm + rlwinm to rlwinm
For example:
x3 = rlwinm x3, 27, 5, 31
x3 = rlwinm x3, 19, 0, 12
can be combined to
x3 = rlwinm x3, 14, 0, 12
Reviewed by: steven.zhang, lkail
Differential Revision: https://reviews.llvm.org/D70374
2019-12-04 10:48:12 +08:00
|
|
|
%3:gprc = RLWINM %2:gprc, 19, 0, 12
|
|
|
|
; CHECK: %3:gprc = RLWINM %1, 14, 0, 12
|
|
|
|
BLR8 implicit $lr8, implicit $rm
|
|
|
|
...
|
|
|
|
---
|
|
|
|
name: testFoldRLWINMSrcFullMask2
|
|
|
|
#CHECK : name : testFoldRLWINMSrcFullMask2
|
|
|
|
tracksRegLiveness: true
|
|
|
|
body: |
|
|
|
|
bb.0.entry:
|
|
|
|
liveins: $x3
|
|
|
|
%0:g8rc = COPY $x3
|
|
|
|
%1:gprc = COPY %0.sub_32:g8rc
|
|
|
|
%2:gprc = RLWINM %1:gprc, 27, 10, 9
|
2019-12-23 23:26:41 +08:00
|
|
|
; CHECK-NOT: %2:gprc = RLWINM %1, 27, 10, 9
|
[PowerPC] folding rlwinm + rlwinm to rlwinm
For example:
x3 = rlwinm x3, 27, 5, 31
x3 = rlwinm x3, 19, 0, 12
can be combined to
x3 = rlwinm x3, 14, 0, 12
Reviewed by: steven.zhang, lkail
Differential Revision: https://reviews.llvm.org/D70374
2019-12-04 10:48:12 +08:00
|
|
|
%3:gprc = RLWINM %2:gprc, 19, 10, 1
|
|
|
|
; CHECK: %3:gprc = RLWINM %1, 14, 10, 1
|
|
|
|
BLR8 implicit $lr8, implicit $rm
|
|
|
|
...
|
|
|
|
---
|
|
|
|
name: testFoldRLWINMSrcWrapped
|
|
|
|
#CHECK : name : testFoldRLWINMSrcWrapped
|
|
|
|
tracksRegLiveness: true
|
|
|
|
body: |
|
|
|
|
bb.0.entry:
|
|
|
|
liveins: $x3
|
|
|
|
%0:g8rc = COPY $x3
|
|
|
|
%1:gprc = COPY %0.sub_32:g8rc
|
|
|
|
%2:gprc = RLWINM %1:gprc, 27, 30, 10
|
2019-12-23 23:26:41 +08:00
|
|
|
; CHECK-NOT: %2:gprc = RLWINM %1, 27, 30, 10
|
[PowerPC] folding rlwinm + rlwinm to rlwinm
For example:
x3 = rlwinm x3, 27, 5, 31
x3 = rlwinm x3, 19, 0, 12
can be combined to
x3 = rlwinm x3, 14, 0, 12
Reviewed by: steven.zhang, lkail
Differential Revision: https://reviews.llvm.org/D70374
2019-12-04 10:48:12 +08:00
|
|
|
%3:gprc = RLWINM %2:gprc, 19, 0, 12
|
|
|
|
; CHECK: %3:gprc = RLWINM %1, 14, 11, 12
|
|
|
|
BLR8 implicit $lr8, implicit $rm
|
|
|
|
...
|
|
|
|
---
|
|
|
|
name: testFoldRLWINMUserWrapped
|
|
|
|
#CHECK : name : testFoldRLWINMUserWrapped
|
|
|
|
tracksRegLiveness: true
|
|
|
|
body: |
|
|
|
|
bb.0.entry:
|
|
|
|
liveins: $x3
|
|
|
|
%0:g8rc = COPY $x3
|
|
|
|
%1:gprc = COPY %0.sub_32:g8rc
|
|
|
|
%2:gprc = RLWINM %1:gprc, 10, 5, 31
|
2019-12-23 23:26:41 +08:00
|
|
|
; CHECK: %2:gprc = RLWINM %1, 10, 5, 31
|
[PowerPC] folding rlwinm + rlwinm to rlwinm
For example:
x3 = rlwinm x3, 27, 5, 31
x3 = rlwinm x3, 19, 0, 12
can be combined to
x3 = rlwinm x3, 14, 0, 12
Reviewed by: steven.zhang, lkail
Differential Revision: https://reviews.llvm.org/D70374
2019-12-04 10:48:12 +08:00
|
|
|
%3:gprc = RLWINM %2:gprc, 10, 30, 5
|
|
|
|
; CHECK: %3:gprc = RLWINM %2, 10, 30, 5
|
|
|
|
BLR8 implicit $lr8, implicit $rm
|
|
|
|
...
|
|
|
|
---
|
|
|
|
name: testFoldRLWINMMultipleUses
|
|
|
|
#CHECK : name : testFoldRLWINMMultipleUses
|
|
|
|
tracksRegLiveness: true
|
|
|
|
body: |
|
|
|
|
bb.0.entry:
|
|
|
|
liveins: $x3
|
|
|
|
%0:g8rc = COPY $x3
|
|
|
|
%1:gprc = COPY %0.sub_32:g8rc
|
|
|
|
%2:gprc = RLWINM killed %1:gprc, 27, 5, 31
|
|
|
|
; CHECK: %2:gprc = RLWINM %1, 27, 5, 31
|
|
|
|
%3:gprc = RLWINM %2:gprc, 19, 0, 12
|
|
|
|
; CHECK: %3:gprc = RLWINM killed %1, 14, 0, 12
|
|
|
|
STW %3:gprc, %2:gprc, 100
|
|
|
|
; CHECK: STW %3, %2, 100
|
|
|
|
BLR8 implicit $lr8, implicit $rm
|
|
|
|
...
|
|
|
|
---
|
|
|
|
name: testFoldRLWINMToZero
|
|
|
|
#CHECK : name : testFoldRLWINMToZero
|
|
|
|
tracksRegLiveness: true
|
|
|
|
body: |
|
|
|
|
bb.0.entry:
|
|
|
|
liveins: $x3
|
|
|
|
%0:g8rc = COPY $x3
|
|
|
|
%1:gprc = COPY %0.sub_32:g8rc
|
|
|
|
%2:gprc = RLWINM %1:gprc, 27, 5, 10
|
2019-12-23 23:26:41 +08:00
|
|
|
; CHECK: %2:gprc = RLWINM %1, 27, 5, 10
|
[PowerPC] folding rlwinm + rlwinm to rlwinm
For example:
x3 = rlwinm x3, 27, 5, 31
x3 = rlwinm x3, 19, 0, 12
can be combined to
x3 = rlwinm x3, 14, 0, 12
Reviewed by: steven.zhang, lkail
Differential Revision: https://reviews.llvm.org/D70374
2019-12-04 10:48:12 +08:00
|
|
|
%3:gprc = RLWINM %2:gprc, 8, 5, 10
|
|
|
|
; CHECK: %3:gprc = LI 0
|
|
|
|
BLR8 implicit $lr8, implicit $rm
|
|
|
|
...
|
|
|
|
---
|
|
|
|
name: testFoldRLWINMoToZero
|
|
|
|
#CHECK : name : testFoldRLWINMoToZero
|
|
|
|
tracksRegLiveness: true
|
|
|
|
body: |
|
|
|
|
bb.0.entry:
|
|
|
|
liveins: $x3
|
|
|
|
%0:g8rc = COPY $x3
|
|
|
|
%1:gprc = COPY %0.sub_32:g8rc
|
|
|
|
%2:gprc = RLWINM %1:gprc, 27, 5, 10
|
2019-12-23 23:26:41 +08:00
|
|
|
; CHECK: %2:gprc = RLWINM %1, 27, 5, 10
|
[PowerPC] folding rlwinm + rlwinm to rlwinm
For example:
x3 = rlwinm x3, 27, 5, 31
x3 = rlwinm x3, 19, 0, 12
can be combined to
x3 = rlwinm x3, 14, 0, 12
Reviewed by: steven.zhang, lkail
Differential Revision: https://reviews.llvm.org/D70374
2019-12-04 10:48:12 +08:00
|
|
|
%3:gprc = RLWINMo %2:gprc, 8, 5, 10, implicit-def $cr0
|
|
|
|
; CHECK: %3:gprc = ANDIo %2, 0, implicit-def $cr0
|
|
|
|
BLR8 implicit $lr8, implicit $rm
|
|
|
|
...
|
|
|
|
---
|
|
|
|
name: testFoldRLWINMInvalidMask
|
|
|
|
#CHECK : name : testFoldRLWINMInvalidMask
|
|
|
|
tracksRegLiveness: true
|
|
|
|
body: |
|
|
|
|
bb.0.entry:
|
|
|
|
liveins: $x3
|
|
|
|
%0:g8rc = COPY $x3
|
|
|
|
%1:gprc = COPY %0.sub_32:g8rc
|
|
|
|
%2:gprc = RLWINM %1:gprc, 20, 5, 31
|
|
|
|
; CHECK: %2:gprc = RLWINM %1, 20, 5, 31
|
|
|
|
%3:gprc = RLWINM %2:gprc, 19, 10, 20
|
|
|
|
; CHECK: %3:gprc = RLWINM %2, 19, 10, 20
|
|
|
|
BLR8 implicit $lr8, implicit $rm
|
|
|
|
...
|