2017-10-19 07:33:31 +08:00
|
|
|
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
|
2018-05-06 05:19:59 +08:00
|
|
|
# RUN: llc -mtriple=x86_64-linux-gnu -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s --check-prefix=CHECK
|
2017-04-12 20:54:54 +08:00
|
|
|
|
|
|
|
--- |
|
|
|
|
define i8 @const_i8() {
|
|
|
|
ret i8 2
|
|
|
|
}
|
|
|
|
|
|
|
|
define i16 @const_i16() {
|
|
|
|
ret i16 3
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @const_i32() {
|
|
|
|
ret i32 4
|
|
|
|
}
|
|
|
|
|
2017-06-28 20:43:21 +08:00
|
|
|
define i32 @const_i32_0() {
|
|
|
|
ret i32 0
|
|
|
|
}
|
|
|
|
|
2017-04-12 20:54:54 +08:00
|
|
|
define i64 @const_i64() {
|
|
|
|
ret i64 68719476720
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @const_i64_u32() {
|
|
|
|
ret i64 1879048192
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @const_i64_i32() {
|
|
|
|
ret i64 -1
|
|
|
|
}
|
|
|
|
|
2017-07-03 19:06:54 +08:00
|
|
|
define void @main(i32** %data) {
|
|
|
|
store i32* null, i32** %data, align 8
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2017-04-12 20:54:54 +08:00
|
|
|
...
|
|
|
|
---
|
|
|
|
name: const_i8
|
|
|
|
legalized: true
|
|
|
|
regBankSelected: true
|
|
|
|
selected: false
|
|
|
|
registers:
|
|
|
|
- { id: 0, class: gpr }
|
|
|
|
body: |
|
|
|
|
bb.1 (%ir-block.0):
|
2017-10-19 07:33:31 +08:00
|
|
|
; CHECK-LABEL: name: const_i8
|
2017-10-25 02:04:54 +08:00
|
|
|
; CHECK: [[MOV8ri:%[0-9]+]]:gr8 = MOV8ri 2
|
2018-02-01 06:04:26 +08:00
|
|
|
; CHECK: $al = COPY [[MOV8ri]]
|
|
|
|
; CHECK: RET 0, implicit $al
|
2017-04-12 20:54:54 +08:00
|
|
|
%0(s8) = G_CONSTANT i8 2
|
2018-02-01 06:04:26 +08:00
|
|
|
$al = COPY %0(s8)
|
|
|
|
RET 0, implicit $al
|
2017-04-12 20:54:54 +08:00
|
|
|
|
|
|
|
...
|
|
|
|
---
|
|
|
|
name: const_i16
|
|
|
|
legalized: true
|
|
|
|
regBankSelected: true
|
|
|
|
selected: false
|
|
|
|
registers:
|
|
|
|
- { id: 0, class: gpr }
|
|
|
|
body: |
|
|
|
|
bb.1 (%ir-block.0):
|
2017-10-19 07:33:31 +08:00
|
|
|
; CHECK-LABEL: name: const_i16
|
2017-10-25 02:04:54 +08:00
|
|
|
; CHECK: [[MOV16ri:%[0-9]+]]:gr16 = MOV16ri 3
|
2018-02-01 06:04:26 +08:00
|
|
|
; CHECK: $ax = COPY [[MOV16ri]]
|
|
|
|
; CHECK: RET 0, implicit $ax
|
2017-04-12 20:54:54 +08:00
|
|
|
%0(s16) = G_CONSTANT i16 3
|
2018-02-01 06:04:26 +08:00
|
|
|
$ax = COPY %0(s16)
|
|
|
|
RET 0, implicit $ax
|
2017-04-12 20:54:54 +08:00
|
|
|
|
|
|
|
...
|
|
|
|
---
|
|
|
|
name: const_i32
|
|
|
|
legalized: true
|
|
|
|
regBankSelected: true
|
|
|
|
selected: false
|
|
|
|
registers:
|
|
|
|
- { id: 0, class: gpr }
|
|
|
|
body: |
|
|
|
|
bb.1 (%ir-block.0):
|
2017-10-19 07:33:31 +08:00
|
|
|
; CHECK-LABEL: name: const_i32
|
2017-10-25 02:04:54 +08:00
|
|
|
; CHECK: [[MOV32ri:%[0-9]+]]:gr32 = MOV32ri 4
|
2018-02-01 06:04:26 +08:00
|
|
|
; CHECK: $eax = COPY [[MOV32ri]]
|
|
|
|
; CHECK: RET 0, implicit $eax
|
2017-04-12 20:54:54 +08:00
|
|
|
%0(s32) = G_CONSTANT i32 4
|
2018-02-01 06:04:26 +08:00
|
|
|
$eax = COPY %0(s32)
|
|
|
|
RET 0, implicit $eax
|
2017-04-12 20:54:54 +08:00
|
|
|
|
2017-06-28 20:43:21 +08:00
|
|
|
...
|
|
|
|
---
|
|
|
|
name: const_i32_0
|
|
|
|
legalized: true
|
|
|
|
regBankSelected: true
|
|
|
|
registers:
|
|
|
|
- { id: 0, class: gpr }
|
|
|
|
body: |
|
|
|
|
bb.1 (%ir-block.0):
|
2017-10-19 07:33:31 +08:00
|
|
|
; CHECK-LABEL: name: const_i32_0
|
2018-02-01 06:04:26 +08:00
|
|
|
; CHECK: [[MOV32r0_:%[0-9]+]]:gr32 = MOV32r0 implicit-def $eflags
|
|
|
|
; CHECK: $eax = COPY [[MOV32r0_]]
|
|
|
|
; CHECK: RET 0, implicit $eax
|
2017-06-28 20:43:21 +08:00
|
|
|
%0(s32) = G_CONSTANT i32 0
|
2018-02-01 06:04:26 +08:00
|
|
|
$eax = COPY %0(s32)
|
|
|
|
RET 0, implicit $eax
|
2017-06-28 20:43:21 +08:00
|
|
|
|
2017-04-12 20:54:54 +08:00
|
|
|
...
|
|
|
|
---
|
|
|
|
name: const_i64
|
|
|
|
legalized: true
|
|
|
|
regBankSelected: true
|
|
|
|
selected: false
|
|
|
|
registers:
|
|
|
|
- { id: 0, class: gpr }
|
|
|
|
body: |
|
|
|
|
bb.1 (%ir-block.0):
|
2017-10-19 07:33:31 +08:00
|
|
|
; CHECK-LABEL: name: const_i64
|
2017-10-25 02:04:54 +08:00
|
|
|
; CHECK: [[MOV64ri:%[0-9]+]]:gr64 = MOV64ri 68719476720
|
2018-02-01 06:04:26 +08:00
|
|
|
; CHECK: $rax = COPY [[MOV64ri]]
|
|
|
|
; CHECK: RET 0, implicit $rax
|
2017-04-12 20:54:54 +08:00
|
|
|
%0(s64) = G_CONSTANT i64 68719476720
|
2018-02-01 06:04:26 +08:00
|
|
|
$rax = COPY %0(s64)
|
|
|
|
RET 0, implicit $rax
|
2017-04-12 20:54:54 +08:00
|
|
|
|
|
|
|
...
|
|
|
|
---
|
|
|
|
name: const_i64_u32
|
|
|
|
alignment: 4
|
|
|
|
legalized: true
|
|
|
|
regBankSelected: true
|
|
|
|
selected: false
|
|
|
|
registers:
|
|
|
|
- { id: 0, class: gpr }
|
|
|
|
body: |
|
|
|
|
bb.1 (%ir-block.0):
|
2017-10-19 07:33:31 +08:00
|
|
|
; CHECK-LABEL: name: const_i64_u32
|
2017-10-25 02:04:54 +08:00
|
|
|
; CHECK: [[MOV64ri32_:%[0-9]+]]:gr64 = MOV64ri32 1879048192
|
2018-02-01 06:04:26 +08:00
|
|
|
; CHECK: $rax = COPY [[MOV64ri32_]]
|
|
|
|
; CHECK: RET 0, implicit $rax
|
2017-04-12 20:54:54 +08:00
|
|
|
%0(s64) = G_CONSTANT i64 1879048192
|
2018-02-01 06:04:26 +08:00
|
|
|
$rax = COPY %0(s64)
|
|
|
|
RET 0, implicit $rax
|
2017-04-12 20:54:54 +08:00
|
|
|
|
|
|
|
...
|
|
|
|
---
|
|
|
|
name: const_i64_i32
|
|
|
|
legalized: true
|
|
|
|
regBankSelected: true
|
|
|
|
selected: false
|
|
|
|
registers:
|
|
|
|
- { id: 0, class: gpr }
|
|
|
|
body: |
|
|
|
|
bb.1 (%ir-block.0):
|
2017-10-19 07:33:31 +08:00
|
|
|
; CHECK-LABEL: name: const_i64_i32
|
2017-10-25 02:04:54 +08:00
|
|
|
; CHECK: [[MOV64ri32_:%[0-9]+]]:gr64 = MOV64ri32 -1
|
2018-02-01 06:04:26 +08:00
|
|
|
; CHECK: $rax = COPY [[MOV64ri32_]]
|
|
|
|
; CHECK: RET 0, implicit $rax
|
2017-04-12 20:54:54 +08:00
|
|
|
%0(s64) = G_CONSTANT i64 -1
|
2018-02-01 06:04:26 +08:00
|
|
|
$rax = COPY %0(s64)
|
|
|
|
RET 0, implicit $rax
|
2017-04-12 20:54:54 +08:00
|
|
|
|
|
|
|
...
|
2017-07-03 19:06:54 +08:00
|
|
|
---
|
|
|
|
name: main
|
|
|
|
alignment: 4
|
|
|
|
legalized: true
|
|
|
|
regBankSelected: true
|
|
|
|
registers:
|
|
|
|
- { id: 0, class: gpr, preferred-register: '' }
|
|
|
|
- { id: 1, class: gpr, preferred-register: '' }
|
|
|
|
body: |
|
|
|
|
bb.1 (%ir-block.0):
|
2018-02-01 06:04:26 +08:00
|
|
|
liveins: $rdi
|
2017-07-03 19:06:54 +08:00
|
|
|
|
2017-10-19 07:33:31 +08:00
|
|
|
; CHECK-LABEL: name: main
|
2018-02-01 06:04:26 +08:00
|
|
|
; CHECK: [[COPY:%[0-9]+]]:gr64 = COPY $rdi
|
2017-10-25 02:04:54 +08:00
|
|
|
; CHECK: [[MOV64ri32_:%[0-9]+]]:gr64 = MOV64ri32 0
|
2018-02-01 06:04:26 +08:00
|
|
|
; CHECK: MOV64mr [[COPY]], 1, $noreg, 0, $noreg, [[MOV64ri32_]] :: (store 8 into %ir.data)
|
2017-10-19 07:33:31 +08:00
|
|
|
; CHECK: RET 0
|
2018-02-01 06:04:26 +08:00
|
|
|
%0(p0) = COPY $rdi
|
2017-07-03 19:06:54 +08:00
|
|
|
%1(p0) = G_CONSTANT i64 0
|
|
|
|
G_STORE %1(p0), %0(p0) :: (store 8 into %ir.data)
|
|
|
|
RET 0
|
|
|
|
|
|
|
|
...
|