1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 02:33:06 +01:00

[UpdateTestChecks] Fix PowerPC RE to support AIX assembly

Current update_llc_test_checks.py cannot generate checks for AIX
(powerpc64-ibm-aix-xcoff) properly. Assembly generated is little bit
different from Linux. So I use begin function comment here to capture
function name.

Reviewed By: MaskRay, steven.zhang

Differential Revision: https://reviews.llvm.org/D93676
This commit is contained in:
Qiu Chaofan 2021-01-05 10:21:31 +08:00
parent 374f323c4e
commit c6098f661f
5 changed files with 150 additions and 22 deletions

View File

@ -1,3 +1,4 @@
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff < %s | \
; RUN: FileCheck --check-prefix=32BIT %s
@ -5,25 +6,32 @@
; RUN: FileCheck --check-prefix=64BIT %s
define void @bar() {
; 32BIT-LABEL: bar:
; 32BIT: # %bb.0: # %entry
; 32BIT-NEXT: mflr 0
; 32BIT-NEXT: stw 0, 8(1)
; 32BIT-NEXT: stwu 1, -64(1)
; 32BIT-NEXT: bl .foo[PR]
; 32BIT-NEXT: nop
; 32BIT-NEXT: addi 1, 1, 64
; 32BIT-NEXT: lwz 0, 8(1)
; 32BIT-NEXT: mtlr 0
; 32BIT-NEXT: blr
;
; 64BIT-LABEL: bar:
; 64BIT: # %bb.0: # %entry
; 64BIT-NEXT: mflr 0
; 64BIT-NEXT: std 0, 16(1)
; 64BIT-NEXT: stdu 1, -112(1)
; 64BIT-NEXT: bl .foo[PR]
; 64BIT-NEXT: nop
; 64BIT-NEXT: addi 1, 1, 112
; 64BIT-NEXT: ld 0, 16(1)
; 64BIT-NEXT: mtlr 0
; 64BIT-NEXT: blr
entry:
; 32BIT: mflr 0
; 32BIT: stw 0, 8(1)
; 32BIT: stwu 1, -64(1)
; 32BIT: bl .foo
; 32BIT: nop
; 32BIT: addi 1, 1, 64
; 32BIT: lwz 0, 8(1)
; 32BIT: mtlr 0
; 64BIT: mflr 0
; 64BIT: std 0, 16(1)
; 64BIT: stdu 1, -112(1)
; 64BIT: bl .foo
; 64BIT: nop
; 64BIT: addi 1, 1, 112
; 64BIT: ld 0, 16(1)
; 64BIT: mtlr 0
call void bitcast (void (...)* @foo to void ()*)()
ret void

View File

@ -1,4 +1,5 @@
; RUN: llc -enable-machine-outliner -mtriple=ppc32-unknown-linux < %s | FileCheck %s
; RUN: llc -enable-machine-outliner -mtriple=powerpc-ibm-aix-xcoff < %s | FileCheck %s -check-prefix=AIX
;
; NOTE: Machine outliner doesn't run.
@x = global i32 0, align 4

View File

@ -1,5 +1,6 @@
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --include-generated-funcs
; RUN: llc -enable-machine-outliner -mtriple=ppc32-unknown-linux < %s | FileCheck %s
; RUN: llc -enable-machine-outliner -mtriple=powerpc-ibm-aix-xcoff < %s | FileCheck %s -check-prefix=AIX
; NOTE: Machine outliner doesn't run.
@x = global i32 0, align 4
@ -127,3 +128,62 @@ attributes #0 = { noredzone nounwind ssp uwtable "frame-pointer"="all" }
; CHECK-NEXT: lwz 31, 28(1)
; CHECK-NEXT: addi 1, 1, 32
; CHECK-NEXT: blr
;
; AIX-LABEL: check_boundaries:
; AIX: # %bb.0:
; AIX-NEXT: stw 31, -4(1)
; AIX-NEXT: stwu 1, -48(1)
; AIX-NEXT: mr 31, 1
; AIX-NEXT: li 4, 0
; AIX-NEXT: li 3, 1
; AIX-NEXT: stw 4, 40(31)
; AIX-NEXT: li 4, 2
; AIX-NEXT: li 5, 3
; AIX-NEXT: li 6, 4
; AIX-NEXT: cmplwi 3, 0
; AIX-NEXT: stw 3, 36(31)
; AIX-NEXT: stw 4, 32(31)
; AIX-NEXT: stw 5, 28(31)
; AIX-NEXT: stw 6, 24(31)
; AIX-NEXT: beq 0, L..BB0_2
; AIX-NEXT: # %bb.1:
; AIX-NEXT: stw 3, 28(31)
; AIX-NEXT: b L..BB0_3
; AIX-NEXT: L..BB0_2:
; AIX-NEXT: stw 3, 36(31)
; AIX-NEXT: stw 4, 32(31)
; AIX-NEXT: stw 5, 28(31)
; AIX-NEXT: stw 6, 24(31)
; AIX-NEXT: L..BB0_3:
; AIX-NEXT: li 3, 0
; AIX-NEXT: addi 1, 1, 48
; AIX-NEXT: lwz 31, -4(1)
; AIX-NEXT: blr
;
; AIX-LABEL: main:
; AIX: # %bb.0:
; AIX-NEXT: stw 31, -4(1)
; AIX-NEXT: stwu 1, -48(1)
; AIX-NEXT: lwz 4, L..C0(2)
; AIX-NEXT: mr 31, 1
; AIX-NEXT: li 3, 0
; AIX-NEXT: stw 3, 40(31)
; AIX-NEXT: li 3, 1
; AIX-NEXT: li 5, 2
; AIX-NEXT: li 6, 3
; AIX-NEXT: li 7, 4
; AIX-NEXT: stw 3, 36(31)
; AIX-NEXT: stw 5, 32(31)
; AIX-NEXT: stw 6, 28(31)
; AIX-NEXT: stw 7, 24(31)
; AIX-NEXT: stw 3, 0(4)
; AIX-NEXT: #APP
; AIX-NEXT: #NO_APP
; AIX-NEXT: stw 3, 36(31)
; AIX-NEXT: li 3, 0
; AIX-NEXT: stw 5, 32(31)
; AIX-NEXT: stw 6, 28(31)
; AIX-NEXT: stw 7, 24(31)
; AIX-NEXT: addi 1, 1, 48
; AIX-NEXT: lwz 31, -4(1)
; AIX-NEXT: blr

View File

@ -1,5 +1,6 @@
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -enable-machine-outliner -mtriple=ppc32-unknown-linux < %s | FileCheck %s
; RUN: llc -enable-machine-outliner -mtriple=powerpc-ibm-aix-xcoff < %s | FileCheck %s -check-prefix=AIX
;
; NOTE: Machine outliner doesn't run.
@x = global i32 0, align 4
@ -38,6 +39,37 @@ define dso_local i32 @check_boundaries() #0 {
; CHECK-NEXT: lwz 31, 28(1)
; CHECK-NEXT: addi 1, 1, 32
; CHECK-NEXT: blr
;
; AIX-LABEL: check_boundaries:
; AIX: # %bb.0:
; AIX-NEXT: stw 31, -4(1)
; AIX-NEXT: stwu 1, -48(1)
; AIX-NEXT: mr 31, 1
; AIX-NEXT: li 4, 0
; AIX-NEXT: li 3, 1
; AIX-NEXT: stw 4, 40(31)
; AIX-NEXT: li 4, 2
; AIX-NEXT: li 5, 3
; AIX-NEXT: li 6, 4
; AIX-NEXT: cmplwi 3, 0
; AIX-NEXT: stw 3, 36(31)
; AIX-NEXT: stw 4, 32(31)
; AIX-NEXT: stw 5, 28(31)
; AIX-NEXT: stw 6, 24(31)
; AIX-NEXT: beq 0, L..BB0_2
; AIX-NEXT: # %bb.1:
; AIX-NEXT: stw 3, 28(31)
; AIX-NEXT: b L..BB0_3
; AIX-NEXT: L..BB0_2:
; AIX-NEXT: stw 3, 36(31)
; AIX-NEXT: stw 4, 32(31)
; AIX-NEXT: stw 5, 28(31)
; AIX-NEXT: stw 6, 24(31)
; AIX-NEXT: L..BB0_3:
; AIX-NEXT: li 3, 0
; AIX-NEXT: addi 1, 1, 48
; AIX-NEXT: lwz 31, -4(1)
; AIX-NEXT: blr
%1 = alloca i32, align 4
%2 = alloca i32, align 4
%3 = alloca i32, align 4
@ -105,6 +137,34 @@ define dso_local i32 @main() #0 {
; CHECK-NEXT: lwz 31, 28(1)
; CHECK-NEXT: addi 1, 1, 32
; CHECK-NEXT: blr
;
; AIX-LABEL: main:
; AIX: # %bb.0:
; AIX-NEXT: stw 31, -4(1)
; AIX-NEXT: stwu 1, -48(1)
; AIX-NEXT: lwz 4, L..C0(2)
; AIX-NEXT: mr 31, 1
; AIX-NEXT: li 3, 0
; AIX-NEXT: stw 3, 40(31)
; AIX-NEXT: li 3, 1
; AIX-NEXT: li 5, 2
; AIX-NEXT: li 6, 3
; AIX-NEXT: li 7, 4
; AIX-NEXT: stw 3, 36(31)
; AIX-NEXT: stw 5, 32(31)
; AIX-NEXT: stw 6, 28(31)
; AIX-NEXT: stw 7, 24(31)
; AIX-NEXT: stw 3, 0(4)
; AIX-NEXT: #APP
; AIX-NEXT: #NO_APP
; AIX-NEXT: stw 3, 36(31)
; AIX-NEXT: li 3, 0
; AIX-NEXT: stw 5, 32(31)
; AIX-NEXT: stw 6, 28(31)
; AIX-NEXT: stw 7, 24(31)
; AIX-NEXT: addi 1, 1, 48
; AIX-NEXT: lwz 31, -4(1)
; AIX-NEXT: blr
%1 = alloca i32, align 4
%2 = alloca i32, align 4
%3 = alloca i32, align 4

View File

@ -68,15 +68,14 @@ ASM_FUNCTION_MSP430_RE = re.compile(
flags=(re.M | re.S))
ASM_FUNCTION_PPC_RE = re.compile(
r'^_?(?P<func>[^:]+):[ \t]*#+[ \t]*@"?(?P=func)"?\n'
r'#[ \-\t]*Begin function (?P<func>[^.:]+)\n'
r'.*?'
r'\.Lfunc_begin[0-9]+:\n'
r'(?:[ \t]+.cfi_startproc\n)?'
r'(?:\.Lfunc_[gl]ep[0-9]+:\n(?:[ \t]+.*?\n)*)*'
r'^[_.]?(?P=func):(?:[ \t]*#+[ \t]*@"?(?P=func)"?)?\n'
r'(?:^[^#]*\n)*'
r'(?P<body>.*?)\n'
# This list is incomplete
r'(?:^[ \t]*(?:\.long[ \t]+[^\n]+|\.quad[ \t]+[^\n]+)\n)*'
r'.Lfunc_end[0-9]+:\n',
r'(?:^[ \t]*(?:\.(?:long|quad|v?byte)[ \t]+[^\n]+)\n)*'
r'(?:\.Lfunc_end|L\.\.(?P=func))[0-9]+:\n',
flags=(re.M | re.S))
ASM_FUNCTION_RISCV_RE = re.compile(