[llvm] 0749b01 - [PowerPC] modify the frameaddress case, NFC

Chen Zheng via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 7 02:17:34 PDT 2024


Author: Chen Zheng
Date: 2024-06-07T05:15:41-04:00
New Revision: 0749b01c81b7397f674cfe3726e13aa9dfb702ea

URL: https://github.com/llvm/llvm-project/commit/0749b01c81b7397f674cfe3726e13aa9dfb702ea
DIFF: https://github.com/llvm/llvm-project/commit/0749b01c81b7397f674cfe3726e13aa9dfb702ea.diff

LOG: [PowerPC] modify the frameaddress case, NFC

Added: 
    

Modified: 
    llvm/test/CodeGen/PowerPC/frameaddr.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/CodeGen/PowerPC/frameaddr.ll b/llvm/test/CodeGen/PowerPC/frameaddr.ll
index 74263393442c8..ade38ea457a39 100644
--- a/llvm/test/CodeGen/PowerPC/frameaddr.ll
+++ b/llvm/test/CodeGen/PowerPC/frameaddr.ll
@@ -1,38 +1,217 @@
-; RUN: llc -verify-machineinstrs < %s -mcpu=pwr7 | FileCheck %s
-target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f128:128:128-v128:128:128-n32:64"
-target triple = "powerpc64-unknown-linux-gnu"
-
-declare void @llvm.eh.sjlj.longjmp(ptr) #1
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
+; RUN: llc -mtriple=powerpc-ibm-aix-xcoff -verify-machineinstrs < %s -mcpu=pwr7 | FileCheck %s --check-prefix=AIX32
+; RUN: llc -mtriple=powerpc64-ibm-aix-xcoff -verify-machineinstrs < %s -mcpu=pwr7 | FileCheck %s --check-prefix=AIX64
+; RUN: llc -mtriple=powerpc64le-unknown-linux-gnu -verify-machineinstrs < %s -mcpu=pwr7 | FileCheck %s --check-prefix=LE
 
 define ptr @main() #0 {
+; AIX32-LABEL: main:
+; AIX32:       # %bb.0: # %entry
+; AIX32-NEXT:    mr 3, 1
+; AIX32-NEXT:    blr
+;
+; AIX64-LABEL: main:
+; AIX64:       # %bb.0: # %entry
+; AIX64-NEXT:    mr 3, 1
+; AIX64-NEXT:    blr
+;
+; LE-LABEL: main:
+; LE:       # %bb.0: # %entry
+; LE-NEXT:    mr 3, 1
+; LE-NEXT:    blr
 entry:
   %0 = call ptr @llvm.frameaddress(i32 0)
   ret ptr %0
+}
 
-; CHECK: @main
-; CHECK: mr 3, 1
+define ptr @foo_naked() #3 { ; naked
+; AIX32-LABEL: foo_naked:
+; AIX32:       # %bb.0: # %entry
+; AIX32-NEXT:    lwz 3, 0(1)
+; AIX32-NEXT:    blr
+;
+; AIX64-LABEL: foo_naked:
+; AIX64:       # %bb.0: # %entry
+; AIX64-NEXT:    ld 3, 0(1)
+; AIX64-NEXT:    blr
+;
+; LE-LABEL: foo_naked:
+; LE:       # %bb.0: # %entry
+; LE-NEXT:    ld 3, 0(1)
+; LE-NEXT:    blr
+entry:
+  %0 = call ptr @llvm.frameaddress(i32 1)
+  ret ptr %0
 }
 
-define ptr @foo() #3 { ; naked
+define ptr @foo1() #0 {
+; AIX32-LABEL: foo1:
+; AIX32:       # %bb.0: # %entry
+; AIX32-NEXT:    lwz 3, 0(1)
+; AIX32-NEXT:    blr
+;
+; AIX64-LABEL: foo1:
+; AIX64:       # %bb.0: # %entry
+; AIX64-NEXT:    ld 3, 0(1)
+; AIX64-NEXT:    blr
+;
+; LE-LABEL: foo1:
+; LE:       # %bb.0: # %entry
+; LE-NEXT:    ld 3, 0(1)
+; LE-NEXT:    blr
 entry:
-  %0 = call ptr @llvm.frameaddress(i32 0)
+  %0 = call ptr @llvm.frameaddress(i32 1)
   ret ptr %0
+}
 
-; CHECK: @foo
-; CHECK: mr 3, 1
+define ptr @foo2() #0 {
+; AIX32-LABEL: foo2:
+; AIX32:       # %bb.0: # %entry
+; AIX32-NEXT:    lwz 3, 0(1)
+; AIX32-NEXT:    lwz 3, 0(3)
+; AIX32-NEXT:    blr
+;
+; AIX64-LABEL: foo2:
+; AIX64:       # %bb.0: # %entry
+; AIX64-NEXT:    ld 3, 0(1)
+; AIX64-NEXT:    ld 3, 0(3)
+; AIX64-NEXT:    blr
+;
+; LE-LABEL: foo2:
+; LE:       # %bb.0: # %entry
+; LE-NEXT:    ld 3, 0(1)
+; LE-NEXT:    ld 3, 0(3)
+; LE-NEXT:    blr
+entry:
+  %0 = call ptr @llvm.frameaddress(i32 2)
+  ret ptr %0
 }
 
-define ptr @bar() #0 {
+define ptr @bar0() #0 {
+; AIX32-LABEL: bar0:
+; AIX32:       # %bb.0: # %entry
+; AIX32-NEXT:    mflr 0
+; AIX32-NEXT:    stw 31, -4(1)
+; AIX32-NEXT:    stw 0, 8(1)
+; AIX32-NEXT:    lis 0, -2
+; AIX32-NEXT:    ori 0, 0, 31008
+; AIX32-NEXT:    stwux 1, 1, 0
+; AIX32-NEXT:    mr 31, 1
+; AIX32-NEXT:    addi 3, 31, 60
+; AIX32-NEXT:    bl .use[PR]
+; AIX32-NEXT:    nop
+; AIX32-NEXT:    mr 3, 31
+; AIX32-NEXT:    lwz 1, 0(1)
+; AIX32-NEXT:    lwz 0, 8(1)
+; AIX32-NEXT:    lwz 31, -4(1)
+; AIX32-NEXT:    mtlr 0
+; AIX32-NEXT:    blr
+;
+; AIX64-LABEL: bar0:
+; AIX64:       # %bb.0: # %entry
+; AIX64-NEXT:    mflr 0
+; AIX64-NEXT:    std 31, -8(1)
+; AIX64-NEXT:    std 0, 16(1)
+; AIX64-NEXT:    lis 0, -2
+; AIX64-NEXT:    ori 0, 0, 30944
+; AIX64-NEXT:    stdux 1, 1, 0
+; AIX64-NEXT:    mr 31, 1
+; AIX64-NEXT:    addi 3, 31, 120
+; AIX64-NEXT:    bl .use[PR]
+; AIX64-NEXT:    nop
+; AIX64-NEXT:    mr 3, 31
+; AIX64-NEXT:    ld 1, 0(1)
+; AIX64-NEXT:    ld 0, 16(1)
+; AIX64-NEXT:    ld 31, -8(1)
+; AIX64-NEXT:    mtlr 0
+; AIX64-NEXT:    blr
+;
+; LE-LABEL: bar0:
+; LE:       # %bb.0: # %entry
+; LE-NEXT:    mflr 0
+; LE-NEXT:    std 31, -8(1)
+; LE-NEXT:    std 0, 16(1)
+; LE-NEXT:    lis 0, -2
+; LE-NEXT:    ori 0, 0, 31024
+; LE-NEXT:    stdux 1, 1, 0
+; LE-NEXT:    mr 31, 1
+; LE-NEXT:    addi 3, 31, 40
+; LE-NEXT:    bl use
+; LE-NEXT:    nop
+; LE-NEXT:    mr 3, 31
+; LE-NEXT:    ld 1, 0(1)
+; LE-NEXT:    ld 0, 16(1)
+; LE-NEXT:    ld 31, -8(1)
+; LE-NEXT:    mtlr 0
+; LE-NEXT:    blr
 entry:
   %x = alloca [100000 x i8]                       ; <ptr> [#uses=1]
   call void @use(ptr %x) nounwind
   %0 = call ptr @llvm.frameaddress(i32 0)
   ret ptr %0
+}
 
-; Note that if we start eliminating non-leaf frame pointers by default, this
-; will need to be updated.
-; CHECK: @bar
-; CHECK: mr 3, 31
+define ptr @bar1() #0 {
+; AIX32-LABEL: bar1:
+; AIX32:       # %bb.0: # %entry
+; AIX32-NEXT:    mflr 0
+; AIX32-NEXT:    stw 31, -4(1)
+; AIX32-NEXT:    stw 0, 8(1)
+; AIX32-NEXT:    lis 0, -2
+; AIX32-NEXT:    ori 0, 0, 31008
+; AIX32-NEXT:    stwux 1, 1, 0
+; AIX32-NEXT:    mr 31, 1
+; AIX32-NEXT:    addi 3, 31, 60
+; AIX32-NEXT:    bl .use[PR]
+; AIX32-NEXT:    nop
+; AIX32-NEXT:    lwz 3, 0(31)
+; AIX32-NEXT:    lwz 1, 0(1)
+; AIX32-NEXT:    lwz 0, 8(1)
+; AIX32-NEXT:    lwz 31, -4(1)
+; AIX32-NEXT:    mtlr 0
+; AIX32-NEXT:    blr
+;
+; AIX64-LABEL: bar1:
+; AIX64:       # %bb.0: # %entry
+; AIX64-NEXT:    mflr 0
+; AIX64-NEXT:    std 31, -8(1)
+; AIX64-NEXT:    std 0, 16(1)
+; AIX64-NEXT:    lis 0, -2
+; AIX64-NEXT:    ori 0, 0, 30944
+; AIX64-NEXT:    stdux 1, 1, 0
+; AIX64-NEXT:    mr 31, 1
+; AIX64-NEXT:    addi 3, 31, 120
+; AIX64-NEXT:    bl .use[PR]
+; AIX64-NEXT:    nop
+; AIX64-NEXT:    ld 3, 0(31)
+; AIX64-NEXT:    ld 1, 0(1)
+; AIX64-NEXT:    ld 0, 16(1)
+; AIX64-NEXT:    ld 31, -8(1)
+; AIX64-NEXT:    mtlr 0
+; AIX64-NEXT:    blr
+;
+; LE-LABEL: bar1:
+; LE:       # %bb.0: # %entry
+; LE-NEXT:    mflr 0
+; LE-NEXT:    std 31, -8(1)
+; LE-NEXT:    std 0, 16(1)
+; LE-NEXT:    lis 0, -2
+; LE-NEXT:    ori 0, 0, 31024
+; LE-NEXT:    stdux 1, 1, 0
+; LE-NEXT:    mr 31, 1
+; LE-NEXT:    addi 3, 31, 40
+; LE-NEXT:    bl use
+; LE-NEXT:    nop
+; LE-NEXT:    ld 3, 0(31)
+; LE-NEXT:    ld 1, 0(1)
+; LE-NEXT:    ld 0, 16(1)
+; LE-NEXT:    ld 31, -8(1)
+; LE-NEXT:    mtlr 0
+; LE-NEXT:    blr
+entry:
+  %x = alloca [100000 x i8]                       ; <ptr> [#uses=1]
+  call void @use(ptr %x) nounwind
+  %0 = call ptr @llvm.frameaddress(i32 1)
+  ret ptr %0
 }
 
 declare void @use(ptr)
@@ -43,4 +222,3 @@ attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="non-lea
 attributes #1 = { noreturn nounwind }
 attributes #2 = { nounwind readnone }
 attributes #3 = { nounwind naked "less-precise-fpmad"="false" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
-


        


More information about the llvm-commits mailing list