Skip to content

Commit

Permalink
[SystemZ] Add missing (dis-)assembly tests. (#88498)
Browse files Browse the repository at this point in the history
### Assembly Tests
This adds assembly tests for 
```
lcdfr, lndfr, lpdfr
```

### Disassembly Tests
This also adds a number of disassembly tests for the following
menmonics:
```
cgit, cgrt, cit, clfit, clgit, clgrt, clgt, clrt, clt, crt, lcdfr, lndfr, lpdfr
```
For `cutfu` / `cu12`, it also adds a check for bad register choice.
  • Loading branch information
dominik-steenken authored Apr 12, 2024
1 parent 6f1e23b commit b614e5b
Show file tree
Hide file tree
Showing 3 changed files with 133 additions and 0 deletions.
96 changes: 96 additions & 0 deletions llvm/test/MC/Disassembler/SystemZ/insns.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2956,6 +2956,12 @@
# CHECK: cgib %r0, 0, 15, 0
0xec 0x0f 0x00 0x00 0x00 0xfc

# CHECK: cgit %r0, 0, 0
0xec 0x00 0x00 0x00 0x00 0x70

# CHECK: cgit %r0, 0, 15
0xec 0x00 0x00 0x00 0xf0 0x70

# CHECK: cgith %r0, 0
0xec 0x00 0x00 0x00 0x20 0x70

Expand Down Expand Up @@ -3052,6 +3058,12 @@
# CHECK: cgrb %r0, %r0, 15, 0
0xec 0x00 0x00 0x00 0xf0 0xe4

# CHECK: cgrt %r0, %r1, 0
0xb9 0x60 0x00 0x01

# CHECK: cgrt %r0, %r1, 15
0xb9 0x60 0xf0 0x01

# CHECK: cgrth %r0, %r1
0xb9 0x60 0x20 0x01

Expand Down Expand Up @@ -3430,6 +3442,12 @@
# CHECK: cih %r15, 0
0xcc 0xfd 0x00 0x00 0x00 0x00

# CHECK: cit %r0, 0, 0
0xec 0x00 0x00 0x00 0x00 0x72

# CHECK: cit %r0, 0, 15
0xec 0x00 0x00 0x00 0xf0 0x72

# CHECK: cith %r0, 0
0xec 0x00 0x00 0x00 0x20 0x72

Expand Down Expand Up @@ -3862,6 +3880,12 @@
# CHECK: clfi %r15, 0
0xc2 0xff 0x00 0x00 0x00 0x00

# CHECK: clfit %r0, 0, 0
0xec 0x00 0x00 0x00 0x00 0x73

# CHECK: clfit %r0, 0, 15
0xec 0x00 0x00 0x00 0xf0 0x73

# CHECK: clfith %r0, 0
0xec 0x00 0x00 0x00 0x20 0x73

Expand Down Expand Up @@ -3910,6 +3934,12 @@
# CHECK: clg %r15, 0
0xe3 0xf0 0x00 0x00 0x00 0x21

# CHECK: clgit %r0, 0, 0
0xec 0x00 0x00 0x00 0x00 0x71

# CHECK: clgit %r0, 0, 15
0xec 0x00 0x00 0x00 0xf0 0x71

# CHECK: clgith %r0, 0
0xec 0x00 0x00 0x00 0x20 0x71

Expand Down Expand Up @@ -4447,6 +4477,12 @@
# CHECK: clrb %r0, %r0, 15, 0
0xec 0x00 0x00 0x00 0xf0 0xf7

# CHECK: clgrt %r0, %r1, 0
0xb9 0x61 0x00 0x01

# CHECK: clgrt %r0, %r1, 15
0xb9 0x61 0xf0 0x01

# CHECK: clgrth %r0, %r1
0xb9 0x61 0x20 0x01

Expand All @@ -4465,6 +4501,12 @@
# CHECK: clgrtle %r0, %r1
0xb9 0x61 0xc0 0x01

# CHECK: clrt %r0, %r1, 0
0xb9 0x73 0x00 0x01

# CHECK: clrt %r0, %r1, 15
0xb9 0x73 0xf0 0x01

# CHECK: clrth %r0, %r1
0xb9 0x73 0x20 0x01

Expand All @@ -4483,6 +4525,12 @@
# CHECK: clrtle %r0, %r1
0xb9 0x73 0xc0 0x01

# CHECK: clt %r0, 0, -524288
0xeb 0x00 0x00 0x00 0x80 0x23

# CHECK: clt %r0, 15, 32768
0xeb 0x0f 0x00 0x00 0x08 0x23

# CHECK: clth %r0, -524288
0xeb 0x02 0x00 0x00 0x80 0x23

Expand Down Expand Up @@ -4525,6 +4573,12 @@
# CHECK: cltle %r1, 0
0xeb 0x1c 0x00 0x00 0x00 0x23

# CHECK: clgt %r0, 0, -524288
0xeb 0x00 0x00 0x00 0x80 0x2b

# CHECK: clgt %r0, 15, 32768
0xeb 0x0f 0x00 0x00 0x08 0x2b

# CHECK: clgth %r0, -524288
0xeb 0x02 0x00 0x00 0x80 0x2b

Expand Down Expand Up @@ -4792,6 +4846,12 @@
# CHECK: crdte %r4, %r5, %r6, 7
0xb9 0x8f 0x57 0x46

# CHECK: crt %r0, %r1, 0
0xb9 0x72 0x00 0x01

# CHECK: crt %r0, %r1, 15
0xb9 0x72 0xf0 0x01

# CHECK: crth %r0, %r1
0xb9 0x72 0x20 0x01

Expand Down Expand Up @@ -7972,6 +8032,18 @@
# CHECK: lcdbr %f15, %f9
0xb3 0x13 0x00 0xf9

# CHECK: lcdfr %f0, %f9
0xb3 0x73 0x00 0x09

# CHECK: lcdfr %f0, %f15
0xb3 0x73 0x00 0x0f

# CHECK: lcdfr %f15, %f0
0xb3 0x73 0x00 0xf0

# CHECK: lcdfr %f15, %f9
0xb3 0x73 0x00 0xf9

# CHECK: lcdr %f0, %f9
0x23 0x09

Expand Down Expand Up @@ -9570,6 +9642,18 @@
# CHECK: lndbr %f15, %f9
0xb3 0x11 0x00 0xf9

# CHECK: lndfr %f0, %f9
0xb3 0x71 0x00 0x09

# CHECK: lndfr %f0, %f15
0xb3 0x71 0x00 0x0f

# CHECK: lndfr %f15, %f0
0xb3 0x71 0x00 0xf0

# CHECK: lndfr %f15, %f9
0xb3 0x71 0x00 0xf9

# CHECK: lndr %f0, %f9
0x21 0x09

Expand Down Expand Up @@ -9909,6 +9993,18 @@
# CHECK: lpdbr %f15, %f9
0xb3 0x10 0x00 0xf9

# CHECK: lpdfr %f0, %f9
0xb3 0x70 0x00 0x09

# CHECK: lpdfr %f0, %f15
0xb3 0x70 0x00 0x0f

# CHECK: lpdfr %f15, %f0
0xb3 0x70 0x00 0xf0

# CHECK: lpdfr %f15, %f9
0xb3 0x70 0x00 0xf9

# CHECK: lpdg %r0, 0, 0
0xc8 0x05 0x00 0x00 0x00 0x00

Expand Down
7 changes: 7 additions & 0 deletions llvm/test/MC/Disassembler/SystemZ/invalid-regs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,10 @@
# CHECK-NEXT: 0xb9 0x97 0x00 0x18
# CHECK-NEXT: ^
0xb9 0x97 0x00 0x18

# This would be "cutfu %r1, %r2", but %r1 is invalid.
#
# CHECK-NEXT: warning: invalid instruction encoding
# CHECK-NEXT: 0xb2 0xa7 0x00 0x12
# CHECK-NEXT: ^
0xb2 0xa7 0x00 0x12
30 changes: 30 additions & 0 deletions llvm/test/MC/SystemZ/insn-good.s
Original file line number Diff line number Diff line change
Expand Up @@ -9038,6 +9038,36 @@
lcdbr %f15,%f0
lcdbr %f15,%f9

#CHECK: lcdfr %f0, %f9 # encoding: [0xb3,0x73,0x00,0x09]
#CHECK: lcdfr %f0, %f15 # encoding: [0xb3,0x73,0x00,0x0f]
#CHECK: lcdfr %f15, %f0 # encoding: [0xb3,0x73,0x00,0xf0]
#CHECK: lcdfr %f15, %f9 # encoding: [0xb3,0x73,0x00,0xf9]

lcdfr %f0,%f9
lcdfr %f0,%f15
lcdfr %f15,%f0
lcdfr %f15,%f9

#CHECK: lndfr %f0, %f9 # encoding: [0xb3,0x71,0x00,0x09]
#CHECK: lndfr %f0, %f15 # encoding: [0xb3,0x71,0x00,0x0f]
#CHECK: lndfr %f15, %f0 # encoding: [0xb3,0x71,0x00,0xf0]
#CHECK: lndfr %f15, %f9 # encoding: [0xb3,0x71,0x00,0xf9]

lndfr %f0,%f9
lndfr %f0,%f15
lndfr %f15,%f0
lndfr %f15,%f9

#CHECK: lpdfr %f0, %f9 # encoding: [0xb3,0x70,0x00,0x09]
#CHECK: lpdfr %f0, %f15 # encoding: [0xb3,0x70,0x00,0x0f]
#CHECK: lpdfr %f15, %f0 # encoding: [0xb3,0x70,0x00,0xf0]
#CHECK: lpdfr %f15, %f9 # encoding: [0xb3,0x70,0x00,0xf9]

lpdfr %f0,%f9
lpdfr %f0,%f15
lpdfr %f15,%f0
lpdfr %f15,%f9

#CHECK: lcdr %f0, %f9 # encoding: [0x23,0x09]
#CHECK: lcdr %f0, %f15 # encoding: [0x23,0x0f]
#CHECK: lcdr %f15, %f0 # encoding: [0x23,0xf0]
Expand Down

0 comments on commit b614e5b

Please sign in to comment.