summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/X86/GlobalISel/select-leaf-constant.mir
blob: 29161de91f03eed7df06b5471ce17876a73d3ca0 (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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple=i586-linux-gnu -mcpu=haswell -mattr=-slow-incdec -run-pass=instruction-select %s -o - | FileCheck %s --check-prefix=CHECK
#
# This is necessary to test that attribute-based rule predicates work and that
# they properly reset between functions.

--- |
  define i32 @const_i32_1() {
    ret i32 1
  }

  define i32 @const_i32_1_optsize() #0 {
    ret i32 1
  }

  define i32 @const_i32_1b() {
    ret i32 1
  }

  define i32 @const_i32_1_optsizeb() #0 {
    ret i32 1
  }

  attributes #0 = { optsize }
...
---
name:            const_i32_1
legalized:       true
regBankSelected: true
selected:        false
registers:
  - { id: 0, class: gpr }
body:             |
  bb.1 (%ir-block.0):
    ; CHECK-LABEL: name: const_i32_1
    ; CHECK: [[MOV32ri:%[0-9]+]]:gr32 = MOV32ri 1
    ; CHECK: $eax = COPY [[MOV32ri]]
    ; CHECK: RET 0, implicit $eax
    %0(s32) = G_CONSTANT i32 1
    $eax = COPY %0(s32)
    RET 0, implicit $eax
...
---
name:            const_i32_1_optsize
legalized:       true
regBankSelected: true
selected:        false
registers:
  - { id: 0, class: gpr }
body:             |
  bb.1 (%ir-block.0):
    ; CHECK-LABEL: name: const_i32_1_optsize
    ; CHECK: [[MOV32r1_:%[0-9]+]]:gr32 = MOV32r1 implicit-def $eflags
    ; CHECK: $eax = COPY [[MOV32r1_]]
    ; CHECK: RET 0, implicit $eax
    %0(s32) = G_CONSTANT i32 1
    $eax = COPY %0(s32)
    RET 0, implicit $eax
...
---
name:            const_i32_1b
legalized:       true
regBankSelected: true
selected:        false
registers:
  - { id: 0, class: gpr }
body:             |
  bb.1 (%ir-block.0):
    ; CHECK-LABEL: name: const_i32_1b
    ; CHECK: [[MOV32ri:%[0-9]+]]:gr32 = MOV32ri 1
    ; CHECK: $eax = COPY [[MOV32ri]]
    ; CHECK: RET 0, implicit $eax
    %0(s32) = G_CONSTANT i32 1
    $eax = COPY %0(s32)
    RET 0, implicit $eax
...
---
name:            const_i32_1_optsizeb
legalized:       true
regBankSelected: true
selected:        false
registers:
  - { id: 0, class: gpr }
body:             |
  bb.1 (%ir-block.0):
    ; CHECK-LABEL: name: const_i32_1_optsizeb
    ; CHECK: [[MOV32r1_:%[0-9]+]]:gr32 = MOV32r1 implicit-def $eflags
    ; CHECK: $eax = COPY [[MOV32r1_]]
    ; CHECK: RET 0, implicit $eax
    %0(s32) = G_CONSTANT i32 1
    $eax = COPY %0(s32)
    RET 0, implicit $eax
...
OpenPOWER on IntegriCloud