• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc < %s | FileCheck %s
2
3target datalayout = "e-p:16:16:16-i8:8:8-i16:16:16-i32:16:32-n8:16"
4target triple = "msp430---elf"
5
6; Function Attrs: nounwind
7define i16 @test(i16 %i) #0 {
8entry:
9; CHECK-LABEL: test:
10; CHECK:      sub   #4, r1
11; CHECK-NEXT: mov   r12, 0(r1)
12; CHECK-NEXT: cmp   #4, r12
13; CHECK-NEXT: jhs     .LBB0_3
14  %retval = alloca i16, align 2
15  %i.addr = alloca i16, align 2
16  store i16 %i, i16* %i.addr, align 2
17  %0 = load i16, i16* %i.addr, align 2
18; CHECK:      add   r12, r12
19; CHECK-NEXT: br .LJTI0_0(r12)
20  switch i16 %0, label %sw.default [
21    i16 0, label %sw.bb
22    i16 1, label %sw.bb1
23    i16 2, label %sw.bb2
24    i16 3, label %sw.bb3
25  ]
26
27sw.bb:                                            ; preds = %entry
28  store i16 0, i16* %retval
29  br label %return
30
31sw.bb1:                                           ; preds = %entry
32  store i16 1, i16* %retval
33  br label %return
34
35sw.bb2:                                           ; preds = %entry
36  store i16 2, i16* %retval
37  br label %return
38
39sw.bb3:                                           ; preds = %entry
40  store i16 3, i16* %retval
41  br label %return
42
43sw.default:                                       ; preds = %entry
44  store i16 2, i16* %retval
45  br label %return
46
47return:                                           ; preds = %sw.default, %sw.bb3, %sw.bb2, %sw.bb1, %sw.bb
48  %1 = load i16, i16* %retval
49  ret i16 %1
50; CHECK: ret
51}
52
53; CHECK: .LJTI0_0:
54; CHECK-NEXT: .short .LBB0_2
55; CHECK-NEXT: .short .LBB0_4
56; CHECK-NEXT: .short .LBB0_3
57; CHECK-NEXT: .short .LBB0_5
58