xref: /llvm-project/llvm/test/CodeGen/X86/pr51903.mir (revision 60442f0d442723a487528bdd8b48b24657a025e8)
1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2# RUN: llc %s -o - -mtriple=x86_64-unknown-linux-gnu -run-pass=x86-flags-copy-lowering -verify-machineinstrs | FileCheck %s
3
4--- |
5  ; ModuleID = 'bugpoint-reduced-simplified.ll'
6  source_filename = "test.c"
7  target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
8  target triple = "x86_64-unknown-linux-gnu"
9
10  @a = external global i32, align 4
11
12  declare void @e()
13
14  define void @f() {
15  entry:
16    br label %for.body
17
18  for.body:                                         ; preds = %for.body, %entry
19    %0 = load i32, ptr @a, align 4
20    %conv = sext i32 %0 to i64
21    %1 = load i64, ptr undef, align 8
22    %or = or i64 %1, %conv
23    store i64 %or, ptr undef, align 8
24    call void @e()
25    %cmp4 = icmp eq i64 %or, 0
26    %conv5 = zext i1 %cmp4 to i32
27    %conv6 = trunc i32 %conv5 to i8
28    store i8 %conv6, ptr undef, align 1
29    %conv7 = sext i8 %conv6 to i32
30    %bf.cast = trunc i40 undef to i32
31    %xor = xor i32 %conv7, %bf.cast
32    %conv8 = sext i32 %xor to i64
33    store i64 %conv8, ptr undef, align 8
34    br label %for.body
35  }
36
37...
38---
39name:            f
40alignment:       16
41tracksRegLiveness: true
42registers:
43  - { id: 0, class: gr64 }
44  - { id: 1, class: gr64 }
45  - { id: 2, class: gr32 }
46  - { id: 3, class: gr64 }
47  - { id: 4, class: gr32 }
48  - { id: 5, class: gr32 }
49  - { id: 6, class: gr32 }
50  - { id: 7, class: gr64 }
51  - { id: 8, class: gr64 }
52  - { id: 9, class: gr64 }
53  - { id: 10, class: gr64 }
54  - { id: 11, class: gr8 }
55  - { id: 12, class: gr64 }
56frameInfo:
57  maxAlignment:    1
58  hasCalls:        true
59machineFunctionInfo: {}
60body:             |
61  ; CHECK-LABEL: name: f
62  ; CHECK: bb.0.entry:
63  ; CHECK:   successors: %bb.1(0x80000000)
64  ; CHECK:   JMP_1 %bb.1
65  ; CHECK: bb.1.for.body:
66  ; CHECK:   successors: %bb.1(0x80000000)
67  ; CHECK:   [[MOV64rm:%[0-9]+]]:gr64 = MOV64rm $rip, 1, $noreg, target-flags(x86-gotpcrel) @a, $noreg :: (load (s64) from got)
68  ; CHECK:   [[MOVSX64rm32_:%[0-9]+]]:gr64 = MOVSX64rm32 killed [[MOV64rm]], 1, $noreg, 0, $noreg :: (dereferenceable load (s32) from @a)
69  ; CHECK:   [[DEF:%[0-9]+]]:gr64 = IMPLICIT_DEF
70  ; CHECK:   OR64mr [[DEF]], 1, $noreg, 0, $noreg, [[MOVSX64rm32_]], implicit-def $eflags :: (store (s64) into `ptr undef`), (load (s64) from `ptr undef`)
71  ; CHECK:   [[SETCCr:%[0-9]+]]:gr8 = SETCCr 4, implicit $eflags
72  ; CHECK:   ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
73  ; CHECK:   CALL64pcrel32 target-flags(x86-plt) @e, csr_64, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp
74  ; CHECK:   ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
75  ; CHECK:   [[MOVZX32rr8_:%[0-9]+]]:gr32 = MOVZX32rr8 [[SETCCr]]
76  ; CHECK:   [[DEF1:%[0-9]+]]:gr64 = IMPLICIT_DEF
77  ; CHECK:   MOV8mr [[DEF1]], 1, $noreg, 0, $noreg, [[SETCCr]] :: (store (s8) into `ptr undef`)
78  ; CHECK:   [[DEF2:%[0-9]+]]:gr32 = IMPLICIT_DEF
79  ; CHECK:   [[XOR32rr:%[0-9]+]]:gr32 = XOR32rr [[MOVZX32rr8_]], [[DEF2]], implicit-def $eflags
80  ; CHECK:   [[MOVSX64rr32_:%[0-9]+]]:gr64 = MOVSX64rr32 [[XOR32rr]]
81  ; CHECK:   [[DEF3:%[0-9]+]]:gr64 = IMPLICIT_DEF
82  ; CHECK:   MOV64mr [[DEF3]], 1, $noreg, 0, $noreg, [[MOVSX64rr32_]] :: (store (s64) into `ptr undef`)
83  ; CHECK:   JMP_1 %bb.1
84  bb.0.entry:
85    JMP_1 %bb.1
86
87  bb.1.for.body:
88    %7:gr64 = MOV64rm $rip, 1, $noreg, target-flags(x86-gotpcrel) @a, $noreg :: (load (s64) from got)
89    %8:gr64 = MOVSX64rm32 killed %7, 1, $noreg, 0, $noreg :: (dereferenceable load (s32) from @a)
90    %9:gr64 = IMPLICIT_DEF
91    OR64mr %9, 1, $noreg, 0, $noreg, %8, implicit-def $eflags :: (store (s64) into `ptr undef`), (load (s64) from `ptr undef`)
92    %10:gr64 = COPY $eflags
93    ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
94    CALL64pcrel32 target-flags(x86-plt) @e, csr_64, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp
95    ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
96    $eflags = COPY %10
97    %11:gr8 = SETCCr 4, implicit $eflags
98    %4:gr32 = MOVZX32rr8 killed %11
99    %12:gr64 = IMPLICIT_DEF
100    SETCCm %12, 1, $noreg, 0, $noreg, 4, implicit $eflags :: (store (s8) into `ptr undef`)
101    %5:gr32 = IMPLICIT_DEF
102    %6:gr32 = XOR32rr %4, %5, implicit-def $eflags
103    %3:gr64 = MOVSX64rr32 %6
104    %0:gr64 = IMPLICIT_DEF
105    MOV64mr %0, 1, $noreg, 0, $noreg, %3 :: (store (s64) into `ptr undef`)
106    JMP_1 %bb.1
107
108...
109