From aa05e5401c37c7e60f28e13f8e6de5c5f74e904d Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Wed, 2 Jun 2010 12:58:15 -0500 Subject: ARM: Implement the floating/fixed point VCVT instructions. --- src/arch/arm/isa/formats/fp.isa | 84 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 80 insertions(+), 4 deletions(-) (limited to 'src/arch/arm/isa/formats') diff --git a/src/arch/arm/isa/formats/fp.isa b/src/arch/arm/isa/formats/fp.isa index e553b180d..3d40caf9e 100644 --- a/src/arch/arm/isa/formats/fp.isa +++ b/src/arch/arm/isa/formats/fp.isa @@ -683,9 +683,47 @@ let {{ } } case 0xa: + { + const bool half = (bits(machInst, 7) == 0); + const uint32_t imm = bits(machInst, 5) | + (bits(machInst, 3, 0) << 1); + const uint32_t size = + (bits(machInst, 7) == 0 ? 16 : 32) - imm; + if (single) { + if (half) { + return new VcvtSHFixedFpS(machInst, vd, vd, size); + } else { + return new VcvtSFixedFpS(machInst, vd, vd, size); + } + } else { + if (half) { + return new VcvtSHFixedFpD(machInst, vd, vd, size); + } else { + return new VcvtSFixedFpD(machInst, vd, vd, size); + } + } + } case 0xb: - // Between FP and fixed point. - return new WarnUnimplemented("vcvt", machInst); + { + const bool half = (bits(machInst, 7) == 0); + const uint32_t imm = bits(machInst, 5) | + (bits(machInst, 3, 0) << 1); + const uint32_t size = + (bits(machInst, 7) == 0 ? 16 : 32) - imm; + if (single) { + if (half) { + return new VcvtUHFixedFpS(machInst, vd, vd, size); + } else { + return new VcvtUFixedFpS(machInst, vd, vd, size); + } + } else { + if (half) { + return new VcvtUHFixedFpD(machInst, vd, vd, size); + } else { + return new VcvtUFixedFpD(machInst, vd, vd, size); + } + } + } case 0xc: if (single) { return new VcvtFpUIntS(machInst, vd, vm); @@ -703,9 +741,47 @@ let {{ return new VcvtFpSIntD(machInst, vd, vm); } case 0xe: + { + const bool half = (bits(machInst, 7) == 0); + const uint32_t imm = bits(machInst, 5) | + (bits(machInst, 3, 0) << 1); + const uint32_t size = + (bits(machInst, 7) == 0 ? 16 : 32) - imm; + if (single) { + if (half) { + return new VcvtFpSHFixedS(machInst, vd, vd, size); + } else { + return new VcvtFpSFixedS(machInst, vd, vd, size); + } + } else { + if (half) { + return new VcvtFpSHFixedD(machInst, vd, vd, size); + } else { + return new VcvtFpSFixedD(machInst, vd, vd, size); + } + } + } case 0xf: - // Between FP and fixed point. - return new WarnUnimplemented("vcvt", machInst); + { + const bool half = (bits(machInst, 7) == 0); + const uint32_t imm = bits(machInst, 5) | + (bits(machInst, 3, 0) << 1); + const uint32_t size = + (bits(machInst, 7) == 0 ? 16 : 32) - imm; + if (single) { + if (half) { + return new VcvtFpUHFixedS(machInst, vd, vd, size); + } else { + return new VcvtFpUFixedS(machInst, vd, vd, size); + } + } else { + if (half) { + return new VcvtFpUHFixedD(machInst, vd, vd, size); + } else { + return new VcvtFpUFixedD(machInst, vd, vd, size); + } + } + } } break; } -- cgit v1.2.3