[llvm-branch-commits] [llvm] [clang] [SPARC] Prefer RDPC over CALL to implement GETPCX for 64-bit target (PR #77196)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sun Jan 14 00:43:59 PST 2024


https://github.com/koachan updated https://github.com/llvm/llvm-project/pull/77196

>From f4830825ebea96f71fb1b9d1f1192114291b093c Mon Sep 17 00:00:00 2001
From: Koakuma <koachan at protonmail.com>
Date: Sun, 14 Jan 2024 10:35:24 +0700
Subject: [PATCH 1/2] Add nounwind to test cases

Created using spr 1.3.4
---
 llvm/test/CodeGen/SPARC/getpcx-call.ll | 14 +++-----------
 llvm/test/CodeGen/SPARC/getpcx-rdpc.ll | 14 +++-----------
 2 files changed, 6 insertions(+), 22 deletions(-)

diff --git a/llvm/test/CodeGen/SPARC/getpcx-call.ll b/llvm/test/CodeGen/SPARC/getpcx-call.ll
index 63d6649f89c4fa..0f162f1cd0bb7a 100644
--- a/llvm/test/CodeGen/SPARC/getpcx-call.ll
+++ b/llvm/test/CodeGen/SPARC/getpcx-call.ll
@@ -10,14 +10,10 @@
 
 @value = external global i32
 
-define i32 @testCall() #0 {
+define i32 @testCall() nounwind #0 {
 ; SPARC-LABEL: testCall:
-; SPARC:         .cfi_startproc
-; SPARC-NEXT:  ! %bb.0:
+; SPARC:       ! %bb.0:
 ; SPARC-NEXT:    save %sp, -96, %sp
-; SPARC-NEXT:    .cfi_def_cfa_register %fp
-; SPARC-NEXT:    .cfi_window_save
-; SPARC-NEXT:    .cfi_register %o7, %i7
 ; SPARC-NEXT:  .Ltmp0:
 ; SPARC-NEXT:    call .Ltmp1
 ; SPARC-NEXT:  .Ltmp2:
@@ -33,12 +29,8 @@ define i32 @testCall() #0 {
 ; SPARC-NEXT:    restore
 ;
 ; SPARC64-LABEL: testCall:
-; SPARC64:         .cfi_startproc
-; SPARC64-NEXT:  ! %bb.0:
+; SPARC64:       ! %bb.0:
 ; SPARC64-NEXT:    save %sp, -128, %sp
-; SPARC64-NEXT:    .cfi_def_cfa_register %fp
-; SPARC64-NEXT:    .cfi_window_save
-; SPARC64-NEXT:    .cfi_register %o7, %i7
 ; SPARC64-NEXT:  .Ltmp0:
 ; SPARC64-NEXT:    call .Ltmp1
 ; SPARC64-NEXT:  .Ltmp2:
diff --git a/llvm/test/CodeGen/SPARC/getpcx-rdpc.ll b/llvm/test/CodeGen/SPARC/getpcx-rdpc.ll
index 4596d8d6824153..cb51502f7b0690 100644
--- a/llvm/test/CodeGen/SPARC/getpcx-rdpc.ll
+++ b/llvm/test/CodeGen/SPARC/getpcx-rdpc.ll
@@ -10,14 +10,10 @@
 
 @value = external global i32
 
-define i32 @testRdpc() #0 {
+define i32 @testRdpc() nounwind #0 {
 ; SPARC-LABEL: testRdpc:
-; SPARC:         .cfi_startproc
-; SPARC-NEXT:  ! %bb.0:
+; SPARC:       ! %bb.0:
 ; SPARC-NEXT:    save %sp, -96, %sp
-; SPARC-NEXT:    .cfi_def_cfa_register %fp
-; SPARC-NEXT:    .cfi_window_save
-; SPARC-NEXT:    .cfi_register %o7, %i7
 ; SPARC-NEXT:  .Ltmp0:
 ; SPARC-NEXT:    call .Ltmp1
 ; SPARC-NEXT:  .Ltmp2:
@@ -33,12 +29,8 @@ define i32 @testRdpc() #0 {
 ; SPARC-NEXT:    restore
 ;
 ; SPARC64-LABEL: testRdpc:
-; SPARC64:         .cfi_startproc
-; SPARC64-NEXT:  ! %bb.0:
+; SPARC64:       ! %bb.0:
 ; SPARC64-NEXT:    save %sp, -128, %sp
-; SPARC64-NEXT:    .cfi_def_cfa_register %fp
-; SPARC64-NEXT:    .cfi_window_save
-; SPARC64-NEXT:    .cfi_register %o7, %i7
 ; SPARC64-NEXT:  .Ltmp0:
 ; SPARC64-NEXT:    rd %pc, %o7
 ; SPARC64-NEXT:  .Ltmp2:

>From 811e1de1b5eb9013434690fb8281473538ddef0f Mon Sep 17 00:00:00 2001
From: Koakuma <koachan at protonmail.com>
Date: Sun, 14 Jan 2024 15:43:45 +0700
Subject: [PATCH 2/2] Fixup load pointer type in testcase

Created using spr 1.3.4
---
 llvm/test/CodeGen/SPARC/getpcx-call.ll | 2 +-
 llvm/test/CodeGen/SPARC/getpcx-rdpc.ll | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/llvm/test/CodeGen/SPARC/getpcx-call.ll b/llvm/test/CodeGen/SPARC/getpcx-call.ll
index 0f162f1cd0bb7a..72d7b5a0bc2f5b 100644
--- a/llvm/test/CodeGen/SPARC/getpcx-call.ll
+++ b/llvm/test/CodeGen/SPARC/getpcx-call.ll
@@ -44,7 +44,7 @@ define i32 @testCall() nounwind #0 {
 ; SPARC64-NEXT:    ld [%i0], %i0
 ; SPARC64-NEXT:    ret
 ; SPARC64-NEXT:    restore
-  %1 = load i32, i32* @value
+  %1 = load i32, ptr @value
   ret i32 %1
 }
 
diff --git a/llvm/test/CodeGen/SPARC/getpcx-rdpc.ll b/llvm/test/CodeGen/SPARC/getpcx-rdpc.ll
index cb51502f7b0690..286750a014e82d 100644
--- a/llvm/test/CodeGen/SPARC/getpcx-rdpc.ll
+++ b/llvm/test/CodeGen/SPARC/getpcx-rdpc.ll
@@ -44,7 +44,7 @@ define i32 @testRdpc() nounwind #0 {
 ; SPARC64-NEXT:    ld [%i0], %i0
 ; SPARC64-NEXT:    ret
 ; SPARC64-NEXT:    restore
-  %1 = load i32, i32* @value
+  %1 = load i32, ptr @value
   ret i32 %1
 }
 



More information about the llvm-branch-commits mailing list