[PATCH] D154048: [PowerPC] fix jumptable encoding when ppc-use-absolute-jumptables is turned on
Ting Wang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 29 17:58:28 PDT 2023
tingwang updated this revision to Diff 536078.
tingwang added a comment.
Update test case after commit NFC patch.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D154048/new/
https://reviews.llvm.org/D154048
Files:
llvm/lib/Target/PowerPC/PPCISelLowering.cpp
llvm/test/CodeGen/PowerPC/absol-jump-table-enabled.ll
llvm/test/CodeGen/PowerPC/pcrel-jump-table.ll
Index: llvm/test/CodeGen/PowerPC/pcrel-jump-table.ll
===================================================================
--- llvm/test/CodeGen/PowerPC/pcrel-jump-table.ll
+++ llvm/test/CodeGen/PowerPC/pcrel-jump-table.ll
@@ -35,13 +35,12 @@
; CHECK-A-LE-NEXT: bctr
; CHECK-A-BE-LABEL: jumptable:
; CHECK-A-BE: # %bb.1: # %entry
-; CHECK-A-BE-NEXT: paddi r5, 0, .LJTI0_0 at PCREL, 1
; CHECK-A-BE-NEXT: rldic r4, r4
-; CHECK-A-BE-NEXT: lwax r4, r4, r5
+; CHECK-A-BE-NEXT: paddi r5, 0, .LJTI0_0 at PCREL, 1
+; CHECK-A-BE-NEXT: ldx r4, r4, r5
; CHECK-A-BE-NEXT: mtctr r4
; CHECK-A-BE-NEXT: bctr
-
entry:
switch i32 %param, label %sw.default [
i32 1, label %return
Index: llvm/test/CodeGen/PowerPC/absol-jump-table-enabled.ll
===================================================================
--- llvm/test/CodeGen/PowerPC/absol-jump-table-enabled.ll
+++ llvm/test/CodeGen/PowerPC/absol-jump-table-enabled.ll
@@ -55,34 +55,34 @@
;
; CHECK-BE-LABEL: jumpTableTest:
; CHECK-BE: # %bb.0: # %entry
-; CHECK-BE: rldic r[[REG:[0-9]+]], r[[REG]], 2, 30
-; CHECK-BE: lwax r[[REG]], r[[REG]], r[[REG1:[0-9]+]]
+; CHECK-BE: rldic r[[REG:[0-9]+]], r[[REG]], 3, 29
+; CHECK-BE: ldx r[[REG]], r[[REG]], r[[REG1:[0-9]+]]
; CHECK-BE: mtctr r[[REG]]
; CHECK-BE: bctr
; CHECK-BE: blr
;
; CHECK-AIX-LABEL: jumpTableTest:
; CHECK-AIX: # %bb.0: # %entry
-; CHECK-AIX: rldic r[[REG:[0-9]+]], r[[REG]], 2, 30
-; CHECK-AIX: lwax r[[REG]], r[[REG]], r[[REG1:[0-9]+]]
+; CHECK-AIX: rldic r[[REG:[0-9]+]], r[[REG]], 3, 29
+; CHECK-AIX: ldx r[[REG]], r[[REG]], r[[REG1:[0-9]+]]
; CHECK-AIX: mtctr r[[REG]]
; CHECK-AIX: bctr
; CHECK-AIX: blr
;
; CHECK-A-PIC-LE-LABEL: .LJTI0_0:
-; CHECK-A-PIC-LE: .long .LBB0_6-.LJTI0_0
+; CHECK-A-PIC-LE: .quad .LBB0_6
;
; CHECK-R-PIC-LE-LABEL: .LJTI0_0:
; CHECK-R-PIC-LE: .long .LBB0_6-.LJTI0_0
;
; CHECK-A-PIC-BE-LABEL: .LJTI0_0:
-; CHECK-A-PIC-BE: .long .LBB0_9-.LJTI0_0
+; CHECK-A-PIC-BE: .quad .LBB0_9
;
; CHECK-R-PIC-BE-LABEL: .LJTI0_0:
; CHECK-R-PIC-BE: .long .LBB0_9-.LJTI0_0
;
; CHECK-A-PIC-AIX-LABEL: L..JTI0_0:
-; CHECK-A-PIC-AIX: .vbyte 4, L..BB0_9-L..JTI0_0
+; CHECK-A-PIC-AIX: .vbyte 8, L..BB0_9
;
; CHECK-R-PIC-AIX-LABEL: L..JTI0_0:
; CHECK-R-PIC-AIX: .vbyte 4, L..BB0_9-L..JTI0_0
Index: llvm/lib/Target/PowerPC/PPCISelLowering.cpp
===================================================================
--- llvm/lib/Target/PowerPC/PPCISelLowering.cpp
+++ llvm/lib/Target/PowerPC/PPCISelLowering.cpp
@@ -3192,7 +3192,8 @@
unsigned PPCTargetLowering::getJumpTableEncoding() const {
if (isJumpTableRelative())
return MachineJumpTableInfo::EK_LabelDifference32;
-
+ if (UseAbsoluteJumpTables)
+ return MachineJumpTableInfo::EK_BlockAddress;
return TargetLowering::getJumpTableEncoding();
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154048.536078.patch
Type: text/x-patch
Size: 3037 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230630/446a4935/attachment.bin>
More information about the llvm-commits
mailing list