1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2# RUN: llc -mtriple=i586-linux-gnu -mcpu=haswell -mattr=-slow-incdec -run-pass=instruction-select %s -o - | FileCheck %s --check-prefix=CHECK
3#
4# This is necessary to test that attribute-based rule predicates work and that
5# they properly reset between functions.
6
7--- |
8  define i32 @const_i32_1() {
9    ret i32 1
10  }
11
12  define i32 @const_i32_1_optsize() #0 {
13    ret i32 1
14  }
15
16  define i32 @const_i32_1b() {
17    ret i32 1
18  }
19
20  define i32 @const_i32_1_optsizeb() #0 {
21    ret i32 1
22  }
23
24  attributes #0 = { optsize }
25...
26---
27name:            const_i32_1
28legalized:       true
29regBankSelected: true
30selected:        false
31registers:
32  - { id: 0, class: gpr }
33body:             |
34  bb.1 (%ir-block.0):
35    ; CHECK-LABEL: name: const_i32_1
36    ; CHECK: [[MOV32ri:%[0-9]+]]:gr32 = MOV32ri 1
37    ; CHECK: $eax = COPY [[MOV32ri]]
38    ; CHECK: RET 0, implicit $eax
39    %0(s32) = G_CONSTANT i32 1
40    $eax = COPY %0(s32)
41    RET 0, implicit $eax
42...
43---
44name:            const_i32_1_optsize
45legalized:       true
46regBankSelected: true
47selected:        false
48registers:
49  - { id: 0, class: gpr }
50body:             |
51  bb.1 (%ir-block.0):
52    ; CHECK-LABEL: name: const_i32_1_optsize
53    ; CHECK: [[MOV32r1_:%[0-9]+]]:gr32 = MOV32r1 implicit-def $eflags
54    ; CHECK: $eax = COPY [[MOV32r1_]]
55    ; CHECK: RET 0, implicit $eax
56    %0(s32) = G_CONSTANT i32 1
57    $eax = COPY %0(s32)
58    RET 0, implicit $eax
59...
60---
61name:            const_i32_1b
62legalized:       true
63regBankSelected: true
64selected:        false
65registers:
66  - { id: 0, class: gpr }
67body:             |
68  bb.1 (%ir-block.0):
69    ; CHECK-LABEL: name: const_i32_1b
70    ; CHECK: [[MOV32ri:%[0-9]+]]:gr32 = MOV32ri 1
71    ; CHECK: $eax = COPY [[MOV32ri]]
72    ; CHECK: RET 0, implicit $eax
73    %0(s32) = G_CONSTANT i32 1
74    $eax = COPY %0(s32)
75    RET 0, implicit $eax
76...
77---
78name:            const_i32_1_optsizeb
79legalized:       true
80regBankSelected: true
81selected:        false
82registers:
83  - { id: 0, class: gpr }
84body:             |
85  bb.1 (%ir-block.0):
86    ; CHECK-LABEL: name: const_i32_1_optsizeb
87    ; CHECK: [[MOV32r1_:%[0-9]+]]:gr32 = MOV32r1 implicit-def $eflags
88    ; CHECK: $eax = COPY [[MOV32r1_]]
89    ; CHECK: RET 0, implicit $eax
90    %0(s32) = G_CONSTANT i32 1
91    $eax = COPY %0(s32)
92    RET 0, implicit $eax
93...
94