171 lines · plain
1; NOTE: This test case generates a jump table on PowerPC big and little endian2; NOTE: then verifies that the command line option to enable absolute jump3; NOTE: table works correctly.4; RUN: llc -mtriple=powerpc64le-unknown-linux-gnu -ppc-min-jump-table-entries=4 -o - \5; RUN: -ppc-use-absolute-jumptables -ppc-asm-full-reg-names \6; RUN: -verify-machineinstrs %s | FileCheck %s -check-prefix=CHECK-LE7; RUN: llc -mtriple=powerpc64-unknown-linux-gnu -ppc-min-jump-table-entries=4 -o - \8; RUN: -ppc-use-absolute-jumptables -ppc-asm-full-reg-names \9; RUN: -verify-machineinstrs %s | FileCheck %s -check-prefix=CHECK-BE10; RUN: llc -mtriple=powerpc64-ibm-aix-xcoff -ppc-min-jump-table-entries=4 -o - \11; RUN: -ppc-use-absolute-jumptables -ppc-asm-full-reg-names \12; RUN: -verify-machineinstrs %s | FileCheck %s -check-prefix=CHECK-AIX13; RUN: llc -mtriple=powerpc64le-unknown-linux-gnu -ppc-min-jump-table-entries=4 -o - \14; RUN: -ppc-use-absolute-jumptables=true --relocation-model=pic < %s | FileCheck %s \15; RUN: -check-prefix=CHECK-A-PIC-LE16; RUN: llc -mtriple=powerpc64le-unknown-linux-gnu -ppc-min-jump-table-entries=4 -o - \17; RUN: -ppc-use-absolute-jumptables=false --relocation-model=pic < %s | FileCheck %s \18; RUN: -check-prefix=CHECK-R-PIC-LE19; RUN: llc -mtriple=powerpc64-unknown-linux-gnu -ppc-min-jump-table-entries=4 -o - \20; RUN: -ppc-use-absolute-jumptables=true --relocation-model=pic < %s | FileCheck %s \21; RUN: -check-prefix=CHECK-A-PIC-BE22; RUN: llc -mtriple=powerpc64-unknown-linux-gnu -ppc-min-jump-table-entries=4 -o - \23; RUN: -ppc-use-absolute-jumptables=false --relocation-model=pic < %s | FileCheck %s \24; RUN: -check-prefix=CHECK-R-PIC-BE25; RUN: llc -mtriple=powerpc64-ibm-aix-xcoff -ppc-min-jump-table-entries=4 -o - \26; RUN: -ppc-use-absolute-jumptables=true --relocation-model=pic < %s | FileCheck %s \27; RUN: -check-prefix=CHECK-A-PIC-AIX28; RUN: llc -mtriple=powerpc64-ibm-aix-xcoff -ppc-min-jump-table-entries=4 -o - \29; RUN: -ppc-use-absolute-jumptables=false --relocation-model=pic < %s | FileCheck %s \30; RUN: -check-prefix=CHECK-R-PIC-AIX31; RUN: llc -mtriple=powerpc64le-unknown-linux-gnu -ppc-min-jump-table-entries=4 -o - \32; RUN: -ppc-use-absolute-jumptables=true --relocation-model=static < %s | FileCheck %s \33; RUN: -check-prefix=CHECK-A-STATIC-LE34; RUN: llc -mtriple=powerpc64le-unknown-linux-gnu -ppc-min-jump-table-entries=4 -o - \35; RUN: -ppc-use-absolute-jumptables=false --relocation-model=static < %s | FileCheck %s \36; RUN: -check-prefix=CHECK-R-STATIC-LE37; RUN: llc -mtriple=powerpc64-unknown-linux-gnu -ppc-min-jump-table-entries=4 -o - \38; RUN: -ppc-use-absolute-jumptables=true --relocation-model=static < %s | FileCheck %s \39; RUN: -check-prefix=CHECK-A-STATIC-BE40; RUN: llc -mtriple=powerpc64-unknown-linux-gnu -ppc-min-jump-table-entries=4 -o - \41; RUN: -ppc-use-absolute-jumptables=false --relocation-model=static < %s | FileCheck %s \42; RUN: -check-prefix=CHECK-R-STATIC-BE43 44%struct.node = type { i8, ptr }45 46; Function Attrs: norecurse nounwind readonly47define zeroext i32 @jumpTableTest(ptr readonly %list) {48; CHECK-LE-LABEL: jumpTableTest:49; CHECK-LE: # %bb.0: # %entry50; CHECK-LE: rldic r[[REG:[0-9]+]], r[[REG]], 3, 2951; CHECK-LE: ldx r[[REG]], r[[REG1:[0-9]+]], r[[REG]]52; CHECK-LE: mtctr r[[REG]]53; CHECK-LE: bctr54; CHECK-LE: blr55;56; CHECK-BE-LABEL: jumpTableTest:57; CHECK-BE: # %bb.0: # %entry58; CHECK-BE: rldic r[[REG:[0-9]+]], r[[REG]], 2, 3059; CHECK-BE: lwax r[[REG]], r[[REG1:[0-9]+]], r[[REG]]60; CHECK-BE: mtctr r[[REG]]61; CHECK-BE: bctr62; CHECK-BE: blr63;64; CHECK-AIX-LABEL: jumpTableTest:65; CHECK-AIX: # %bb.0: # %entry66; CHECK-AIX: rldic r[[REG:[0-9]+]], r[[REG]], 2, 3067; CHECK-AIX: lwax r[[REG]], r[[REG1:[0-9]+]], r[[REG]]68; CHECK-AIX: mtctr r[[REG]]69; CHECK-AIX: bctr70; CHECK-AIX: blr71;72; CHECK-A-PIC-LE-LABEL: .LJTI0_0:73; CHECK-A-PIC-LE: .long .LBB0_6-.LJTI0_074;75; CHECK-R-PIC-LE-LABEL: .LJTI0_0:76; CHECK-R-PIC-LE: .long .LBB0_6-.LJTI0_077;78; CHECK-A-PIC-BE-LABEL: .LJTI0_0:79; CHECK-A-PIC-BE: .long .LBB0_9-.LJTI0_080;81; CHECK-R-PIC-BE-LABEL: .LJTI0_0:82; CHECK-R-PIC-BE: .long .LBB0_9-.LJTI0_083;84; CHECK-A-PIC-AIX-LABEL: L..JTI0_0:85; CHECK-A-PIC-AIX: .vbyte 4, L..BB0_9-L..JTI0_086;87; CHECK-R-PIC-AIX-LABEL: L..JTI0_0:88; CHECK-R-PIC-AIX: .vbyte 4, L..BB0_9-L..JTI0_089;90; CHECK-A-STATIC-LE-LABEL: .LJTI0_0:91; CHECK-A-STATIC-LE: .quad .LBB0_692;93; CHECK-R-STATIC-LE-LABEL: .LJTI0_0:94; CHECK-R-STATIC-LE: .long .LBB0_6-.LJTI0_095;96; CHECK-A-STATIC-BE-LABEL: .LJTI0_0:97; CHECK-A-STATIC-BE: .quad .LBB0_998;99; CHECK-R-STATIC-BE-LABEL: .LJTI0_0:100; CHECK-R-STATIC-BE: .long .LBB0_9-.LJTI0_0101entry:102 %cmp36 = icmp eq ptr %list, null103 br i1 %cmp36, label %while.end, label %while.body104 105while.body: ; preds = %entry, %sw.epilog106 %result.038 = phi i32 [ %result.1, %sw.epilog ], [ 0, %entry ]107 %current.037 = phi ptr [ %spec.store.select, %sw.epilog ], [ %list, %entry ]108 %next1 = getelementptr inbounds %struct.node, ptr %current.037, i64 0, i32 1109 %0 = load ptr, ptr %next1, align 8110 %cmp2 = icmp eq ptr %0, %current.037111 %spec.store.select = select i1 %cmp2, ptr null, ptr %0112 %1 = load i8, ptr %current.037, align 8113 switch i8 %1, label %sw.epilog [114 i8 1, label %sw.bb115 i8 2, label %sw.bb3116 i8 3, label %sw.bb5117 i8 4, label %sw.bb7118 i8 5, label %sw.bb9119 i8 6, label %sw.bb11120 i8 7, label %sw.bb13121 i8 8, label %sw.bb15122 i8 9, label %sw.bb17123 ]124 125sw.bb: ; preds = %while.body126 %add = add nsw i32 %result.038, 13127 br label %sw.epilog128 129sw.bb3: ; preds = %while.body130 %add4 = add nsw i32 %result.038, 5131 br label %sw.epilog132 133sw.bb5: ; preds = %while.body134 %add6 = add nsw i32 %result.038, 2135 br label %sw.epilog136 137sw.bb7: ; preds = %while.body138 %add8 = add nsw i32 %result.038, 7139 br label %sw.epilog140 141sw.bb9: ; preds = %while.body142 %add10 = add nsw i32 %result.038, 11143 br label %sw.epilog144 145sw.bb11: ; preds = %while.body146 %add12 = add nsw i32 %result.038, 17147 br label %sw.epilog148 149sw.bb13: ; preds = %while.body150 %add14 = add nsw i32 %result.038, 16151 br label %sw.epilog152 153sw.bb15: ; preds = %while.body154 %add16 = add nsw i32 %result.038, 81155 br label %sw.epilog156 157sw.bb17: ; preds = %while.body158 %add18 = add nsw i32 %result.038, 72159 br label %sw.epilog160 161sw.epilog: ; preds = %while.body, %sw.bb17, %sw.bb15, %sw.bb13, %sw.bb11, %sw.bb9, %sw.bb7, %sw.bb5, %sw.bb3, %sw.bb162 %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 ]163 %cmp = icmp eq ptr %spec.store.select, null164 br i1 %cmp, label %while.end, label %while.body165 166while.end: ; preds = %sw.epilog, %entry167 %result.0.lcssa = phi i32 [ 0, %entry ], [ %result.1, %sw.epilog ]168 ret i32 %result.0.lcssa169}170 171