1 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \
2 ; RUN: -mcpu=pwr10 -ppc-asm-full-reg-names -ppc-min-jump-table-entries=4 < %s | FileCheck %s \
3 ; RUN: --check-prefix=CHECK-R
4 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \
5 ; RUN: -mcpu=pwr10 -ppc-use-absolute-jumptables -ppc-min-jump-table-entries=4 \
6 ; RUN: -ppc-asm-full-reg-names < %s | FileCheck %s \
7 ; RUN: --check-prefix=CHECK-A-LE
8 ; RUN: llc -verify-machineinstrs -target-abi=elfv2 -mtriple=powerpc64-- \
9 ; RUN: -mcpu=pwr10 -ppc-asm-full-reg-names -ppc-min-jump-table-entries=4 < %s | FileCheck %s \
10 ; RUN: --check-prefix=CHECK-R
11 ; RUN: llc -verify-machineinstrs -target-abi=elfv2 -mtriple=powerpc64-- \
12 ; RUN: -mcpu=pwr10 -ppc-use-absolute-jumptables -ppc-min-jump-table-entries=4 \
13 ; RUN: -ppc-asm-full-reg-names < %s | FileCheck %s \
14 ; RUN: --check-prefix=CHECK-A-BE
17 ; This test checks for getting relative and absolute jump table base address
18 ; using PC Relative addressing.
20 define dso_local signext i32 @jumptable(i32 signext %param) {
21 ; CHECK-R-LABEL: jumptable:
22 ; CHECK-R: # %bb.1: # %entry
23 ; CHECK-R-NEXT: rldic r4, r4
24 ; CHECK-R-NEXT: paddi r5, 0, .LJTI0_0@PCREL, 1
25 ; CHECK-R-NEXT: lwax r4, r4, r5
26 ; CHECK-R-NEXT: add r4, r4, r5
27 ; CHECK-R-NEXT: mtctr r4
29 ; CHECK-A-LE-LABEL: jumptable:
30 ; CHECK-A-LE: # %bb.1: # %entry
31 ; CHECK-A-LE-NEXT: rldic r4, r4
32 ; CHECK-A-LE-NEXT: paddi r5, 0, .LJTI0_0@PCREL, 1
33 ; CHECK-A-LE-NEXT: ldx r4, r4, r5
34 ; CHECK-A-LE-NEXT: mtctr r4
35 ; CHECK-A-LE-NEXT: bctr
36 ; CHECK-A-BE-LABEL: jumptable:
37 ; CHECK-A-BE: # %bb.1: # %entry
38 ; CHECK-A-BE-NEXT: rldic r4, r4
39 ; CHECK-A-BE-NEXT: paddi r5, 0, .LJTI0_0@PCREL, 1
40 ; CHECK-A-BE-NEXT: lwax r4, r4, r5
41 ; CHECK-A-BE-NEXT: mtctr r4
42 ; CHECK-A-BE-NEXT: bctr
46 switch i32 %param, label %sw.default [
54 sw.bb1: ; preds = %entry
57 sw.bb2: ; preds = %entry
60 sw.bb3: ; preds = %entry
63 sw.bb4: ; preds = %entry
66 sw.default: ; preds = %entry
69 return: ; preds = %entry, %sw.default, %sw.bb4, %sw.bb3, %sw.bb2, %sw.bb1
70 %retval.0 = phi i32 [ -1, %sw.default ], [ 400, %sw.bb4 ], [ 16, %sw.bb3 ],
71 [ 9, %sw.bb2 ], [ 4, %sw.bb1 ], [ %param, %entry ]