[llvm] [X86][CodeGen] Teach frame lowering to spill/reload registers w/ PUSHP/POPP, PUSH2[P]/POP2[P] (PR #73292)

Phoebe Wang via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 27 00:23:49 PST 2023


================
@@ -0,0 +1,217 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu | FileCheck %s --check-prefix=LIN-REF
+; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mattr=+push2pop2 | FileCheck %s --check-prefix=LIN
+; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mattr=+push2pop2,+ppx | FileCheck %s --check-prefix=LIN-PPX
+; RUN: llc < %s -mtriple=x86_64-windows-msvc | FileCheck %s --check-prefix=WIN-REF
+; RUN: llc < %s -mtriple=x86_64-windows-msvc -mattr=+push2pop2 | FileCheck %s --check-prefix=WIN
+; RUN: llc < %s -mtriple=x86_64-windows-msvc -mattr=+push2pop2,+ppx | FileCheck %s --check-prefix=WIN-PPX
+
+define i32 @csr6_alloc16(ptr %argv) {
+; LIN-REF-LABEL: csr6_alloc16:
+; LIN-REF:       # %bb.0: # %entry
+; LIN-REF-NEXT:    pushq %rbp
+; LIN-REF-NEXT:    .cfi_def_cfa_offset 16
+; LIN-REF-NEXT:    pushq %r15
+; LIN-REF-NEXT:    .cfi_def_cfa_offset 24
+; LIN-REF-NEXT:    pushq %r14
+; LIN-REF-NEXT:    .cfi_def_cfa_offset 32
+; LIN-REF-NEXT:    pushq %r13
+; LIN-REF-NEXT:    .cfi_def_cfa_offset 40
+; LIN-REF-NEXT:    pushq %r12
+; LIN-REF-NEXT:    .cfi_def_cfa_offset 48
+; LIN-REF-NEXT:    pushq %rbx
+; LIN-REF-NEXT:    .cfi_def_cfa_offset 56
+; LIN-REF-NEXT:    subq $24, %rsp
+; LIN-REF-NEXT:    .cfi_def_cfa_offset 80
+; LIN-REF-NEXT:    .cfi_offset %rbx, -56
+; LIN-REF-NEXT:    .cfi_offset %r12, -48
+; LIN-REF-NEXT:    .cfi_offset %r13, -40
+; LIN-REF-NEXT:    .cfi_offset %r14, -32
+; LIN-REF-NEXT:    .cfi_offset %r15, -24
+; LIN-REF-NEXT:    .cfi_offset %rbp, -16
+; LIN-REF-NEXT:    #APP
+; LIN-REF-NEXT:    #NO_APP
+; LIN-REF-NEXT:    xorl %ecx, %ecx
+; LIN-REF-NEXT:    xorl %eax, %eax
+; LIN-REF-NEXT:    callq *%rcx
+; LIN-REF-NEXT:    addq $24, %rsp
+; LIN-REF-NEXT:    .cfi_def_cfa_offset 56
+; LIN-REF-NEXT:    popq %rbx
+; LIN-REF-NEXT:    .cfi_def_cfa_offset 48
+; LIN-REF-NEXT:    popq %r12
+; LIN-REF-NEXT:    .cfi_def_cfa_offset 40
+; LIN-REF-NEXT:    popq %r13
+; LIN-REF-NEXT:    .cfi_def_cfa_offset 32
+; LIN-REF-NEXT:    popq %r14
+; LIN-REF-NEXT:    .cfi_def_cfa_offset 24
+; LIN-REF-NEXT:    popq %r15
+; LIN-REF-NEXT:    .cfi_def_cfa_offset 16
+; LIN-REF-NEXT:    popq %rbp
+; LIN-REF-NEXT:    .cfi_def_cfa_offset 8
+; LIN-REF-NEXT:    retq
+;
+; LIN-LABEL: csr6_alloc16:
+; LIN:       # %bb.0: # %entry
+; LIN-NEXT:    pushq %rax
----------------
phoebewang wrote:

Oh, we apply the rule3 here.

https://github.com/llvm/llvm-project/pull/73292


More information about the llvm-commits mailing list