Skip to content

Commit ef28e9c

Browse files
committed
[Z80] update and add more codegen tests
1 parent 0d9466f commit ef28e9c

3 files changed

Lines changed: 107 additions & 0 deletions

File tree

llvm/test/CodeGen/Z80/cmp-zero-postra.mir

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
12
# RUN: llc -mtriple=ez80 -run-pass=postrapseudos -o - %s | FileCheck %s
23

34
# Check O16/O24 source handling for Cmp16a0/Cmp24a0 pseudo expansion.
@@ -54,3 +55,5 @@ body: |
5455
liveins: $uhl
5556
Cmp24a0 killed $uhl, implicit-def $f, implicit-def dead $uhl
5657
...
58+
## NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
59+
# CHECK: {{.*}}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
2+
; RUN: llc -mtriple=ez80 < %s | FileCheck %s --check-prefix=EZ80
3+
4+
define i8 @extract_mid_byte32(i32 %x) {
5+
; EZ80-LABEL: extract_mid_byte32:
6+
; EZ80: ; %bb.0: ; %entry
7+
; EZ80-NEXT: ld iy, 0
8+
; EZ80-NEXT: add iy, sp
9+
; EZ80-NEXT: ld bc, (iy + 3)
10+
; EZ80-NEXT: ld l, 24
11+
; EZ80-NEXT: ld a, (iy + 6)
12+
; EZ80-NEXT: call __lshru
13+
; EZ80-NEXT: ld a, c
14+
; EZ80-NEXT: ret
15+
entry:
16+
%shr = lshr i32 %x, 24
17+
%res = trunc i32 %shr to i8
18+
ret i8 %res
19+
}
20+
21+
define i8 @extract_mid_byte48(i48 %x) {
22+
; EZ80-LABEL: extract_mid_byte48:
23+
; EZ80: ; %bb.0: ; %entry
24+
; EZ80-NEXT: ld iy, 0
25+
; EZ80-NEXT: add iy, sp
26+
; EZ80-NEXT: ld hl, (iy + 3)
27+
; EZ80-NEXT: ld de, (iy + 6)
28+
; EZ80-NEXT: ld c, 24
29+
; EZ80-NEXT: call __i48shru
30+
; EZ80-NEXT: ld a, l
31+
; EZ80-NEXT: ret
32+
entry:
33+
%shr = lshr i48 %x, 24
34+
%res = trunc i48 %shr to i8
35+
ret i8 %res
36+
}
37+
38+
define i8 @extract_mid_byte64(i64 %x) {
39+
; EZ80-LABEL: extract_mid_byte64:
40+
; EZ80: ; %bb.0: ; %entry
41+
; EZ80-NEXT: ld iy, 0
42+
; EZ80-NEXT: add iy, sp
43+
; EZ80-NEXT: ld hl, (iy + 3)
44+
; EZ80-NEXT: ld de, (iy + 6)
45+
; EZ80-NEXT: ld bc, (iy + 9)
46+
; EZ80-NEXT: ld iy, 24
47+
; EZ80-NEXT: push iy
48+
; EZ80-NEXT: ; kill: def $bc killed $bc killed $ubc
49+
; EZ80-NEXT: call __llshru
50+
; EZ80-NEXT: pop de
51+
; EZ80-NEXT: ld a, l
52+
; EZ80-NEXT: ret
53+
entry:
54+
%shr = lshr i64 %x, 24
55+
%res = trunc i64 %shr to i8
56+
ret i8 %res
57+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# RUN: llc -mtriple=ez80-none-elf -start-after=instruction-select -verify-machineinstrs %s -o - | FileCheck %s
2+
3+
# CHECK-LABEL: _shl_s16_o16:
4+
# CHECK: ld l, e
5+
# CHECK-NEXT: ld h, d
6+
# CHECK-NEXT: add hl, hl
7+
# CHECK-NEXT: add hl, hl
8+
# CHECK-NEXT: add hl, hl
9+
# CHECK-NEXT: add hl, hl
10+
# CHECK-NEXT: add hl, hl
11+
# CHECK-NEXT: ret
12+
13+
--- |
14+
define i16 @shl_s16_o16(i16 %x) {
15+
entry:
16+
ret i16 0
17+
}
18+
19+
...
20+
---
21+
name: shl_s16_o16
22+
alignment: 1
23+
legalized: true
24+
regBankSelected: true
25+
selected: true
26+
tracksRegLiveness: true
27+
registers:
28+
- { id: 0, class: o16, preferred-register: '' }
29+
- { id: 2, class: o16, preferred-register: '' }
30+
- { id: 3, class: a24, preferred-register: '' }
31+
body: |
32+
bb.0.entry:
33+
liveins: $de
34+
35+
%0:o16 = COPY $de
36+
%3:a24 = SUBREG_TO_REG 0, %0, %subreg.sub_short
37+
$uhl = COPY %3
38+
$uhl = ADD24aa $uhl, implicit-def $f
39+
$uhl = ADD24aa $uhl, implicit-def $f
40+
$uhl = ADD24aa $uhl, implicit-def $f
41+
$uhl = ADD24aa $uhl, implicit-def $f
42+
$uhl = ADD24aa $uhl, implicit-def $f
43+
%2:o16 = COPY $hl
44+
$hl = COPY %2
45+
RET24 implicit-def $spl, implicit $spl, implicit $hl
46+
47+
...

0 commit comments

Comments
 (0)