1 ; NOTE: This test case generates a jump table on PowerPC big and little endian
2 ; NOTE: then verifies that the command line option to enable absolute jump
3 ; NOTE: table works correctly.
4 ; RUN: llc -mtriple=powerpc64le-unknown-linux-gnu -o - \
5 ; RUN: -ppc-use-absolute-jumptables -ppc-asm-full-reg-names \
6 ; RUN: -verify-machineinstrs %s | FileCheck %s -check-prefix=CHECK-LE
7 ; RUN: llc -mtriple=powerpc64-unknown-linux-gnu -o - \
8 ; RUN: -ppc-use-absolute-jumptables -ppc-asm-full-reg-names \
9 ; RUN: -verify-machineinstrs %s | FileCheck %s -check-prefix=CHECK-BE
11 %struct.node = type { i8, %struct.node* }
13 ; Function Attrs: norecurse nounwind readonly
14 define zeroext i32 @jumpTableTest(%struct.node* readonly %list) {
15 ; CHECK-LE-LABEL: jumpTableTest:
16 ; CHECK-LE: # %bb.0: # %entry
17 ; CHECK-LE: rldic r[[REG:[0-9]+]], r[[REG]], 3, 29
18 ; CHECK-LE: ldx r[[REG]], r[[REG]], r[[REG1:[0-9]+]]
19 ; CHECK-LE: mtctr r[[REG]]
23 ; CHECK-BE-LABEL: jumpTableTest:
24 ; CHECK-BE: # %bb.0: # %entry
25 ; CHECK-BE: rldic r[[REG:[0-9]+]], r[[REG]], 2, 30
26 ; CHECK-BE: lwax r[[REG]], r[[REG]], r[[REG1:[0-9]+]]
27 ; CHECK-BE: mtctr r[[REG]]
31 %cmp36 = icmp eq %struct.node* %list, null
32 br i1 %cmp36, label %while.end, label %while.body
34 while.body: ; preds = %entry, %sw.epilog
35 %result.038 = phi i32 [ %result.1, %sw.epilog ], [ 0, %entry ]
36 %current.037 = phi %struct.node* [ %spec.store.select, %sw.epilog ], [ %list, %entry ]
37 %next1 = getelementptr inbounds %struct.node, %struct.node* %current.037, i64 0, i32 1
38 %0 = load %struct.node*, %struct.node** %next1, align 8
39 %cmp2 = icmp eq %struct.node* %0, %current.037
40 %spec.store.select = select i1 %cmp2, %struct.node* null, %struct.node* %0
41 %type = getelementptr inbounds %struct.node, %struct.node* %current.037, i64 0, i32 0
42 %1 = load i8, i8* %type, align 8
43 switch i8 %1, label %sw.epilog [
55 sw.bb: ; preds = %while.body
56 %add = add nsw i32 %result.038, 13
59 sw.bb3: ; preds = %while.body
60 %add4 = add nsw i32 %result.038, 5
63 sw.bb5: ; preds = %while.body
64 %add6 = add nsw i32 %result.038, 2
67 sw.bb7: ; preds = %while.body
68 %add8 = add nsw i32 %result.038, 7
71 sw.bb9: ; preds = %while.body
72 %add10 = add nsw i32 %result.038, 11
75 sw.bb11: ; preds = %while.body
76 %add12 = add nsw i32 %result.038, 17
79 sw.bb13: ; preds = %while.body
80 %add14 = add nsw i32 %result.038, 16
83 sw.bb15: ; preds = %while.body
84 %add16 = add nsw i32 %result.038, 81
87 sw.bb17: ; preds = %while.body
88 %add18 = add nsw i32 %result.038, 72
91 sw.epilog: ; preds = %while.body, %sw.bb17, %sw.bb15, %sw.bb13, %sw.bb11, %sw.bb9, %sw.bb7, %sw.bb5, %sw.bb3, %sw.bb
92 %result.1 = phi i32 [ %result.038, %while.body ], [ %add18, %sw.bb17 ], [ %add16, %sw.bb15 ], [ %add14, %sw.bb13 ], [ %add12, %sw.bb11 ], [ %add10, %sw.bb9 ], [ %add8, %sw.bb7 ], [ %add6, %sw.bb5 ], [ %add4, %sw.bb3 ], [ %add, %sw.bb ]
93 %cmp = icmp eq %struct.node* %spec.store.select, null
94 br i1 %cmp, label %while.end, label %while.body
96 while.end: ; preds = %sw.epilog, %entry
97 %result.0.lcssa = phi i32 [ 0, %entry ], [ %result.1, %sw.epilog ]
98 ret i32 %result.0.lcssa