[PATCH] D93676: [UpdateTestChecks] Fix PowerPC RE to support AIX assembly

Qiu Chaofan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 22 01:38:35 PST 2020


qiucf created this revision.
qiucf added reviewers: PowerPC, nemanjai, jsji, jasonliu, DiggerLin, MaskRay.
Herald added subscribers: steven.zhang, shchenz, kristof.beyls, arichardson.
qiucf requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Current `update_llc_test_checks.py` cannot generate checks for AIX (`powerpc64-ibm-aix-xcoff`) properly. Assembly generated is little bit different from Linux:

AIX:

  	.align	2                               # -- Begin function powf_f32_fast025
  L..CPI0_0:
  	.vbyte	4, 0x3e800000                   # float 0.25
  	.csect .text[PR],2
  	.globl	powf_f32_fast025[DS]
  	.globl	.powf_f32_fast025
  	.align	2
  	.csect powf_f32_fast025[DS],3
  	.vbyte	8, .powf_f32_fast025            # @powf_f32_fast025
  	.vbyte	8, TOC[TC0]
  	.vbyte	8, 0
  	.csect .text[PR],2
  .powf_f32_fast025:
  # %bb.0:                                # %entry
  	mflr 0
  	std 0, 16(1)
  	stdu 1, -112(1)
  	ld 3, L..C0(2)
  	lfs 2, 0(3)
  	bl .powf[PR]
  	nop
  	addi 1, 1, 112
  	ld 0, 16(1)
  	mtlr 0
  	blr
  L..powf_f32_fast0250:
  	.vbyte	4, 0x00000000                   # Traceback table begin
  	.byte	0x00                            # Version = 0
  	.byte	0x09                            # Language = CPlusPlus
  	.byte	0x22                            # -IsGlobaLinkage, -IsOutOfLineEpilogOrPrologue
                                          # +HasTraceBackTableOffset, -IsInternalProcedure
                                          # -HasControlledStorage, -IsTOCless
                                          # +IsFloatingPointPresent
                                          # -IsFloatingPointOperationLogOrAbortEnabled
  	.byte	0x41                            # -IsInterruptHandler, +IsFunctionNamePresent, -IsAllocaUsed
                                          # OnConditionDirective = 0, -IsCRSaved, +IsLRSaved
  	.byte	0x80                            # +IsBackChainStored, -IsFixup, NumOfFPRsSaved = 0
  	.byte	0x00                            # -HasVectorInfo, -HasExtensionTable, NumOfGPRsSaved = 0
  	.byte	0x00                            # NumberOfFixedParms = 0
  	.byte	0x03                            # NumberOfFPParms = 1, +HasParmsOnStack
  	.vbyte	4, 0x80000000                   # Parameter type = f
  	.vbyte	4, L..powf_f32_fast0250-.powf_f32_fast025 # Function size
  	.vbyte	2, 0x0010                       # Function name len = 16
  	.byte	'p,'o,'w,'f,'_,'f,'3,'2,'_,'f,'a,'s,'t,'0,'2,'5 # Function Name
                                          # -- End function

Linux:

  	.p2align	2                               # -- Begin function powf_f32_fast025
  .LCPI0_0:
  	.long	0x3e800000                      # float 0.25
  	.text
  	.globl	powf_f32_fast025
  	.p2align	2
  	.type	powf_f32_fast025, at function
  	.section	.opd,"aw", at progbits
  powf_f32_fast025:                       # @powf_f32_fast025
  	.p2align	3
  	.quad	.Lfunc_begin0
  	.quad	.TOC. at tocbase
  	.quad	0
  	.text
  .Lfunc_begin0:
  	.cfi_startproc
  # %bb.0:                                # %entry
  	mflr 0
  	std 0, 16(1)
  	stdu 1, -112(1)
  	.cfi_def_cfa_offset 112
  	.cfi_offset lr, 16
  	addis 3, 2, .LCPI0_0 at toc@ha
  	lfs 2, .LCPI0_0 at toc@l(3)
  	bl powf
  	nop
  	addi 1, 1, 112
  	ld 0, 16(1)
  	mtlr 0
  	blr
  	.long	0
  	.quad	0
  .Lfunc_end0:
  	.size	powf_f32_fast025, .Lfunc_end0-.Lfunc_begin0
  	.cfi_endproc
                                          # -- End function

This patch will fix that.


https://reviews.llvm.org/D93676

Files:
  llvm/utils/UpdateTestChecks/asm.py


Index: llvm/utils/UpdateTestChecks/asm.py
===================================================================
--- llvm/utils/UpdateTestChecks/asm.py
+++ llvm/utils/UpdateTestChecks/asm.py
@@ -66,15 +66,14 @@
     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(


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93676.313262.patch
Type: text/x-patch
Size: 917 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201222/b92aa8d7/attachment.bin>


More information about the llvm-commits mailing list