aboutsummaryrefslogtreecommitdiff
path: root/llvm/test/CodeGen/X86/switch-or.ll
blob: b0177e547ded83de4b1226696b44bf7ba6a47301 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
; RUN: llc -mtriple=i686-- -asm-verbose=false < %s | FileCheck %s

; Check that merging switch cases that differ in one bit works.
; CHECK-LABEL: test1
; CHECK: orl $2
; CHECK-NEXT: cmpl $6
define void @test1(i32 %variable) nounwind {
entry:
  switch i32 %variable, label %if.end [
    i32 4, label %if.then
    i32 6, label %if.then
  ]

if.then:
  %call = tail call i32 (...) @bar() nounwind
  ret void

if.end:
  ret void
}

; CHECK-LABEL: test2
; CHECK: testl $2147483647
define void @test2(i32 %variable) nounwind {
entry:
  switch i32 %variable, label %if.end [
    i32 0, label %if.then
    i32 -2147483648, label %if.then
  ]

if.then:
  %call = tail call i32 (...) @bar() nounwind
  ret void

if.end:
  ret void
}

declare i32 @bar(...) nounwind