1# RUN: llc -march=x86-64 -start-after branch-folder -stop-after branch-folder -o /dev/null %s | FileCheck %s
2# This test ensures that the MIR parser parses the 'implicit' and 'implicit-def'
3# register flags correctly.
4
5--- |
6
7  define i32 @foo(i32 %a) {
8  entry:
9    %0 = icmp sle i32 %a, 10
10    br i1 %0, label %less, label %exit
11
12  less:
13    ret i32 0
14
15  exit:
16    ret i32 %a
17  }
18
19  define i1 @implicit_subregister1() {
20  entry:
21    ret i1 false
22  }
23
24  define i16 @implicit_subregister2() {
25  entry:
26    ret i16 0
27  }
28
29...
30---
31name:            foo
32body: |
33  bb.0.entry:
34    successors: %bb.1.less, %bb.2.exit
35    ; CHECK:      CMP32ri8 %edi, 10, implicit-def %eflags
36    ; CHECK-NEXT: JG_1 %bb.2.exit, implicit %eflags
37    CMP32ri8 %edi, 10, implicit-def %eflags
38    JG_1 %bb.2.exit, implicit %eflags
39
40  bb.1.less:
41    ; CHECK: %eax = MOV32r0 implicit-def %eflags
42    %eax = MOV32r0 implicit-def %eflags
43    RETQ %eax
44
45  bb.2.exit:
46    %eax = COPY %edi
47    RETQ %eax
48...
49---
50name:            implicit_subregister1
51body: |
52  bb.0.entry:
53  ; Verify that the implicit register verifier won't report an error on implicit
54  ; subregisters.
55  ; CHECK-LABEL: name: implicit_subregister1
56  ; CHECK: dead %eax = XOR32rr undef %eax, undef %eax, implicit-def dead %eflags, implicit-def %al
57    dead %eax = XOR32rr undef %eax, undef %eax, implicit-def dead %eflags, implicit-def %al
58    RETQ killed %al
59...
60---
61name:            implicit_subregister2
62body: |
63  bb.0.entry:
64  ; CHECK-LABEL: name: implicit_subregister2
65  ; CHECK: dead %r15 = XOR64rr undef %r15, undef %r15, implicit-def dead %eflags, implicit-def %r15w
66    dead %r15 = XOR64rr undef %r15, undef %r15, implicit-def dead %eflags, implicit-def %r15w
67    RETQ killed %r15w
68...
69