pub trait InstructionFrequencies {
const END_FUNC: u16 = 55; const CALL: u16 = 1510;
const INT_ADD: u16 = 1510; const INT_SUB: u16 = 1510; const INT_MUL: u16 = 1510; const INT_MUL_HIGH: u16 = 1510; const INT_MUL_HIGH_UNSIGNED: u16 = 1510; const INT_NEG: u16 = 1510; const INT_ABS: u16 = 1510; const INT_INC: u16 = 1510; const INT_DEC: u16 = 1510; const INT_MIN: u16 = 1510; const INT_MAX: u16 = 1510;
const BIT_OR: u16 = 1510; const BIT_AND: u16 = 1510; const BIT_XOR: u16 = 3020; const BIT_NOT: u16 = 1510; const BIT_SHIFT_L: u16 = 1510; const BIT_SHIFT_R: u16 = 1510; const BIT_ROT_L: u16 = 1510; const BIT_ROT_R: u16 = 1510; const BIT_SELECT: u16 = 1510; const BIT_POPCNT: u16 = 1510; const BIT_REVERSE: u16 = 1510;
const BRANCH_CMP: u16 = 1966; const BRANCH_ZERO: u16 = 655; const BRANCH_NON_ZERO: u16 = 655;
const MEM_LOAD: u16 = 8234; const INPUT_LOAD: u16 = 8235; const MEM_STORE: u16 = 4748; const OUTPUT_STORE: u16 = 4748;
fn sum_delta() -> i32 {
(1 << 16)
- (i32::from(Self::END_FUNC)
+ i32::from(Self::CALL)
+ i32::from(Self::INT_ADD)
+ i32::from(Self::INT_SUB)
+ i32::from(Self::INT_MUL)
+ i32::from(Self::INT_MUL_HIGH)
+ i32::from(Self::INT_MUL_HIGH_UNSIGNED)
+ i32::from(Self::INT_NEG)
+ i32::from(Self::INT_ABS)
+ i32::from(Self::INT_INC)
+ i32::from(Self::INT_DEC)
+ i32::from(Self::INT_MIN)
+ i32::from(Self::INT_MAX)
+ i32::from(Self::BIT_OR)
+ i32::from(Self::BIT_AND)
+ i32::from(Self::BIT_XOR)
+ i32::from(Self::BIT_NOT)
+ i32::from(Self::BIT_SHIFT_L)
+ i32::from(Self::BIT_SHIFT_R)
+ i32::from(Self::BIT_ROT_L)
+ i32::from(Self::BIT_ROT_R)
+ i32::from(Self::BIT_SELECT)
+ i32::from(Self::BIT_POPCNT)
+ i32::from(Self::BIT_REVERSE)
+ i32::from(Self::BRANCH_CMP)
+ i32::from(Self::BRANCH_ZERO)
+ i32::from(Self::BRANCH_NON_ZERO)
+ i32::from(Self::MEM_LOAD)
+ i32::from(Self::INPUT_LOAD)
+ i32::from(Self::MEM_STORE)
+ i32::from(Self::OUTPUT_STORE))
}
}
pub struct DefaultFrequencies(());
impl InstructionFrequencies for DefaultFrequencies {}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn validate_default_sum() {
assert_eq!(DefaultFrequencies::sum_delta(), 0);
}
}