Skip to content

Commit

Permalink
Enhancement: resolve some disabled unit tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
uxmal committed Aug 19, 2024
1 parent 68f1248 commit ea52d56
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 21 deletions.
2 changes: 2 additions & 0 deletions src/Arch/Arm/AArch32/ArmRewriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,7 @@ public IEnumerator<RtlInstructionCluster> GetEnumerator()
case Mnemonic.vqabs: RewriteVectorBinOp(vqabs_intrinsic); break;
case Mnemonic.vqadd: RewriteVectorBinOp(vqadd_intrinsic); break;
case Mnemonic.vqdmulh: RewriteVectorBinOp(vqdmulh_intrinsic); break;
case Mnemonic.vqrdmulh: RewriteVectorBinOp(vqrdmulh_intrinsic); break;
case Mnemonic.vqrshl: RewriteVectorBinOp(vqrshl_intrinsic); break;
case Mnemonic.vqrshrn: RewriteVectorBinOpNarrow(vqrshrn_intrinsic); break;
case Mnemonic.vqsub: RewriteVectorBinOp(vqsub_intrinsic); break;
Expand Down Expand Up @@ -1500,6 +1501,7 @@ protected virtual void EmitUnitTest(AArch32Instruction instr)
private static readonly IntrinsicProcedure vqabs_intrinsic = IntrinsicBuilder.GenericUnary("__vqabs");
private static readonly IntrinsicProcedure vqadd_intrinsic = IntrinsicBuilder.GenericBinary("__vqadd");
private static readonly IntrinsicProcedure vqdmulh_intrinsic = IntrinsicBuilder.GenericBinary("__vqdmulh");
private static readonly IntrinsicProcedure vqrdmulh_intrinsic = IntrinsicBuilder.GenericBinary("__vqrdmulh");
private static readonly IntrinsicProcedure vqshl_intrinsic = new IntrinsicBuilder("__vqshl", false)
.GenericTypes("TArray")
.Param("TArray")
Expand Down
16 changes: 16 additions & 0 deletions src/Arch/zSeries/zSeriesRewriter.Alu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,22 @@ private void RewriteLl(PrimitiveType dt)
m.Assign(Reg(0), m.Convert(src, src.DataType, arch.WordWidth));
}

private void RewriteLlgt()
{
var tmp = binder.CreateTemporary(Word31);
m.Assign(tmp, m.Slice(Reg(1), tmp.DataType));
m.Assign(Reg(0), m.ExtendZ(tmp, PrimitiveType.Word64));
}

private void RewriteLlhr()
{
var slice = Op(1, PrimitiveType.Word16);
var tmp = binder.CreateTemporary(PrimitiveType.Word32);
m.Assign(tmp, m.ExtendZ(slice, tmp.DataType));
var dst = Reg(0);
m.Assign(dst, m.Dpb(dst, tmp, 0));
}

private void RewriteLli(PrimitiveType dt, int bitOffset)
{
var imm = Imm(1, dt);
Expand Down
4 changes: 4 additions & 0 deletions src/Arch/zSeries/zSeriesRewriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public partial class zSeriesRewriter : IEnumerable<RtlInstructionCluster>
private static readonly PrimitiveType ShortHexFloat = PrimitiveType.Real32;
private static readonly PrimitiveType LongHexFloat = PrimitiveType.Real64;
private static readonly PrimitiveType ExtendedHexFloat = PrimitiveType.Real128;
private static readonly PrimitiveType Word31 = PrimitiveType.CreateWord(31);

private readonly zSeriesArchitecture arch;
private readonly zSeriesIntrinsics intrinsics;
Expand Down Expand Up @@ -244,6 +245,9 @@ public IEnumerator<RtlInstructionCluster> GetEnumerator()
case Mnemonic.llgcr: RewriteLr(PrimitiveType.Byte, PrimitiveType.Word64); break;
case Mnemonic.llgfr: RewriteLr(PrimitiveType.Word32, PrimitiveType.Word64); break;
case Mnemonic.llgfrl: RewriteLl(PrimitiveType.Word32); break;
case Mnemonic.llgtr: RewriteLlgt(); break;
case Mnemonic.llhr: RewriteLlhr(); break;
case Mnemonic.llhrl: RewriteLlhr(); break;
case Mnemonic.llill: RewriteLli(PrimitiveType.Word16, 0); break;
case Mnemonic.lmg: RewriteLmg(); break;
case Mnemonic.lndr: RewriteFNegR(LongHexFloat); break;
Expand Down
1 change: 0 additions & 1 deletion src/UnitTests/Arch/Arm/T32DisassemblerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1595,7 +1595,6 @@ public void ThumbDis_vst4_sparse_writeback()
}

[Test]
[Ignore("New decoder needed?")]
public void ThumbDis_vstmia()
{
AssertCode("@@@", "8AECCA1B");
Expand Down
3 changes: 1 addition & 2 deletions src/UnitTests/Arch/Arm/T32RewriterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7200,13 +7200,12 @@ public void ThumbRw_vsra()
}

[Test]
[Ignore(Categories.FailedTests)]
public void ThumbRw_vqrdmulh()
{
Given_HexString("1DFF099B"); // vqrdmulh.s16 d9, d13, d9
AssertCode(
"0|L--|00100000(4): 1 instructions",
"1|L--|@@@");
"1|L--|d9 = __vqrdmulh<int16[4]>(d13, d9)");
}

[Test]
Expand Down
28 changes: 10 additions & 18 deletions src/UnitTests/Arch/zSeries/zSeriesRewriterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,7 @@
using NUnit.Framework;
using Reko.Arch.zSeries;
using Reko.Core;
using Reko.Core.Configuration;
using Reko.Core.Memory;
using Reko.Core.Rtl;
using System;
using System.Collections.Generic;
using System.ComponentModel.Design;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Reko.UnitTests.Arch.zSeries
{
Expand Down Expand Up @@ -1421,34 +1413,34 @@ public void zSeriesRw_llgfrl()
}

[Test]
[Ignore("S390 instr")]
public void zSeriesRw_llgtr()
{
Given_HexString("B91700AA");
AssertCode( // llgtr r10,r10
"0|L--|00100000(4): 1 instructions",
"1|L--|@@@");
"0|L--|00100000(4): 2 instructions",
"1|L--|v3 = SLICE(r10, word31, 0)",
"2|L--|r10 = CONVERT(v3, word31, word64)");
}


[Test]
[Ignore("S390 instr")]
public void zSeriesRw_llhr()
{
Given_HexString("B9950022");
AssertCode( // llhr r2,r2
"0|L--|00100000(4): 1 instructions",
"1|L--|@@@");
"0|L--|00100000(4): 3 instructions",
"1|L--|v4 = SLICE(r2, word16, 0)",
"2|L--|v5 = CONVERT(v4, word16, word32)",
"3|L--|r2 = SEQ(SLICE(r2, word32, 32), v5)");
}

[Test]
[Ignore("S390 instr")]
public void zSeriesRw_llhrl()
{
Given_HexString("C402E340B130");
AssertCode( // llhrl r0,FFFFFFFFC6817B40
"0|L--|00100000(6): 1 instructions",
"1|L--|@@@");
"0|L--|00100000(6): 2 instructions",
"1|L--|v3 = CONVERT(0xC6916260<p32>, ptr32, word32)",
"2|L--|r0 = SEQ(SLICE(r0, word32, 32), v3)");
}

[Test]
Expand Down

0 comments on commit ea52d56

Please sign in to comment.