aboutsummaryrefslogtreecommitdiff
path: root/llvm/test/CodeGen/X86/GlobalISel/legalize-brcond.mir
blob: 129e0c08e149966fbbb044404623682a428a62c4 (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# RUN: llc -mtriple=x86_64-linux-gnu -run-pass=legalizer %s -o - | FileCheck %s --check-prefix=ALL
# RUN: llc -mtriple=i386-linux-gnu   -run-pass=legalizer %s -o - | FileCheck %s --check-prefix=ALL

--- |

  define i32 @test(i32 %a) {
  entry:
    %cmp = trunc i32 %a to i1
    br i1 %cmp, label %if.then, label %if.else

  if.then:                                          ; preds = %entry
    ret i32 0

  if.else:                                          ; preds = %entry
    ret i32 1
  }
...
---
name:            test
# ALL-LABEL: name:  test
alignment:       16
legalized:       false
regBankSelected: false
registers:
  - { id: 0, class: _, preferred-register: '' }
  - { id: 1, class: _, preferred-register: '' }
  - { id: 2, class: _, preferred-register: '' }
  - { id: 3, class: _, preferred-register: '' }
# ALL:         %1:_(s1) = G_TRUNC %0(s32)
# ALL-NEXT:    G_BRCOND %1(s1), %[[TRUE:bb.[0-9]+]]
# ALL-NEXT:    G_BR %[[FALSE:bb.[0-9]+]]
# ALL:       [[TRUE]].{{[a-zA-Z0-9.]+}}:
# ALL-NEXT:    $eax = COPY %2(s32)
# ALL-NEXT:    RET 0, implicit $eax
# ALL:       [[FALSE]].{{[a-zA-Z0-9.]+}}:
# ALL-NEXT:    $eax = COPY %3(s32)
# ALL-NEXT:    RET 0, implicit $eax
body:             |
  bb.1.entry:
    successors: %bb.2(0x40000000), %bb.3(0x40000000)
    liveins: $edi

    %0(s32) = COPY $edi
    %2(s32) = G_CONSTANT i32 0
    %3(s32) = G_CONSTANT i32 1
    %1(s1) = G_TRUNC %0(s32)
    G_BRCOND %1(s1), %bb.2
    G_BR %bb.3

  bb.2.if.then:
    $eax = COPY %2(s32)
    RET 0, implicit $eax

  bb.3.if.else:
    $eax = COPY %3(s32)
    RET 0, implicit $eax

...