llvm-project/llvm/test/CodeGen/PowerPC/fold-rlwinm.mir

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

141 lines
3.8 KiB
Plaintext
Raw Normal View History

# 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
; CHECK-NOT: %2:gprc = RLWINM %1, 27, 5, 31
%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
; CHECK-NOT: %2:gprc = RLWINM %1, 27, 0, 31
%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
; CHECK-NOT: %2:gprc = RLWINM %1, 27, 10, 9
%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
; CHECK-NOT: %2:gprc = RLWINM %1, 27, 30, 10
%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
; CHECK: %2:gprc = RLWINM %1, 10, 5, 31
%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
; CHECK: %2:gprc = RLWINM %1, 27, 5, 10
%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
; CHECK: %2:gprc = RLWINM %1, 27, 5, 10
%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
...