
mflr is kind of expensive on Power version smaller than 10, so we should schedule the store for the mflr's def away from mflr. In epilogue, the expensive mtlr has no user for its def, so it doesn't matter that the load and the mtlr are back-to-back. Reviewed By: RolandF Differential Revision: https://reviews.llvm.org/D137423
82 lines
2.0 KiB
LLVM
82 lines
2.0 KiB
LLVM
; RUN: llc -mtriple=powerpc64-unknown-aix-xcoff -mcpu=pwr4 --mattr=-altivec \
|
|
; RUN: --verify-machineinstrs < %s | FileCheck --check-prefix=64BIT %s
|
|
|
|
; RUN: llc -mtriple=powerpc-unknown-aix-xcoff -mcpu=pwr4 --mattr=-altivec \
|
|
; RUN: --verify-machineinstrs < %s | FileCheck --check-prefix=32BIT %s
|
|
|
|
define dso_local signext i32 @killOne(i32 signext %i) {
|
|
entry:
|
|
tail call void asm sideeffect "# Clobber CR", "~{cr4}"()
|
|
%call = call signext i32 @do_something(i32 %i)
|
|
ret i32 %call
|
|
}
|
|
|
|
define dso_local signext i32 @killAll(i32 signext %i) {
|
|
entry:
|
|
tail call void asm sideeffect "# Clobber CR", "~{cr0},~{cr1},~{cr2},~{cr3},~{cr4},~{cr5},~{cr6},~{cr7}" ()
|
|
%call = call signext i32 @do_something(i32 %i)
|
|
ret i32 %call
|
|
}
|
|
|
|
declare signext i32 @do_something(i32 signext)
|
|
|
|
; 64BIT-LABEL: .killOne:
|
|
|
|
; 64BIT: mfcr 12
|
|
; 64BIT-NEXT: stw 12, 8(1)
|
|
; 64BIT-NEXT: mflr 0
|
|
; 64BIT-NEXT: stdu 1, -112(1)
|
|
; 64BIT: std 0, 128(1)
|
|
|
|
; 64BIT: # Clobber CR
|
|
; 64BIT: bl .do_something
|
|
|
|
; 64BIT: addi 1, 1, 112
|
|
; 64BIT-NEXT: ld 0, 16(1)
|
|
; 64BIT-NEXT: lwz 12, 8(1)
|
|
; 64BIT-NEXT: mtlr 0
|
|
; 64BIT-NEXT: mtocrf 8, 12
|
|
; 64BIT: blr
|
|
|
|
; 32BIT-LABEL: .killOne:
|
|
|
|
; 32BIT: mfcr 12
|
|
; 32BIT-NEXT: stw 12, 4(1)
|
|
; 32BIT-NEXT: mflr 0
|
|
; 32BIT-NEXT: stwu 1, -64(1)
|
|
; 32BIT: stw 0, 72(1)
|
|
|
|
; 32BIT: # Clobber CR
|
|
; 32BIT: bl .do_something
|
|
|
|
; 32BIT: addi 1, 1, 64
|
|
; 32BIT-NEXT: lwz 0, 8(1)
|
|
; 32BIT-NEXT: lwz 12, 4(1)
|
|
; 32BIT-NEXT: mtlr 0
|
|
; 32BIT-NEXT: mtocrf 8, 12
|
|
; 32BIT: blr
|
|
|
|
|
|
; 64BIT-LABEL: .killAll:
|
|
|
|
; 64BIT: addi 1, 1, 112
|
|
; 64BIT-NEXT: ld 0, 16(1)
|
|
; 64BIT-NEXT: lwz 12, 8(1)
|
|
; 64BIT-NEXT: mtlr 0
|
|
; 64BIT-NEXT: mtocrf 32, 12
|
|
; 64BIT-NEXT: mtocrf 16, 12
|
|
; 64BIT-NEXT: mtocrf 8, 12
|
|
; 64BIT-NEXT: blr
|
|
|
|
|
|
; 32BIT-LABEL: .killAll:
|
|
|
|
; 32BIT: addi 1, 1, 64
|
|
; 32BIT-NEXT: lwz 0, 8(1)
|
|
; 32BIT-NEXT: lwz 12, 4(1)
|
|
; 32BIT-NEXT: mtlr 0
|
|
; 32BIT-NEXT: mtocrf 32, 12
|
|
; 32BIT-NEXT: mtocrf 16, 12
|
|
; 32BIT-NEXT: mtocrf 8, 12
|
|
; 32BIT-NEXT: blr
|