xref: /llvm-project/llvm/test/Transforms/SimplifyCFG/Hexagon/disable-lookup-table.ll (revision 4ab3041acbdc274050d6c53f72619c7455cbc97a)
1; RUN: opt -S -O2 < %s | FileCheck %s -check-prefix=DISABLE
2; RUN: opt -S -hexagon-emit-lookup-tables=true -O2 < %s | FileCheck %s -check-prefix=DISABLE
3; RUN: opt -S -hexagon-emit-lookup-tables=false -O2 < %s | FileCheck %s -check-prefix=DISABLE
4; The attribute "no-jump-tables"="true" disables the generation of switch generated lookup tables
5
6; DISABLE-NOT: @{{.*}} = private unnamed_addr constant [6 x i32] [i32 9, i32 20, i32 14, i32 22, i32 12, i32 5]
7
8target datalayout = "e-m:e-p:32:32:32-a:0-n16:32-i64:64:64-i32:32:32-i16:16:16-i1:8:8-f32:32:32-f64:64:64-v32:32:32-v64:64:64-v512:512:512-v1024:1024:1024-v2048:2048:2048"
9target triple = "hexagon-unknown--elf"
10
11; Function Attrs: noinline nounwind
12define i32 @foo(i32 %c) #0 {
13entry:
14  switch i32 %c, label %sw.default [
15    i32 42, label %return
16    i32 43, label %sw.bb1
17    i32 44, label %sw.bb2
18    i32 45, label %sw.bb3
19    i32 46, label %sw.bb4
20    i32 47, label %sw.bb5
21    i32 48, label %sw.bb6
22  ]
23
24sw.bb1: br label %return
25sw.bb2: br label %return
26sw.bb3: br label %return
27sw.bb4: br label %return
28sw.bb5: br label %return
29sw.bb6: br label %return
30sw.default: br label %return
31return:
32  %retval.0 = phi i32 [ 15, %sw.default ], [ 1, %sw.bb6 ], [ 62, %sw.bb5 ], [ 27, %sw.bb4 ], [ -1, %sw.bb3 ], [ 0, %sw.bb2 ], [ 123, %sw.bb1 ], [ 55, %entry ]
33  ret i32 %retval.0
34}
35
36attributes #0 = { noinline nounwind "no-jump-tables"="true"}
37