1# RUN: llc -x mir < %s | FileCheck %s
2--- |
3  target triple = "x86_64-unknown-linux-gnu"
4
5  @x = external global i64
6  @i = external thread_local global i32
7
8  define i32 @or() {
9  entry:
10    ret i32 undef
11  }
12
13  define i32 @and() {
14  entry:
15    ret i32 undef
16  }
17...
18---
19# CHECK-LABEL: or:
20name: or
21alignment: 16
22tracksRegLiveness: true
23registers:
24  - { id: 0, class: gr64 }
25  - { id: 1, class: gr64 }
26  - { id: 2, class: gr64 }
27  - { id: 3, class: gr64 }
28  - { id: 4, class: gr32 }
29body: |
30  bb.0.entry:
31    %0:gr64 = MOV64rm $rip, 1, $noreg, @x, $noreg :: (load 8)
32    %1:gr64 = OR64ri8 %0, 7, implicit-def dead $eflags
33    %2:gr64 = MOV64rm $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg :: (load 8)
34    %3:gr64 = OR64rr %2, %1, implicit-def dead $eflags
35    %4:gr32 = MOV32rm killed %3, 1, $noreg, 0, $fs :: (load 4)
36  ; CHECK-NOT:  orq {{.*}}GOTTPOFF{{.*}}
37  ;
38  ; What we actually expect:
39  ; CHECK:      movq {{.*}}GOTTPOFF{{.*}}, %[[R:.*]]
40  ; CHECK-NEXT: orq %{{.*}}, %[[R]]
41  ; CHECK-NEXT: movl %fs:(%[[R]]),
42  ;
43  ; CHECK-NOT:  orq {{.*}}GOTTPOFF{{.*}}
44    $eax = COPY %4
45    RET 0, $eax
46
47...
48---
49# CHECK-LABEL: and:
50name: and
51alignment: 16
52tracksRegLiveness: true
53registers:
54  - { id: 0, class: gr64 }
55  - { id: 1, class: gr64 }
56  - { id: 2, class: gr64 }
57  - { id: 3, class: gr64 }
58  - { id: 4, class: gr32 }
59body: |
60  bb.0.entry:
61    %0:gr64 = MOV64rm $rip, 1, $noreg, @x, $noreg :: (load 8)
62    %1:gr64 = OR64ri8 %0, 7, implicit-def dead $eflags
63    %2:gr64 = MOV64rm $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg :: (load 8)
64    %3:gr64 = AND64rr %2, %1, implicit-def dead $eflags
65    %4:gr32 = MOV32rm killed %3, 1, $noreg, 0, $fs :: (load 4)
66  ; CHECK-NOT:  andq {{.*}}GOTTPOFF{{.*}}
67  ;
68  ; What we actually expect:
69  ; CHECK:      movq {{.*}}GOTTPOFF{{.*}}, %[[R:.*]]
70  ; CHECK-NEXT: andq %{{.*}}, %[[R]]
71  ; CHECK-NEXT: movl %fs:(%[[R]]),
72  ;
73  ; CHECK-NOT:  andq {{.*}}GOTTPOFF{{.*}}
74    $eax = COPY %4
75    RET 0, $eax
76
77...
78