llvm-project/llvm/test/CodeGen/RISCV/xqccmp-cm-popretz.mir
Sam Elliott e49180d84c
[RISCV] Xqccmp Code Generation (#128815)
This adds support for Xqccmp to the following passes:
- Prolog Epilog Insertion - reusing much of the existing push/pop logic,
but extending it to cope with frame pointers and reorder the CFI
information correctly.
- Move Merger - extending it to support the `qc.` variants of the
double-move instructions.
- Push/Pop Optimizer - extending it to support the `qc.` variants of the
pop instructions.

The testing is based on existing Zcmp tests, but I have put them in
separate files as some of the Zcmp tests were getting quite long.
2025-03-05 10:59:45 -08:00

67 lines
3.5 KiB
YAML

# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 4
# RUN: llc -mtriple=riscv32 -mattr=+experimental-xqccmp -x mir -start-before=prologepilog -stop-after=riscv-push-pop-opt -verify-machineinstrs -o - %s \
# RUN: | FileCheck -check-prefixes=CHECK-XQCCMP32 %s
# RUN: llc -mtriple=riscv64 -mattr=+experimental-xqccmp -x mir -start-before=prologepilog -stop-after=riscv-push-pop-opt -verify-machineinstrs -o - %s \
# RUN: | FileCheck -check-prefixes=CHECK-XQCCMP64 %s
---
name: popret_rvlist5
tracksRegLiveness: true
body: |
bb.0:
; CHECK-XQCCMP32-LABEL: name: popret_rvlist5
; CHECK-XQCCMP32: liveins: $x1, $x8
; CHECK-XQCCMP32-NEXT: {{ $}}
; CHECK-XQCCMP32-NEXT: frame-setup QC_CM_PUSH 5, 0, implicit-def $x2, implicit $x2, implicit $x1, implicit $x8
; CHECK-XQCCMP32-NEXT: frame-setup CFI_INSTRUCTION def_cfa_offset 16
; CHECK-XQCCMP32-NEXT: frame-setup CFI_INSTRUCTION offset $x1, -4
; CHECK-XQCCMP32-NEXT: frame-setup CFI_INSTRUCTION offset $x8, -8
; CHECK-XQCCMP32-NEXT: $x1 = IMPLICIT_DEF
; CHECK-XQCCMP32-NEXT: $x8 = IMPLICIT_DEF
; CHECK-XQCCMP32-NEXT: frame-destroy QC_CM_POPRET 5, 0, implicit-def $x2, implicit $x2, implicit-def $x1, implicit-def $x8
;
; CHECK-XQCCMP64-LABEL: name: popret_rvlist5
; CHECK-XQCCMP64: liveins: $x1, $x8
; CHECK-XQCCMP64-NEXT: {{ $}}
; CHECK-XQCCMP64-NEXT: frame-setup QC_CM_PUSH 5, 0, implicit-def $x2, implicit $x2, implicit $x1, implicit $x8
; CHECK-XQCCMP64-NEXT: frame-setup CFI_INSTRUCTION def_cfa_offset 16
; CHECK-XQCCMP64-NEXT: frame-setup CFI_INSTRUCTION offset $x1, -8
; CHECK-XQCCMP64-NEXT: frame-setup CFI_INSTRUCTION offset $x8, -16
; CHECK-XQCCMP64-NEXT: $x1 = IMPLICIT_DEF
; CHECK-XQCCMP64-NEXT: $x8 = IMPLICIT_DEF
; CHECK-XQCCMP64-NEXT: frame-destroy QC_CM_POPRET 5, 0, implicit-def $x2, implicit $x2, implicit-def $x1, implicit-def $x8
$x1 = IMPLICIT_DEF
$x8 = IMPLICIT_DEF
PseudoRET
...
---
name: popretz_rvlist5
tracksRegLiveness: true
body: |
bb.0:
; CHECK-XQCCMP32-LABEL: name: popretz_rvlist5
; CHECK-XQCCMP32: liveins: $x1, $x8
; CHECK-XQCCMP32-NEXT: {{ $}}
; CHECK-XQCCMP32-NEXT: frame-setup QC_CM_PUSH 5, 0, implicit-def $x2, implicit $x2, implicit $x1, implicit $x8
; CHECK-XQCCMP32-NEXT: frame-setup CFI_INSTRUCTION def_cfa_offset 16
; CHECK-XQCCMP32-NEXT: frame-setup CFI_INSTRUCTION offset $x1, -4
; CHECK-XQCCMP32-NEXT: frame-setup CFI_INSTRUCTION offset $x8, -8
; CHECK-XQCCMP32-NEXT: $x1 = IMPLICIT_DEF
; CHECK-XQCCMP32-NEXT: $x8 = IMPLICIT_DEF
; CHECK-XQCCMP32-NEXT: frame-destroy QC_CM_POPRETZ 5, 0, implicit-def $x2, implicit-def $x10, implicit $x2, implicit-def $x1, implicit-def $x8
;
; CHECK-XQCCMP64-LABEL: name: popretz_rvlist5
; CHECK-XQCCMP64: liveins: $x1, $x8
; CHECK-XQCCMP64-NEXT: {{ $}}
; CHECK-XQCCMP64-NEXT: frame-setup QC_CM_PUSH 5, 0, implicit-def $x2, implicit $x2, implicit $x1, implicit $x8
; CHECK-XQCCMP64-NEXT: frame-setup CFI_INSTRUCTION def_cfa_offset 16
; CHECK-XQCCMP64-NEXT: frame-setup CFI_INSTRUCTION offset $x1, -8
; CHECK-XQCCMP64-NEXT: frame-setup CFI_INSTRUCTION offset $x8, -16
; CHECK-XQCCMP64-NEXT: $x1 = IMPLICIT_DEF
; CHECK-XQCCMP64-NEXT: $x8 = IMPLICIT_DEF
; CHECK-XQCCMP64-NEXT: frame-destroy QC_CM_POPRETZ 5, 0, implicit-def $x2, implicit-def $x10, implicit $x2, implicit-def $x1, implicit-def $x8
$x1 = IMPLICIT_DEF
$x8 = IMPLICIT_DEF
$x10 = COPY $x0
PseudoRET implicit $x10
...