1 ; RUN: llc -x86-condbr-folding=true -mtriple=x86_64-linux-gnu -mcpu=sandybridge %s -o - -verify-machineinstrs | FileCheck %s --check-prefix=MERGE
2 ; RUN: llc -x86-condbr-folding=true -mtriple=x86_64-linux-gnu -mcpu=ivybridge %s -o - -verify-machineinstrs | FileCheck %s --check-prefix=MERGE
3 ; RUN: llc -x86-condbr-folding=true -mtriple=x86_64-linux-gnu -mcpu=haswell %s -o - -verify-machineinstrs | FileCheck %s --check-prefix=MERGE
4 ; RUN: llc -x86-condbr-folding=true -mtriple=x86_64-linux-gnu -mcpu=broadwell %s -o - -verify-machineinstrs | FileCheck %s --check-prefix=MERGE
5 ; RUN: llc -x86-condbr-folding=true -mtriple=x86_64-linux-gnu -mcpu=skylake %s -o - -verify-machineinstrs | FileCheck %s --check-prefix=MERGE
6 ; RUN: llc -x86-condbr-folding=true -mtriple=x86_64-linux-gnu -mcpu=skx %s -o - -verify-machineinstrs | FileCheck %s --check-prefix=MERGE
7 ; RUN: llc -x86-condbr-folding=true -mtriple=x86_64-linux-gnu %s -o - -verify-machineinstrs | FileCheck %s --check-prefix=NOTMERGE
9 @v1 = common dso_local local_unnamed_addr global i32 0, align 4
10 @v2 = common dso_local local_unnamed_addr global i32 0, align 4
11 @v3 = common dso_local local_unnamed_addr global i32 0, align 4
12 @v4 = common dso_local local_unnamed_addr global i32 0, align 4
13 @v5 = common dso_local local_unnamed_addr global i32 0, align 4
14 @v6 = common dso_local local_unnamed_addr global i32 0, align 4
15 @v7 = common dso_local local_unnamed_addr global i32 0, align 4
16 @v8 = common dso_local local_unnamed_addr global i32 0, align 4
17 @v9 = common dso_local local_unnamed_addr global i32 0, align 4
18 @v10 = common dso_local local_unnamed_addr global i32 0, align 4
19 @v11 = common dso_local local_unnamed_addr global i32 0, align 4
20 @v12 = common dso_local local_unnamed_addr global i32 0, align 4
21 @v13 = common dso_local local_unnamed_addr global i32 0, align 4
22 @v14 = common dso_local local_unnamed_addr global i32 0, align 4
23 @v15 = common dso_local local_unnamed_addr global i32 0, align 4
25 define dso_local i32 @fourcases(i32 %n) {
27 switch i32 %n, label %return [
29 i32 222, label %sw.bb1
30 i32 3665, label %sw.bb2
31 i32 4444, label %sw.bb4
35 %0 = load i32, i32* @v1, align 4
39 %1 = load i32, i32* @v2, align 4
40 %add = add nsw i32 %1, 12
44 %2 = load i32, i32* @v3, align 4
45 %add3 = add nsw i32 %2, 13
49 %3 = load i32, i32* @v1, align 4
50 %4 = load i32, i32* @v2, align 4
51 %add5 = add nsw i32 %4, %3
55 %retval.0 = phi i32 [ %add5, %sw.bb4 ], [ %add3, %sw.bb2 ], [ %add, %sw.bb1 ], [ %0, %sw.bb ], [ 0, %entry ]
58 ; MERGE-LABEL: fourcases
62 ; NOTMERGE: cmpl $3664
65 define dso_local i32 @fifteencases(i32) {
66 switch i32 %0, label %32 [
85 %3 = load i32, i32* @v1, align 4
89 %5 = load i32, i32* @v2, align 4
93 %7 = load i32, i32* @v3, align 4
97 %9 = load i32, i32* @v4, align 4
101 %11 = load i32, i32* @v5, align 4
105 %13 = load i32, i32* @v6, align 4
109 %15 = load i32, i32* @v7, align 4
113 %17 = load i32, i32* @v8, align 4
117 %19 = load i32, i32* @v9, align 4
121 %21 = load i32, i32* @v10, align 4
125 %23 = load i32, i32* @v11, align 4
129 %25 = load i32, i32* @v12, align 4
133 %27 = load i32, i32* @v13, align 4
137 %29 = load i32, i32* @v14, align 4
141 %31 = load i32, i32* @v15, align 4
145 %33 = phi i32 [ %31, %30 ], [ %29, %28 ], [ %27, %26 ], [ %25, %24 ], [ %23, %22 ], [ %21, %20 ], [ %19, %18 ], [ %17, %16 ], [ %15, %14 ], [ %13, %12 ], [ %11, %10 ], [ %9, %8 ], [ %7, %6 ], [ %5, %4 ], [ %3, %2 ], [ 0, %1 ]
148 ; MERGE-LABEL: fifteencases
164 ; NOTMERGE-LABEL: fifteencases
165 ; NOTMERGE: cmpl $270