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 10 11%struct.node = type { i8, %struct.node* } 12 13; Function Attrs: norecurse nounwind readonly 14define 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]] 20; CHECK-LE: bctr 21; CHECK-LE: blr 22; 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]] 28; CHECK-BE: bctr 29; CHECK-BE: blr 30entry: 31 %cmp36 = icmp eq %struct.node* %list, null 32 br i1 %cmp36, label %while.end, label %while.body 33 34while.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 [ 44 i8 1, label %sw.bb 45 i8 2, label %sw.bb3 46 i8 3, label %sw.bb5 47 i8 4, label %sw.bb7 48 i8 5, label %sw.bb9 49 i8 6, label %sw.bb11 50 i8 7, label %sw.bb13 51 i8 8, label %sw.bb15 52 i8 9, label %sw.bb17 53 ] 54 55sw.bb: ; preds = %while.body 56 %add = add nsw i32 %result.038, 13 57 br label %sw.epilog 58 59sw.bb3: ; preds = %while.body 60 %add4 = add nsw i32 %result.038, 5 61 br label %sw.epilog 62 63sw.bb5: ; preds = %while.body 64 %add6 = add nsw i32 %result.038, 2 65 br label %sw.epilog 66 67sw.bb7: ; preds = %while.body 68 %add8 = add nsw i32 %result.038, 7 69 br label %sw.epilog 70 71sw.bb9: ; preds = %while.body 72 %add10 = add nsw i32 %result.038, 11 73 br label %sw.epilog 74 75sw.bb11: ; preds = %while.body 76 %add12 = add nsw i32 %result.038, 17 77 br label %sw.epilog 78 79sw.bb13: ; preds = %while.body 80 %add14 = add nsw i32 %result.038, 16 81 br label %sw.epilog 82 83sw.bb15: ; preds = %while.body 84 %add16 = add nsw i32 %result.038, 81 85 br label %sw.epilog 86 87sw.bb17: ; preds = %while.body 88 %add18 = add nsw i32 %result.038, 72 89 br label %sw.epilog 90 91sw.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 95 96while.end: ; preds = %sw.epilog, %entry 97 %result.0.lcssa = phi i32 [ 0, %entry ], [ %result.1, %sw.epilog ] 98 ret i32 %result.0.lcssa 99} 100 101