diff options
Diffstat (limited to 'src/arch/arm/insts')
-rw-r--r-- | src/arch/arm/insts/pred_inst.hh | 42 |
1 files changed, 34 insertions, 8 deletions
diff --git a/src/arch/arm/insts/pred_inst.hh b/src/arch/arm/insts/pred_inst.hh index d2a9f7080..62d1c09ab 100644 --- a/src/arch/arm/insts/pred_inst.hh +++ b/src/arch/arm/insts/pred_inst.hh @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2012-2013 ARM Limited + * Copyright (c) 2010, 2012-2013, 2017-2018 ARM Limited * All rights reserved * * The license below extends only to copyright in the software and shall @@ -158,25 +158,51 @@ simd_modified_imm(bool op, uint8_t cmode, uint8_t data, bool &immValid, return bigData; } +/** Floating point data types. */ +enum class FpDataType { Fp16, Fp32, Fp64 }; + static inline uint64_t -vfp_modified_imm(uint8_t data, bool wide) +vfp_modified_imm(uint8_t data, FpDataType dtype) { uint64_t bigData = data; uint64_t repData; - if (wide) { - repData = bits(data, 6) ? 0xFF : 0; - bigData = (bits(bigData, 5, 0) << 48) | - (repData << 54) | (bits(~bigData, 6) << 62) | - (bits(bigData, 7) << 63); - } else { + switch (dtype) { + case FpDataType::Fp16: + repData = bits(data, 6) ? 0x3 : 0; + bigData = (bits(bigData, 5, 0) << 6) | + (repData << 12) | (bits(~bigData, 6) << 14) | + (bits(bigData, 7) << 15); + break; + case FpDataType::Fp32: repData = bits(data, 6) ? 0x1F : 0; bigData = (bits(bigData, 5, 0) << 19) | (repData << 25) | (bits(~bigData, 6) << 30) | (bits(bigData, 7) << 31); + break; + case FpDataType::Fp64: + repData = bits(data, 6) ? 0xFF : 0; + bigData = (bits(bigData, 5, 0) << 48) | + (repData << 54) | (bits(~bigData, 6) << 62) | + (bits(bigData, 7) << 63); + break; + default: + assert(0); } return bigData; } +static inline FpDataType +decode_fp_data_type(uint8_t encoding) +{ + switch (encoding) { + case 1: return FpDataType::Fp16; + case 2: return FpDataType::Fp32; + case 3: return FpDataType::Fp64; + default: + panic( + "Invalid floating point data type in VFP/SIMD or SVE instruction"); + } +} /** * Base class for predicated integer operations. |