Skip to content

Commit 280f9fd

Browse files
authored
Merge branch 'master' into 12ya-cleanup
2 parents 4e91c16 + 3022628 commit 280f9fd

File tree

3 files changed

+32
-20
lines changed

3 files changed

+32
-20
lines changed

s390x/s390xasm/decode_test.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,6 @@ func TestDecode(t *testing.T) {
3030
}
3131
}
3232

33-
// Provide a fake symbol to verify PCrel argument decoding.
34-
func symlookup(pc uint64) (string, uint64) {
35-
foopc := uint64(0x100000)
36-
if pc >= foopc && pc < foopc+0x10 {
37-
return "foo", foopc
38-
}
39-
return "", 0
40-
}
41-
4233
func decode(data []byte, t *testing.T, filename string) {
4334
all := string(data)
4435
// Simulate PC based on number of instructions found in the test file.

s390x/s390xasm/plan9.go

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ func GoSyntax(inst Inst, pc uint64, symname func(uint64) (string, uint64)) strin
142142
case LRVH:
143143
op = "MOVHBR"
144144
}
145-
case LA, LAY:
145+
case LA, LAY, LARL:
146146
args[0], args[1] = args[1], args[0]
147147
op = "MOVD"
148148

@@ -349,6 +349,17 @@ func GoSyntax(inst Inst, pc uint64, symname func(uint64) (string, uint64)) strin
349349
case SLBGR:
350350
op = "SUBE"
351351
args[0], args[1] = args[1], args[0]
352+
case MADBR:
353+
op = "FMADD"
354+
args[0], args[1], args[2] = args[1], args[2], args[0]
355+
case VFM:
356+
op = "WFMDB"
357+
args[0], args[1], args[2] = args[1], args[2], args[0]
358+
args = args[0:3]
359+
case VFS:
360+
op = "WFSDB"
361+
args[0], args[1], args[2] = args[2], args[1], args[0]
362+
args = args[0:3]
352363
case MSGFR, MHI, MSFI, MSGFI:
353364
switch inst.Op {
354365
case MSGFR, MHI, MSFI:
@@ -500,16 +511,16 @@ func GoSyntax(inst Inst, pc uint64, symname func(uint64) (string, uint64)) strin
500511
if err != nil {
501512
return fmt.Sprintf("GoSyntax: error in converting Atoi:%s", err)
502513
}
503-
opStr, check := branchOnConditionOp(mask, inst.Op)
514+
opStr := branchOnConditionOp(mask, inst.Op)
504515
if opStr != "" {
505516
op = opStr
506517
}
507518
if op == "SYNC" || op == "NOPH" {
508519
return op
509520
}
510-
if check {
511-
args[0] = args[1]
512-
args = args[:1]
521+
if op == "RET" {
522+
args = args[:0]
523+
return op
513524
}
514525
case LOCGR:
515526
mask, err := strconv.Atoi(args[2][1:])
@@ -1036,6 +1047,9 @@ func GoSyntax(inst Inst, pc uint64, symname func(uint64) (string, uint64)) strin
10361047
// branch on relative mnemonic.
10371048
func branch_relative_op(mask int, opconst Op) (op string, check bool) {
10381049
switch mask & 0xf {
1050+
case 1:
1051+
op = "BVS"
1052+
check = true
10391053
case 2:
10401054
op = "BGT"
10411055
check = true
@@ -1061,25 +1075,24 @@ func branch_relative_op(mask int, opconst Op) (op string, check bool) {
10611075
op = "BLEU"
10621076
check = true
10631077
case 15:
1064-
op = "JMP" // BR
1078+
op = "BR"
10651079
check = true
10661080
}
10671081
return op, check
10681082
}
10691083

10701084
// This function returns corresponding extended mnemonic for the given
10711085
// brach on condition mnemonic.
1072-
func branchOnConditionOp(mask int, opconst Op) (op string, check bool) {
1086+
func branchOnConditionOp(mask int, opconst Op) (op string) {
10731087
switch mask & 0xf {
10741088
case 0:
10751089
op = "NOPH"
10761090
case 14:
10771091
op = "SYNC"
10781092
case 15:
1079-
op = "JMP"
1080-
check = true
1093+
op = "RET"
10811094
}
1082-
return op, check
1095+
return op
10831096
}
10841097

10851098
// This function returns corresponding plan9 mnemonic for the native bitwise mnemonic.
@@ -1260,7 +1273,7 @@ func reverseOperandOrder(op Op) bool {
12601273
switch op {
12611274
case LOCR, MLGR:
12621275
return true
1263-
case LTEBR, LTDBR:
1276+
case LTEBR, LTDBR, LCDBR, LGDR:
12641277
return true
12651278
case VLEIB, VLEIH, VLEIF, VLEIG, VPDI:
12661279
return true

s390x/s390xasm/testdata/decode.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
b9e24098| plan9 MOVDLT R8, R9
1515
b9e270ba| plan9 MOVDNE R10, R11
1616
b9f23012| plan9 LOCR $3, R2, R1
17+
b3130020| plan9 LCDBR F0, F2
1718
b9e27065| plan9 MOVDNE R5, R6
1819
e310f0000004| plan9 MOVD (R15), R1
1920
e320f0000014| plan9 MOVW (R15), R2
@@ -122,6 +123,13 @@ c017fffffffe| plan9 XORW $-2, R1
122123
b93a0008| plan9 KDSA R0, R8
123124
b9296024| plan9 KMA R2, R6, R4
124125
b92d6024| plan9 KMCTR R2, R6, R4
126+
b31e0042| plan9 FMADD F4, F2, F0
127+
e748a00830e7| plan9 WFMDB V8, V10, V4
128+
e743000830e2| plan9 WFSDB V0, V3, V4
129+
b3cd0026| plan9 LGDR F6, R2
130+
a7f4008c| plan9 BR 70(PC)
131+
a7140005| plan9 BVS 2(PC)
132+
07fe| plan9 RET
125133
e743400000f3| plan9 VAB V3, V4
126134
e743600000f3| plan9 VAB V3, V6, V4
127135
e743400010f3| plan9 VAH V3, V4

0 commit comments

Comments
 (0)