1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00
llvm-mirror/test/CodeGen/PowerPC/convert-ri-addi-to-ri.mir
Chen Zheng 4cc65c325c [PowerPC] fold addi's imm operand to its imm form consumer's displacement
This patch adds a function to do following transformation:

%0:g8rc_and_g8rc_nox0 = ADDI8 %5:g8rc_and_g8rc_nox0, 144
STD killed %7:g8rc, 16, %0:g8rc_and_g8rc_nox0 :: (store 8 into %ir.8)

------>

STD killed %7:g8rc, 160, %5:g8rc_and_g8rc_nox0 :: (store 8 into %ir.8)

Reviewed By: steven.zhang

Differential Revision: https://reviews.llvm.org/D81723
2020-06-23 06:28:18 -04:00

68 lines
1.9 KiB
YAML

# RUN: llc -mtriple=powerpc64le-unknown-linux-gnu -verify-machineinstrs \
# RUN: -run-pass ppc-mi-peepholes -ppc-convert-rr-to-ri %s -o - | FileCheck %s
---
name: foldNewDformStore
# CHECK: name: foldNewDformStore
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x3
%0:g8rc_and_g8rc_nox0 = COPY $x3
%1:g8rc_and_g8rc_nox0 = ADDI8 %0:g8rc_and_g8rc_nox0, 144
%2:g8rc = LI8 0
; CHECK: STD killed %2, 160, %0
STD killed %2:g8rc, 16, %1:g8rc_and_g8rc_nox0
BLR8 implicit $lr8, implicit $rm
...
---
name: foldNewDformStoreAlignNotMatch
# CHECK: name: foldNewDformStoreAlignNotMatch
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x3
%0:g8rc_and_g8rc_nox0 = COPY $x3
%1:g8rc_and_g8rc_nox0 = ADDI8 %0:g8rc_and_g8rc_nox0, 141
%2:g8rc = LI8 0
; CHECK: STD killed %2, 16, %1
STD killed %2:g8rc, 16, %1:g8rc_and_g8rc_nox0
BLR8 implicit $lr8, implicit $rm
...
---
name: foldNewDformStoreKilledFlag
# CHECK: name: foldNewDformStoreKilledFlag
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x3
%0:g8rc_and_g8rc_nox0 = COPY $x3
%1:g8rc_and_g8rc_nox0 = ADDI8 %0:g8rc_and_g8rc_nox0, 144
%2:g8rc = LI8 0
; CHECK: STD %1, 0, %0
STD %1:g8rc_and_g8rc_nox0, 0, killed %0:g8rc_and_g8rc_nox0
; CHECK: STD killed %2, 160, killed %0
STD killed %2:g8rc, 16, %1:g8rc_and_g8rc_nox0
BLR8 implicit $lr8, implicit $rm
...
---
name: foldNewDformPreferLIOperand
# CHECK: name: foldNewDformPreferLIOperand
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x3
%0:g8rc_and_g8rc_nox0 = COPY $x3
%1:g8rc = ADDI8 %0:g8rc_and_g8rc_nox0, 1
%2:g8rc = LI8 1
; CHECK: SUBFIC8 killed %1, 1, implicit-def $carry
%3:g8rc = SUBFC8 killed %1:g8rc, %2:g8rc, implicit-def $carry
%4:g8rc = SUBFE8 %2:g8rc, %2:g8rc, implicit-def dead $carry, implicit $carry
%5:g8rc = NEG8 killed %4:g8rc
$x3 = COPY %5:g8rc
BLR8 implicit $lr8, implicit $rm, implicit $x3
...