11cb0ef41Sopenharmony_ci// Copyright 2015 the V8 project authors. All rights reserved. 21cb0ef41Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be 31cb0ef41Sopenharmony_ci// found in the LICENSE file. 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_ci#include "src/compiler/backend/code-generator.h" 61cb0ef41Sopenharmony_ci#include "src/compiler/backend/instruction-scheduler.h" 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_cinamespace v8 { 91cb0ef41Sopenharmony_cinamespace internal { 101cb0ef41Sopenharmony_cinamespace compiler { 111cb0ef41Sopenharmony_ci 121cb0ef41Sopenharmony_cibool InstructionScheduler::SchedulerSupported() { return true; } 131cb0ef41Sopenharmony_ci 141cb0ef41Sopenharmony_ciint InstructionScheduler::GetTargetInstructionFlags( 151cb0ef41Sopenharmony_ci const Instruction* instr) const { 161cb0ef41Sopenharmony_ci switch (instr->arch_opcode()) { 171cb0ef41Sopenharmony_ci case kMipsAbsD: 181cb0ef41Sopenharmony_ci case kMipsAbsS: 191cb0ef41Sopenharmony_ci case kMipsAdd: 201cb0ef41Sopenharmony_ci case kMipsAddD: 211cb0ef41Sopenharmony_ci case kMipsAddOvf: 221cb0ef41Sopenharmony_ci case kMipsAddPair: 231cb0ef41Sopenharmony_ci case kMipsAddS: 241cb0ef41Sopenharmony_ci case kMipsAnd: 251cb0ef41Sopenharmony_ci case kMipsByteSwap32: 261cb0ef41Sopenharmony_ci case kMipsCeilWD: 271cb0ef41Sopenharmony_ci case kMipsCeilWS: 281cb0ef41Sopenharmony_ci case kMipsClz: 291cb0ef41Sopenharmony_ci case kMipsCmp: 301cb0ef41Sopenharmony_ci case kMipsCmpD: 311cb0ef41Sopenharmony_ci case kMipsCmpS: 321cb0ef41Sopenharmony_ci case kMipsCtz: 331cb0ef41Sopenharmony_ci case kMipsCvtDS: 341cb0ef41Sopenharmony_ci case kMipsCvtDUw: 351cb0ef41Sopenharmony_ci case kMipsCvtDW: 361cb0ef41Sopenharmony_ci case kMipsCvtSD: 371cb0ef41Sopenharmony_ci case kMipsCvtSUw: 381cb0ef41Sopenharmony_ci case kMipsCvtSW: 391cb0ef41Sopenharmony_ci case kMipsDiv: 401cb0ef41Sopenharmony_ci case kMipsDivD: 411cb0ef41Sopenharmony_ci case kMipsDivS: 421cb0ef41Sopenharmony_ci case kMipsDivU: 431cb0ef41Sopenharmony_ci case kMipsExt: 441cb0ef41Sopenharmony_ci case kMipsF64x2Abs: 451cb0ef41Sopenharmony_ci case kMipsF64x2Neg: 461cb0ef41Sopenharmony_ci case kMipsF64x2Sqrt: 471cb0ef41Sopenharmony_ci case kMipsF64x2Add: 481cb0ef41Sopenharmony_ci case kMipsF64x2Sub: 491cb0ef41Sopenharmony_ci case kMipsF64x2Mul: 501cb0ef41Sopenharmony_ci case kMipsF64x2Div: 511cb0ef41Sopenharmony_ci case kMipsF64x2Min: 521cb0ef41Sopenharmony_ci case kMipsF64x2Max: 531cb0ef41Sopenharmony_ci case kMipsF64x2Eq: 541cb0ef41Sopenharmony_ci case kMipsF64x2Ne: 551cb0ef41Sopenharmony_ci case kMipsF64x2Lt: 561cb0ef41Sopenharmony_ci case kMipsF64x2Le: 571cb0ef41Sopenharmony_ci case kMipsF64x2Splat: 581cb0ef41Sopenharmony_ci case kMipsF64x2ExtractLane: 591cb0ef41Sopenharmony_ci case kMipsF64x2ReplaceLane: 601cb0ef41Sopenharmony_ci case kMipsF64x2Pmin: 611cb0ef41Sopenharmony_ci case kMipsF64x2Pmax: 621cb0ef41Sopenharmony_ci case kMipsF64x2Ceil: 631cb0ef41Sopenharmony_ci case kMipsF64x2Floor: 641cb0ef41Sopenharmony_ci case kMipsF64x2Trunc: 651cb0ef41Sopenharmony_ci case kMipsF64x2NearestInt: 661cb0ef41Sopenharmony_ci case kMipsF64x2ConvertLowI32x4S: 671cb0ef41Sopenharmony_ci case kMipsF64x2ConvertLowI32x4U: 681cb0ef41Sopenharmony_ci case kMipsF64x2PromoteLowF32x4: 691cb0ef41Sopenharmony_ci case kMipsI64x2Add: 701cb0ef41Sopenharmony_ci case kMipsI64x2Sub: 711cb0ef41Sopenharmony_ci case kMipsI64x2Mul: 721cb0ef41Sopenharmony_ci case kMipsI64x2Neg: 731cb0ef41Sopenharmony_ci case kMipsI64x2Shl: 741cb0ef41Sopenharmony_ci case kMipsI64x2ShrS: 751cb0ef41Sopenharmony_ci case kMipsI64x2ShrU: 761cb0ef41Sopenharmony_ci case kMipsI64x2BitMask: 771cb0ef41Sopenharmony_ci case kMipsI64x2Eq: 781cb0ef41Sopenharmony_ci case kMipsI64x2Ne: 791cb0ef41Sopenharmony_ci case kMipsI64x2GtS: 801cb0ef41Sopenharmony_ci case kMipsI64x2GeS: 811cb0ef41Sopenharmony_ci case kMipsI64x2Abs: 821cb0ef41Sopenharmony_ci case kMipsI64x2SConvertI32x4Low: 831cb0ef41Sopenharmony_ci case kMipsI64x2SConvertI32x4High: 841cb0ef41Sopenharmony_ci case kMipsI64x2UConvertI32x4Low: 851cb0ef41Sopenharmony_ci case kMipsI64x2UConvertI32x4High: 861cb0ef41Sopenharmony_ci case kMipsI64x2ExtMulLowI32x4S: 871cb0ef41Sopenharmony_ci case kMipsI64x2ExtMulHighI32x4S: 881cb0ef41Sopenharmony_ci case kMipsI64x2ExtMulLowI32x4U: 891cb0ef41Sopenharmony_ci case kMipsI64x2ExtMulHighI32x4U: 901cb0ef41Sopenharmony_ci case kMipsF32x4Abs: 911cb0ef41Sopenharmony_ci case kMipsF32x4Add: 921cb0ef41Sopenharmony_ci case kMipsF32x4Eq: 931cb0ef41Sopenharmony_ci case kMipsF32x4ExtractLane: 941cb0ef41Sopenharmony_ci case kMipsF32x4Le: 951cb0ef41Sopenharmony_ci case kMipsF32x4Lt: 961cb0ef41Sopenharmony_ci case kMipsF32x4Max: 971cb0ef41Sopenharmony_ci case kMipsF32x4Min: 981cb0ef41Sopenharmony_ci case kMipsF32x4Mul: 991cb0ef41Sopenharmony_ci case kMipsF32x4Div: 1001cb0ef41Sopenharmony_ci case kMipsF32x4Ne: 1011cb0ef41Sopenharmony_ci case kMipsF32x4Neg: 1021cb0ef41Sopenharmony_ci case kMipsF32x4Sqrt: 1031cb0ef41Sopenharmony_ci case kMipsF32x4RecipApprox: 1041cb0ef41Sopenharmony_ci case kMipsF32x4RecipSqrtApprox: 1051cb0ef41Sopenharmony_ci case kMipsF32x4ReplaceLane: 1061cb0ef41Sopenharmony_ci case kMipsF32x4SConvertI32x4: 1071cb0ef41Sopenharmony_ci case kMipsF32x4Splat: 1081cb0ef41Sopenharmony_ci case kMipsF32x4Sub: 1091cb0ef41Sopenharmony_ci case kMipsF32x4UConvertI32x4: 1101cb0ef41Sopenharmony_ci case kMipsF32x4Pmin: 1111cb0ef41Sopenharmony_ci case kMipsF32x4Pmax: 1121cb0ef41Sopenharmony_ci case kMipsF32x4Ceil: 1131cb0ef41Sopenharmony_ci case kMipsF32x4Floor: 1141cb0ef41Sopenharmony_ci case kMipsF32x4Trunc: 1151cb0ef41Sopenharmony_ci case kMipsF32x4NearestInt: 1161cb0ef41Sopenharmony_ci case kMipsF32x4DemoteF64x2Zero: 1171cb0ef41Sopenharmony_ci case kMipsFloat32Max: 1181cb0ef41Sopenharmony_ci case kMipsFloat32Min: 1191cb0ef41Sopenharmony_ci case kMipsFloat32RoundDown: 1201cb0ef41Sopenharmony_ci case kMipsFloat32RoundTiesEven: 1211cb0ef41Sopenharmony_ci case kMipsFloat32RoundTruncate: 1221cb0ef41Sopenharmony_ci case kMipsFloat32RoundUp: 1231cb0ef41Sopenharmony_ci case kMipsFloat64ExtractHighWord32: 1241cb0ef41Sopenharmony_ci case kMipsFloat64ExtractLowWord32: 1251cb0ef41Sopenharmony_ci case kMipsFloat64InsertHighWord32: 1261cb0ef41Sopenharmony_ci case kMipsFloat64InsertLowWord32: 1271cb0ef41Sopenharmony_ci case kMipsFloat64Max: 1281cb0ef41Sopenharmony_ci case kMipsFloat64Min: 1291cb0ef41Sopenharmony_ci case kMipsFloat64RoundDown: 1301cb0ef41Sopenharmony_ci case kMipsFloat64RoundTiesEven: 1311cb0ef41Sopenharmony_ci case kMipsFloat64RoundTruncate: 1321cb0ef41Sopenharmony_ci case kMipsFloat64RoundUp: 1331cb0ef41Sopenharmony_ci case kMipsFloat64SilenceNaN: 1341cb0ef41Sopenharmony_ci case kMipsFloorWD: 1351cb0ef41Sopenharmony_ci case kMipsFloorWS: 1361cb0ef41Sopenharmony_ci case kMipsI16x8Add: 1371cb0ef41Sopenharmony_ci case kMipsI16x8AddSatS: 1381cb0ef41Sopenharmony_ci case kMipsI16x8AddSatU: 1391cb0ef41Sopenharmony_ci case kMipsI16x8Eq: 1401cb0ef41Sopenharmony_ci case kMipsI16x8ExtractLaneU: 1411cb0ef41Sopenharmony_ci case kMipsI16x8ExtractLaneS: 1421cb0ef41Sopenharmony_ci case kMipsI16x8GeS: 1431cb0ef41Sopenharmony_ci case kMipsI16x8GeU: 1441cb0ef41Sopenharmony_ci case kMipsI16x8RoundingAverageU: 1451cb0ef41Sopenharmony_ci case kMipsI16x8GtS: 1461cb0ef41Sopenharmony_ci case kMipsI16x8GtU: 1471cb0ef41Sopenharmony_ci case kMipsI16x8MaxS: 1481cb0ef41Sopenharmony_ci case kMipsI16x8MaxU: 1491cb0ef41Sopenharmony_ci case kMipsI16x8MinS: 1501cb0ef41Sopenharmony_ci case kMipsI16x8MinU: 1511cb0ef41Sopenharmony_ci case kMipsI16x8Mul: 1521cb0ef41Sopenharmony_ci case kMipsI16x8Ne: 1531cb0ef41Sopenharmony_ci case kMipsI16x8Neg: 1541cb0ef41Sopenharmony_ci case kMipsI16x8ReplaceLane: 1551cb0ef41Sopenharmony_ci case kMipsI16x8SConvertI32x4: 1561cb0ef41Sopenharmony_ci case kMipsI16x8SConvertI8x16High: 1571cb0ef41Sopenharmony_ci case kMipsI16x8SConvertI8x16Low: 1581cb0ef41Sopenharmony_ci case kMipsI16x8Shl: 1591cb0ef41Sopenharmony_ci case kMipsI16x8ShrS: 1601cb0ef41Sopenharmony_ci case kMipsI16x8ShrU: 1611cb0ef41Sopenharmony_ci case kMipsI16x8Splat: 1621cb0ef41Sopenharmony_ci case kMipsI16x8Sub: 1631cb0ef41Sopenharmony_ci case kMipsI16x8SubSatS: 1641cb0ef41Sopenharmony_ci case kMipsI16x8SubSatU: 1651cb0ef41Sopenharmony_ci case kMipsI16x8UConvertI32x4: 1661cb0ef41Sopenharmony_ci case kMipsI16x8UConvertI8x16High: 1671cb0ef41Sopenharmony_ci case kMipsI16x8UConvertI8x16Low: 1681cb0ef41Sopenharmony_ci case kMipsI16x8Abs: 1691cb0ef41Sopenharmony_ci case kMipsI16x8BitMask: 1701cb0ef41Sopenharmony_ci case kMipsI16x8Q15MulRSatS: 1711cb0ef41Sopenharmony_ci case kMipsI16x8ExtMulLowI8x16S: 1721cb0ef41Sopenharmony_ci case kMipsI16x8ExtMulHighI8x16S: 1731cb0ef41Sopenharmony_ci case kMipsI16x8ExtMulLowI8x16U: 1741cb0ef41Sopenharmony_ci case kMipsI16x8ExtMulHighI8x16U: 1751cb0ef41Sopenharmony_ci case kMipsI16x8ExtAddPairwiseI8x16S: 1761cb0ef41Sopenharmony_ci case kMipsI16x8ExtAddPairwiseI8x16U: 1771cb0ef41Sopenharmony_ci case kMipsI32x4ExtAddPairwiseI16x8S: 1781cb0ef41Sopenharmony_ci case kMipsI32x4ExtAddPairwiseI16x8U: 1791cb0ef41Sopenharmony_ci case kMipsI32x4Add: 1801cb0ef41Sopenharmony_ci case kMipsI32x4Eq: 1811cb0ef41Sopenharmony_ci case kMipsI32x4ExtractLane: 1821cb0ef41Sopenharmony_ci case kMipsI32x4GeS: 1831cb0ef41Sopenharmony_ci case kMipsI32x4GeU: 1841cb0ef41Sopenharmony_ci case kMipsI32x4GtS: 1851cb0ef41Sopenharmony_ci case kMipsI32x4GtU: 1861cb0ef41Sopenharmony_ci case kMipsI32x4MaxS: 1871cb0ef41Sopenharmony_ci case kMipsI32x4MaxU: 1881cb0ef41Sopenharmony_ci case kMipsI32x4MinS: 1891cb0ef41Sopenharmony_ci case kMipsI32x4MinU: 1901cb0ef41Sopenharmony_ci case kMipsI32x4Mul: 1911cb0ef41Sopenharmony_ci case kMipsI32x4Ne: 1921cb0ef41Sopenharmony_ci case kMipsI32x4Neg: 1931cb0ef41Sopenharmony_ci case kMipsI32x4ReplaceLane: 1941cb0ef41Sopenharmony_ci case kMipsI32x4SConvertF32x4: 1951cb0ef41Sopenharmony_ci case kMipsI32x4SConvertI16x8High: 1961cb0ef41Sopenharmony_ci case kMipsI32x4SConvertI16x8Low: 1971cb0ef41Sopenharmony_ci case kMipsI32x4Shl: 1981cb0ef41Sopenharmony_ci case kMipsI32x4ShrS: 1991cb0ef41Sopenharmony_ci case kMipsI32x4ShrU: 2001cb0ef41Sopenharmony_ci case kMipsI32x4Splat: 2011cb0ef41Sopenharmony_ci case kMipsI32x4Sub: 2021cb0ef41Sopenharmony_ci case kMipsI32x4UConvertF32x4: 2031cb0ef41Sopenharmony_ci case kMipsI32x4UConvertI16x8High: 2041cb0ef41Sopenharmony_ci case kMipsI32x4UConvertI16x8Low: 2051cb0ef41Sopenharmony_ci case kMipsI32x4Abs: 2061cb0ef41Sopenharmony_ci case kMipsI32x4BitMask: 2071cb0ef41Sopenharmony_ci case kMipsI32x4DotI16x8S: 2081cb0ef41Sopenharmony_ci case kMipsI32x4ExtMulLowI16x8S: 2091cb0ef41Sopenharmony_ci case kMipsI32x4ExtMulHighI16x8S: 2101cb0ef41Sopenharmony_ci case kMipsI32x4ExtMulLowI16x8U: 2111cb0ef41Sopenharmony_ci case kMipsI32x4ExtMulHighI16x8U: 2121cb0ef41Sopenharmony_ci case kMipsI32x4TruncSatF64x2SZero: 2131cb0ef41Sopenharmony_ci case kMipsI32x4TruncSatF64x2UZero: 2141cb0ef41Sopenharmony_ci case kMipsI8x16Add: 2151cb0ef41Sopenharmony_ci case kMipsI8x16AddSatS: 2161cb0ef41Sopenharmony_ci case kMipsI8x16AddSatU: 2171cb0ef41Sopenharmony_ci case kMipsI8x16Eq: 2181cb0ef41Sopenharmony_ci case kMipsI8x16ExtractLaneU: 2191cb0ef41Sopenharmony_ci case kMipsI8x16ExtractLaneS: 2201cb0ef41Sopenharmony_ci case kMipsI8x16GeS: 2211cb0ef41Sopenharmony_ci case kMipsI8x16GeU: 2221cb0ef41Sopenharmony_ci case kMipsI8x16RoundingAverageU: 2231cb0ef41Sopenharmony_ci case kMipsI8x16GtS: 2241cb0ef41Sopenharmony_ci case kMipsI8x16GtU: 2251cb0ef41Sopenharmony_ci case kMipsI8x16MaxS: 2261cb0ef41Sopenharmony_ci case kMipsI8x16MaxU: 2271cb0ef41Sopenharmony_ci case kMipsI8x16MinS: 2281cb0ef41Sopenharmony_ci case kMipsI8x16MinU: 2291cb0ef41Sopenharmony_ci case kMipsI8x16Ne: 2301cb0ef41Sopenharmony_ci case kMipsI8x16Neg: 2311cb0ef41Sopenharmony_ci case kMipsI8x16ReplaceLane: 2321cb0ef41Sopenharmony_ci case kMipsI8x16SConvertI16x8: 2331cb0ef41Sopenharmony_ci case kMipsI8x16Shl: 2341cb0ef41Sopenharmony_ci case kMipsI8x16ShrS: 2351cb0ef41Sopenharmony_ci case kMipsI8x16ShrU: 2361cb0ef41Sopenharmony_ci case kMipsI8x16Splat: 2371cb0ef41Sopenharmony_ci case kMipsI8x16Sub: 2381cb0ef41Sopenharmony_ci case kMipsI8x16SubSatS: 2391cb0ef41Sopenharmony_ci case kMipsI8x16SubSatU: 2401cb0ef41Sopenharmony_ci case kMipsI8x16UConvertI16x8: 2411cb0ef41Sopenharmony_ci case kMipsI8x16Abs: 2421cb0ef41Sopenharmony_ci case kMipsI8x16Popcnt: 2431cb0ef41Sopenharmony_ci case kMipsI8x16BitMask: 2441cb0ef41Sopenharmony_ci case kMipsIns: 2451cb0ef41Sopenharmony_ci case kMipsLsa: 2461cb0ef41Sopenharmony_ci case kMipsMaddD: 2471cb0ef41Sopenharmony_ci case kMipsMaddS: 2481cb0ef41Sopenharmony_ci case kMipsMaxD: 2491cb0ef41Sopenharmony_ci case kMipsMaxS: 2501cb0ef41Sopenharmony_ci case kMipsMinD: 2511cb0ef41Sopenharmony_ci case kMipsMinS: 2521cb0ef41Sopenharmony_ci case kMipsMod: 2531cb0ef41Sopenharmony_ci case kMipsModU: 2541cb0ef41Sopenharmony_ci case kMipsMov: 2551cb0ef41Sopenharmony_ci case kMipsMsubD: 2561cb0ef41Sopenharmony_ci case kMipsMsubS: 2571cb0ef41Sopenharmony_ci case kMipsMul: 2581cb0ef41Sopenharmony_ci case kMipsMulD: 2591cb0ef41Sopenharmony_ci case kMipsMulHigh: 2601cb0ef41Sopenharmony_ci case kMipsMulHighU: 2611cb0ef41Sopenharmony_ci case kMipsMulOvf: 2621cb0ef41Sopenharmony_ci case kMipsMulPair: 2631cb0ef41Sopenharmony_ci case kMipsMulS: 2641cb0ef41Sopenharmony_ci case kMipsNegD: 2651cb0ef41Sopenharmony_ci case kMipsNegS: 2661cb0ef41Sopenharmony_ci case kMipsNor: 2671cb0ef41Sopenharmony_ci case kMipsOr: 2681cb0ef41Sopenharmony_ci case kMipsPopcnt: 2691cb0ef41Sopenharmony_ci case kMipsRor: 2701cb0ef41Sopenharmony_ci case kMipsRoundWD: 2711cb0ef41Sopenharmony_ci case kMipsRoundWS: 2721cb0ef41Sopenharmony_ci case kMipsS128And: 2731cb0ef41Sopenharmony_ci case kMipsS128Not: 2741cb0ef41Sopenharmony_ci case kMipsS128Or: 2751cb0ef41Sopenharmony_ci case kMipsS128Select: 2761cb0ef41Sopenharmony_ci case kMipsS128Xor: 2771cb0ef41Sopenharmony_ci case kMipsS128Zero: 2781cb0ef41Sopenharmony_ci case kMipsS128AndNot: 2791cb0ef41Sopenharmony_ci case kMipsS16x2Reverse: 2801cb0ef41Sopenharmony_ci case kMipsS16x4Reverse: 2811cb0ef41Sopenharmony_ci case kMipsS16x8InterleaveEven: 2821cb0ef41Sopenharmony_ci case kMipsS16x8InterleaveLeft: 2831cb0ef41Sopenharmony_ci case kMipsS16x8InterleaveOdd: 2841cb0ef41Sopenharmony_ci case kMipsS16x8InterleaveRight: 2851cb0ef41Sopenharmony_ci case kMipsS16x8PackEven: 2861cb0ef41Sopenharmony_ci case kMipsS16x8PackOdd: 2871cb0ef41Sopenharmony_ci case kMipsI64x2AllTrue: 2881cb0ef41Sopenharmony_ci case kMipsI32x4AllTrue: 2891cb0ef41Sopenharmony_ci case kMipsI16x8AllTrue: 2901cb0ef41Sopenharmony_ci case kMipsI8x16AllTrue: 2911cb0ef41Sopenharmony_ci case kMipsV128AnyTrue: 2921cb0ef41Sopenharmony_ci case kMipsS32x4InterleaveEven: 2931cb0ef41Sopenharmony_ci case kMipsS32x4InterleaveLeft: 2941cb0ef41Sopenharmony_ci case kMipsS32x4InterleaveOdd: 2951cb0ef41Sopenharmony_ci case kMipsS32x4InterleaveRight: 2961cb0ef41Sopenharmony_ci case kMipsS32x4PackEven: 2971cb0ef41Sopenharmony_ci case kMipsS32x4PackOdd: 2981cb0ef41Sopenharmony_ci case kMipsS32x4Shuffle: 2991cb0ef41Sopenharmony_ci case kMipsS8x16Concat: 3001cb0ef41Sopenharmony_ci case kMipsS8x16InterleaveEven: 3011cb0ef41Sopenharmony_ci case kMipsS8x16InterleaveLeft: 3021cb0ef41Sopenharmony_ci case kMipsS8x16InterleaveOdd: 3031cb0ef41Sopenharmony_ci case kMipsS8x16InterleaveRight: 3041cb0ef41Sopenharmony_ci case kMipsS8x16PackEven: 3051cb0ef41Sopenharmony_ci case kMipsS8x16PackOdd: 3061cb0ef41Sopenharmony_ci case kMipsI8x16Shuffle: 3071cb0ef41Sopenharmony_ci case kMipsI8x16Swizzle: 3081cb0ef41Sopenharmony_ci case kMipsS8x2Reverse: 3091cb0ef41Sopenharmony_ci case kMipsS8x4Reverse: 3101cb0ef41Sopenharmony_ci case kMipsS8x8Reverse: 3111cb0ef41Sopenharmony_ci case kMipsSar: 3121cb0ef41Sopenharmony_ci case kMipsSarPair: 3131cb0ef41Sopenharmony_ci case kMipsSeb: 3141cb0ef41Sopenharmony_ci case kMipsSeh: 3151cb0ef41Sopenharmony_ci case kMipsShl: 3161cb0ef41Sopenharmony_ci case kMipsShlPair: 3171cb0ef41Sopenharmony_ci case kMipsShr: 3181cb0ef41Sopenharmony_ci case kMipsShrPair: 3191cb0ef41Sopenharmony_ci case kMipsSqrtD: 3201cb0ef41Sopenharmony_ci case kMipsSqrtS: 3211cb0ef41Sopenharmony_ci case kMipsSub: 3221cb0ef41Sopenharmony_ci case kMipsSubD: 3231cb0ef41Sopenharmony_ci case kMipsSubOvf: 3241cb0ef41Sopenharmony_ci case kMipsSubPair: 3251cb0ef41Sopenharmony_ci case kMipsSubS: 3261cb0ef41Sopenharmony_ci case kMipsTruncUwD: 3271cb0ef41Sopenharmony_ci case kMipsTruncUwS: 3281cb0ef41Sopenharmony_ci case kMipsTruncWD: 3291cb0ef41Sopenharmony_ci case kMipsTruncWS: 3301cb0ef41Sopenharmony_ci case kMipsTst: 3311cb0ef41Sopenharmony_ci case kMipsXor: 3321cb0ef41Sopenharmony_ci return kNoOpcodeFlags; 3331cb0ef41Sopenharmony_ci 3341cb0ef41Sopenharmony_ci case kMipsLb: 3351cb0ef41Sopenharmony_ci case kMipsLbu: 3361cb0ef41Sopenharmony_ci case kMipsLdc1: 3371cb0ef41Sopenharmony_ci case kMipsLh: 3381cb0ef41Sopenharmony_ci case kMipsLhu: 3391cb0ef41Sopenharmony_ci case kMipsLw: 3401cb0ef41Sopenharmony_ci case kMipsLwc1: 3411cb0ef41Sopenharmony_ci case kMipsMsaLd: 3421cb0ef41Sopenharmony_ci case kMipsPeek: 3431cb0ef41Sopenharmony_ci case kMipsUldc1: 3441cb0ef41Sopenharmony_ci case kMipsUlh: 3451cb0ef41Sopenharmony_ci case kMipsUlhu: 3461cb0ef41Sopenharmony_ci case kMipsUlw: 3471cb0ef41Sopenharmony_ci case kMipsUlwc1: 3481cb0ef41Sopenharmony_ci case kMipsS128Load8Splat: 3491cb0ef41Sopenharmony_ci case kMipsS128Load16Splat: 3501cb0ef41Sopenharmony_ci case kMipsS128Load32Splat: 3511cb0ef41Sopenharmony_ci case kMipsS128Load64Splat: 3521cb0ef41Sopenharmony_ci case kMipsS128Load8x8S: 3531cb0ef41Sopenharmony_ci case kMipsS128Load8x8U: 3541cb0ef41Sopenharmony_ci case kMipsS128Load16x4S: 3551cb0ef41Sopenharmony_ci case kMipsS128Load16x4U: 3561cb0ef41Sopenharmony_ci case kMipsS128Load32x2S: 3571cb0ef41Sopenharmony_ci case kMipsS128Load32x2U: 3581cb0ef41Sopenharmony_ci case kMipsWord32AtomicPairLoad: 3591cb0ef41Sopenharmony_ci return kIsLoadOperation; 3601cb0ef41Sopenharmony_ci 3611cb0ef41Sopenharmony_ci case kMipsModD: 3621cb0ef41Sopenharmony_ci case kMipsMsaSt: 3631cb0ef41Sopenharmony_ci case kMipsPush: 3641cb0ef41Sopenharmony_ci case kMipsSb: 3651cb0ef41Sopenharmony_ci case kMipsSdc1: 3661cb0ef41Sopenharmony_ci case kMipsSh: 3671cb0ef41Sopenharmony_ci case kMipsStackClaim: 3681cb0ef41Sopenharmony_ci case kMipsStoreToStackSlot: 3691cb0ef41Sopenharmony_ci case kMipsSw: 3701cb0ef41Sopenharmony_ci case kMipsSwc1: 3711cb0ef41Sopenharmony_ci case kMipsUsdc1: 3721cb0ef41Sopenharmony_ci case kMipsUsh: 3731cb0ef41Sopenharmony_ci case kMipsUsw: 3741cb0ef41Sopenharmony_ci case kMipsUswc1: 3751cb0ef41Sopenharmony_ci case kMipsSync: 3761cb0ef41Sopenharmony_ci case kMipsWord32AtomicPairStore: 3771cb0ef41Sopenharmony_ci case kMipsWord32AtomicPairAdd: 3781cb0ef41Sopenharmony_ci case kMipsWord32AtomicPairSub: 3791cb0ef41Sopenharmony_ci case kMipsWord32AtomicPairAnd: 3801cb0ef41Sopenharmony_ci case kMipsWord32AtomicPairOr: 3811cb0ef41Sopenharmony_ci case kMipsWord32AtomicPairXor: 3821cb0ef41Sopenharmony_ci case kMipsWord32AtomicPairExchange: 3831cb0ef41Sopenharmony_ci case kMipsWord32AtomicPairCompareExchange: 3841cb0ef41Sopenharmony_ci return kHasSideEffect; 3851cb0ef41Sopenharmony_ci 3861cb0ef41Sopenharmony_ci#define CASE(Name) case k##Name: 3871cb0ef41Sopenharmony_ci COMMON_ARCH_OPCODE_LIST(CASE) 3881cb0ef41Sopenharmony_ci#undef CASE 3891cb0ef41Sopenharmony_ci // Already covered in architecture independent code. 3901cb0ef41Sopenharmony_ci UNREACHABLE(); 3911cb0ef41Sopenharmony_ci } 3921cb0ef41Sopenharmony_ci 3931cb0ef41Sopenharmony_ci UNREACHABLE(); 3941cb0ef41Sopenharmony_ci} 3951cb0ef41Sopenharmony_ci 3961cb0ef41Sopenharmony_cienum Latency { 3971cb0ef41Sopenharmony_ci BRANCH = 4, // Estimated max. 3981cb0ef41Sopenharmony_ci RINT_S = 4, // Estimated. 3991cb0ef41Sopenharmony_ci RINT_D = 4, // Estimated. 4001cb0ef41Sopenharmony_ci 4011cb0ef41Sopenharmony_ci MULT = 4, 4021cb0ef41Sopenharmony_ci MULTU = 4, 4031cb0ef41Sopenharmony_ci MADD = 4, 4041cb0ef41Sopenharmony_ci MADDU = 4, 4051cb0ef41Sopenharmony_ci MSUB = 4, 4061cb0ef41Sopenharmony_ci MSUBU = 4, 4071cb0ef41Sopenharmony_ci 4081cb0ef41Sopenharmony_ci MUL = 7, 4091cb0ef41Sopenharmony_ci MULU = 7, 4101cb0ef41Sopenharmony_ci MUH = 7, 4111cb0ef41Sopenharmony_ci MUHU = 7, 4121cb0ef41Sopenharmony_ci 4131cb0ef41Sopenharmony_ci DIV = 50, // Min:11 Max:50 4141cb0ef41Sopenharmony_ci DIVU = 50, 4151cb0ef41Sopenharmony_ci 4161cb0ef41Sopenharmony_ci ABS_S = 4, 4171cb0ef41Sopenharmony_ci ABS_D = 4, 4181cb0ef41Sopenharmony_ci NEG_S = 4, 4191cb0ef41Sopenharmony_ci NEG_D = 4, 4201cb0ef41Sopenharmony_ci ADD_S = 4, 4211cb0ef41Sopenharmony_ci ADD_D = 4, 4221cb0ef41Sopenharmony_ci SUB_S = 4, 4231cb0ef41Sopenharmony_ci SUB_D = 4, 4241cb0ef41Sopenharmony_ci MAX_S = 4, // Estimated. 4251cb0ef41Sopenharmony_ci MAX_D = 4, // Estimated. 4261cb0ef41Sopenharmony_ci C_cond_S = 4, 4271cb0ef41Sopenharmony_ci C_cond_D = 4, 4281cb0ef41Sopenharmony_ci MUL_S = 4, 4291cb0ef41Sopenharmony_ci 4301cb0ef41Sopenharmony_ci MADD_S = 4, 4311cb0ef41Sopenharmony_ci MSUB_S = 4, 4321cb0ef41Sopenharmony_ci NMADD_S = 4, 4331cb0ef41Sopenharmony_ci NMSUB_S = 4, 4341cb0ef41Sopenharmony_ci 4351cb0ef41Sopenharmony_ci CABS_cond_S = 4, 4361cb0ef41Sopenharmony_ci CABS_cond_D = 4, 4371cb0ef41Sopenharmony_ci 4381cb0ef41Sopenharmony_ci CVT_D_S = 4, 4391cb0ef41Sopenharmony_ci CVT_PS_PW = 4, 4401cb0ef41Sopenharmony_ci 4411cb0ef41Sopenharmony_ci CVT_S_W = 4, 4421cb0ef41Sopenharmony_ci CVT_S_L = 4, 4431cb0ef41Sopenharmony_ci CVT_D_W = 4, 4441cb0ef41Sopenharmony_ci CVT_D_L = 4, 4451cb0ef41Sopenharmony_ci 4461cb0ef41Sopenharmony_ci CVT_S_D = 4, 4471cb0ef41Sopenharmony_ci 4481cb0ef41Sopenharmony_ci CVT_W_S = 4, 4491cb0ef41Sopenharmony_ci CVT_W_D = 4, 4501cb0ef41Sopenharmony_ci CVT_L_S = 4, 4511cb0ef41Sopenharmony_ci CVT_L_D = 4, 4521cb0ef41Sopenharmony_ci 4531cb0ef41Sopenharmony_ci CEIL_W_S = 4, 4541cb0ef41Sopenharmony_ci CEIL_W_D = 4, 4551cb0ef41Sopenharmony_ci CEIL_L_S = 4, 4561cb0ef41Sopenharmony_ci CEIL_L_D = 4, 4571cb0ef41Sopenharmony_ci 4581cb0ef41Sopenharmony_ci FLOOR_W_S = 4, 4591cb0ef41Sopenharmony_ci FLOOR_W_D = 4, 4601cb0ef41Sopenharmony_ci FLOOR_L_S = 4, 4611cb0ef41Sopenharmony_ci FLOOR_L_D = 4, 4621cb0ef41Sopenharmony_ci 4631cb0ef41Sopenharmony_ci ROUND_W_S = 4, 4641cb0ef41Sopenharmony_ci ROUND_W_D = 4, 4651cb0ef41Sopenharmony_ci ROUND_L_S = 4, 4661cb0ef41Sopenharmony_ci ROUND_L_D = 4, 4671cb0ef41Sopenharmony_ci 4681cb0ef41Sopenharmony_ci TRUNC_W_S = 4, 4691cb0ef41Sopenharmony_ci TRUNC_W_D = 4, 4701cb0ef41Sopenharmony_ci TRUNC_L_S = 4, 4711cb0ef41Sopenharmony_ci TRUNC_L_D = 4, 4721cb0ef41Sopenharmony_ci 4731cb0ef41Sopenharmony_ci MOV_S = 4, 4741cb0ef41Sopenharmony_ci MOV_D = 4, 4751cb0ef41Sopenharmony_ci 4761cb0ef41Sopenharmony_ci MOVF_S = 4, 4771cb0ef41Sopenharmony_ci MOVF_D = 4, 4781cb0ef41Sopenharmony_ci 4791cb0ef41Sopenharmony_ci MOVN_S = 4, 4801cb0ef41Sopenharmony_ci MOVN_D = 4, 4811cb0ef41Sopenharmony_ci 4821cb0ef41Sopenharmony_ci MOVT_S = 4, 4831cb0ef41Sopenharmony_ci MOVT_D = 4, 4841cb0ef41Sopenharmony_ci 4851cb0ef41Sopenharmony_ci MOVZ_S = 4, 4861cb0ef41Sopenharmony_ci MOVZ_D = 4, 4871cb0ef41Sopenharmony_ci 4881cb0ef41Sopenharmony_ci MUL_D = 5, 4891cb0ef41Sopenharmony_ci MADD_D = 5, 4901cb0ef41Sopenharmony_ci MSUB_D = 5, 4911cb0ef41Sopenharmony_ci NMADD_D = 5, 4921cb0ef41Sopenharmony_ci NMSUB_D = 5, 4931cb0ef41Sopenharmony_ci 4941cb0ef41Sopenharmony_ci RECIP_S = 13, 4951cb0ef41Sopenharmony_ci RECIP_D = 26, 4961cb0ef41Sopenharmony_ci 4971cb0ef41Sopenharmony_ci RSQRT_S = 17, 4981cb0ef41Sopenharmony_ci RSQRT_D = 36, 4991cb0ef41Sopenharmony_ci 5001cb0ef41Sopenharmony_ci DIV_S = 17, 5011cb0ef41Sopenharmony_ci SQRT_S = 17, 5021cb0ef41Sopenharmony_ci 5031cb0ef41Sopenharmony_ci DIV_D = 32, 5041cb0ef41Sopenharmony_ci SQRT_D = 32, 5051cb0ef41Sopenharmony_ci 5061cb0ef41Sopenharmony_ci MTC1 = 4, 5071cb0ef41Sopenharmony_ci MTHC1 = 4, 5081cb0ef41Sopenharmony_ci DMTC1 = 4, 5091cb0ef41Sopenharmony_ci LWC1 = 4, 5101cb0ef41Sopenharmony_ci LDC1 = 4, 5111cb0ef41Sopenharmony_ci LDXC1 = 4, 5121cb0ef41Sopenharmony_ci LUXC1 = 4, 5131cb0ef41Sopenharmony_ci LWXC1 = 4, 5141cb0ef41Sopenharmony_ci 5151cb0ef41Sopenharmony_ci MFC1 = 1, 5161cb0ef41Sopenharmony_ci MFHC1 = 1, 5171cb0ef41Sopenharmony_ci MFHI = 1, 5181cb0ef41Sopenharmony_ci MFLO = 1, 5191cb0ef41Sopenharmony_ci DMFC1 = 1, 5201cb0ef41Sopenharmony_ci SWC1 = 1, 5211cb0ef41Sopenharmony_ci SDC1 = 1, 5221cb0ef41Sopenharmony_ci SDXC1 = 1, 5231cb0ef41Sopenharmony_ci SUXC1 = 1, 5241cb0ef41Sopenharmony_ci SWXC1 = 1, 5251cb0ef41Sopenharmony_ci}; 5261cb0ef41Sopenharmony_ci 5271cb0ef41Sopenharmony_ciint ClzLatency() { 5281cb0ef41Sopenharmony_ci if (IsMipsArchVariant(kLoongson)) { 5291cb0ef41Sopenharmony_ci return (6 + 2 * Latency::BRANCH); 5301cb0ef41Sopenharmony_ci } else { 5311cb0ef41Sopenharmony_ci return 1; 5321cb0ef41Sopenharmony_ci } 5331cb0ef41Sopenharmony_ci} 5341cb0ef41Sopenharmony_ci 5351cb0ef41Sopenharmony_ciint RorLatency(bool is_operand_register = true) { 5361cb0ef41Sopenharmony_ci if (IsMipsArchVariant(kMips32r2) || IsMipsArchVariant(kMips32r6)) { 5371cb0ef41Sopenharmony_ci return 1; 5381cb0ef41Sopenharmony_ci } else { 5391cb0ef41Sopenharmony_ci if (is_operand_register) { 5401cb0ef41Sopenharmony_ci return 4; 5411cb0ef41Sopenharmony_ci } else { 5421cb0ef41Sopenharmony_ci return 3; // Estimated max. 5431cb0ef41Sopenharmony_ci } 5441cb0ef41Sopenharmony_ci } 5451cb0ef41Sopenharmony_ci} 5461cb0ef41Sopenharmony_ci 5471cb0ef41Sopenharmony_ciint AdduLatency(bool is_operand_register = true) { 5481cb0ef41Sopenharmony_ci if (is_operand_register) { 5491cb0ef41Sopenharmony_ci return 1; 5501cb0ef41Sopenharmony_ci } else { 5511cb0ef41Sopenharmony_ci return 2; // Estimated max. 5521cb0ef41Sopenharmony_ci } 5531cb0ef41Sopenharmony_ci} 5541cb0ef41Sopenharmony_ci 5551cb0ef41Sopenharmony_ciint XorLatency(bool is_operand_register = true) { 5561cb0ef41Sopenharmony_ci return AdduLatency(is_operand_register); 5571cb0ef41Sopenharmony_ci} 5581cb0ef41Sopenharmony_ci 5591cb0ef41Sopenharmony_ciint AndLatency(bool is_operand_register = true) { 5601cb0ef41Sopenharmony_ci return AdduLatency(is_operand_register); 5611cb0ef41Sopenharmony_ci} 5621cb0ef41Sopenharmony_ci 5631cb0ef41Sopenharmony_ciint OrLatency(bool is_operand_register = true) { 5641cb0ef41Sopenharmony_ci return AdduLatency(is_operand_register); 5651cb0ef41Sopenharmony_ci} 5661cb0ef41Sopenharmony_ci 5671cb0ef41Sopenharmony_ciint SubuLatency(bool is_operand_register = true) { 5681cb0ef41Sopenharmony_ci return AdduLatency(is_operand_register); 5691cb0ef41Sopenharmony_ci} 5701cb0ef41Sopenharmony_ci 5711cb0ef41Sopenharmony_ciint MulLatency(bool is_operand_register = true) { 5721cb0ef41Sopenharmony_ci if (is_operand_register) { 5731cb0ef41Sopenharmony_ci if (IsMipsArchVariant(kLoongson)) { 5741cb0ef41Sopenharmony_ci return Latency::MULT + 1; 5751cb0ef41Sopenharmony_ci } else { 5761cb0ef41Sopenharmony_ci return Latency::MUL + 1; 5771cb0ef41Sopenharmony_ci } 5781cb0ef41Sopenharmony_ci } else { 5791cb0ef41Sopenharmony_ci if (IsMipsArchVariant(kLoongson)) { 5801cb0ef41Sopenharmony_ci return Latency::MULT + 2; 5811cb0ef41Sopenharmony_ci } else { 5821cb0ef41Sopenharmony_ci return Latency::MUL + 2; 5831cb0ef41Sopenharmony_ci } 5841cb0ef41Sopenharmony_ci } 5851cb0ef41Sopenharmony_ci} 5861cb0ef41Sopenharmony_ci 5871cb0ef41Sopenharmony_ciint NorLatency(bool is_operand_register = true) { 5881cb0ef41Sopenharmony_ci if (is_operand_register) { 5891cb0ef41Sopenharmony_ci return 1; 5901cb0ef41Sopenharmony_ci } else { 5911cb0ef41Sopenharmony_ci return 2; 5921cb0ef41Sopenharmony_ci } 5931cb0ef41Sopenharmony_ci} 5941cb0ef41Sopenharmony_ci 5951cb0ef41Sopenharmony_ciint InsLatency() { 5961cb0ef41Sopenharmony_ci if (IsMipsArchVariant(kMips32r2) || IsMipsArchVariant(kMips32r6)) { 5971cb0ef41Sopenharmony_ci return 1; 5981cb0ef41Sopenharmony_ci } else { 5991cb0ef41Sopenharmony_ci return SubuLatency(false) + 7; 6001cb0ef41Sopenharmony_ci } 6011cb0ef41Sopenharmony_ci} 6021cb0ef41Sopenharmony_ci 6031cb0ef41Sopenharmony_ciint ShlPairLatency(bool is_operand_register = true) { 6041cb0ef41Sopenharmony_ci if (is_operand_register) { 6051cb0ef41Sopenharmony_ci int latency = 6061cb0ef41Sopenharmony_ci AndLatency(false) + NorLatency() + OrLatency() + AndLatency(false) + 4; 6071cb0ef41Sopenharmony_ci if (IsMipsArchVariant(kLoongson) || IsMipsArchVariant(kMips32r6)) { 6081cb0ef41Sopenharmony_ci return latency + Latency::BRANCH + 2; 6091cb0ef41Sopenharmony_ci } else { 6101cb0ef41Sopenharmony_ci return latency + 2; 6111cb0ef41Sopenharmony_ci } 6121cb0ef41Sopenharmony_ci } else { 6131cb0ef41Sopenharmony_ci return 2; 6141cb0ef41Sopenharmony_ci } 6151cb0ef41Sopenharmony_ci} 6161cb0ef41Sopenharmony_ci 6171cb0ef41Sopenharmony_ciint ShrPairLatency(bool is_operand_register = true, uint32_t shift = 0) { 6181cb0ef41Sopenharmony_ci if (is_operand_register) { 6191cb0ef41Sopenharmony_ci int latency = 6201cb0ef41Sopenharmony_ci AndLatency(false) + NorLatency() + OrLatency() + AndLatency(false) + 4; 6211cb0ef41Sopenharmony_ci if (IsMipsArchVariant(kLoongson) || IsMipsArchVariant(kMips32r6)) { 6221cb0ef41Sopenharmony_ci return latency + Latency::BRANCH + 2; 6231cb0ef41Sopenharmony_ci } else { 6241cb0ef41Sopenharmony_ci return latency + 2; 6251cb0ef41Sopenharmony_ci } 6261cb0ef41Sopenharmony_ci } else { 6271cb0ef41Sopenharmony_ci // Estimated max. 6281cb0ef41Sopenharmony_ci return (InsLatency() + 2 > OrLatency() + 3) ? InsLatency() + 2 6291cb0ef41Sopenharmony_ci : OrLatency() + 3; 6301cb0ef41Sopenharmony_ci } 6311cb0ef41Sopenharmony_ci} 6321cb0ef41Sopenharmony_ci 6331cb0ef41Sopenharmony_ciint SarPairLatency(bool is_operand_register = true, uint32_t shift = 0) { 6341cb0ef41Sopenharmony_ci if (is_operand_register) { 6351cb0ef41Sopenharmony_ci return AndLatency(false) + NorLatency() + OrLatency() + AndLatency(false) + 6361cb0ef41Sopenharmony_ci Latency::BRANCH + 6; 6371cb0ef41Sopenharmony_ci } else { 6381cb0ef41Sopenharmony_ci shift = shift & 0x3F; 6391cb0ef41Sopenharmony_ci if (shift == 0) { 6401cb0ef41Sopenharmony_ci return 2; 6411cb0ef41Sopenharmony_ci } else if (shift < 32) { 6421cb0ef41Sopenharmony_ci if (IsMipsArchVariant(kMips32r2) || IsMipsArchVariant(kMips32r6)) { 6431cb0ef41Sopenharmony_ci return InsLatency() + 2; 6441cb0ef41Sopenharmony_ci } else { 6451cb0ef41Sopenharmony_ci return OrLatency() + 3; 6461cb0ef41Sopenharmony_ci } 6471cb0ef41Sopenharmony_ci } else if (shift == 32) { 6481cb0ef41Sopenharmony_ci return 2; 6491cb0ef41Sopenharmony_ci } else { 6501cb0ef41Sopenharmony_ci return 2; 6511cb0ef41Sopenharmony_ci } 6521cb0ef41Sopenharmony_ci } 6531cb0ef41Sopenharmony_ci} 6541cb0ef41Sopenharmony_ci 6551cb0ef41Sopenharmony_ciint ExtLatency() { 6561cb0ef41Sopenharmony_ci if (IsMipsArchVariant(kMips32r2) || IsMipsArchVariant(kMips32r6)) { 6571cb0ef41Sopenharmony_ci return 1; 6581cb0ef41Sopenharmony_ci } else { 6591cb0ef41Sopenharmony_ci // Estimated max. 6601cb0ef41Sopenharmony_ci return 2; 6611cb0ef41Sopenharmony_ci } 6621cb0ef41Sopenharmony_ci} 6631cb0ef41Sopenharmony_ci 6641cb0ef41Sopenharmony_ciint LsaLatency() { 6651cb0ef41Sopenharmony_ci // Estimated max. 6661cb0ef41Sopenharmony_ci return AdduLatency() + 1; 6671cb0ef41Sopenharmony_ci} 6681cb0ef41Sopenharmony_ci 6691cb0ef41Sopenharmony_ciint SltLatency(bool is_operand_register = true) { 6701cb0ef41Sopenharmony_ci if (is_operand_register) { 6711cb0ef41Sopenharmony_ci return 1; 6721cb0ef41Sopenharmony_ci } else { 6731cb0ef41Sopenharmony_ci return 2; // Estimated max. 6741cb0ef41Sopenharmony_ci } 6751cb0ef41Sopenharmony_ci} 6761cb0ef41Sopenharmony_ci 6771cb0ef41Sopenharmony_ciint SltuLatency(bool is_operand_register = true) { 6781cb0ef41Sopenharmony_ci return SltLatency(is_operand_register); 6791cb0ef41Sopenharmony_ci} 6801cb0ef41Sopenharmony_ci 6811cb0ef41Sopenharmony_ciint AddPairLatency() { return 3 * AdduLatency() + SltLatency(); } 6821cb0ef41Sopenharmony_ci 6831cb0ef41Sopenharmony_ciint SubPairLatency() { return SltuLatency() + 3 * SubuLatency(); } 6841cb0ef41Sopenharmony_ci 6851cb0ef41Sopenharmony_ciint MuluLatency(bool is_operand_register = true) { 6861cb0ef41Sopenharmony_ci int latency = 0; 6871cb0ef41Sopenharmony_ci if (!is_operand_register) latency++; 6881cb0ef41Sopenharmony_ci if (!IsMipsArchVariant(kMips32r6)) { 6891cb0ef41Sopenharmony_ci return latency + Latency::MULTU + 2; 6901cb0ef41Sopenharmony_ci } else { 6911cb0ef41Sopenharmony_ci return latency + Latency::MULU + Latency::MUHU; 6921cb0ef41Sopenharmony_ci } 6931cb0ef41Sopenharmony_ci} 6941cb0ef41Sopenharmony_ci 6951cb0ef41Sopenharmony_ciint MulPairLatency() { 6961cb0ef41Sopenharmony_ci return MuluLatency() + 2 * MulLatency() + 2 * AdduLatency(); 6971cb0ef41Sopenharmony_ci} 6981cb0ef41Sopenharmony_ci 6991cb0ef41Sopenharmony_ciint MaddSLatency() { 7001cb0ef41Sopenharmony_ci if (IsMipsArchVariant(kMips32r2)) { 7011cb0ef41Sopenharmony_ci return Latency::MADD_D; 7021cb0ef41Sopenharmony_ci } else { 7031cb0ef41Sopenharmony_ci return Latency::MUL_D + Latency::ADD_D; 7041cb0ef41Sopenharmony_ci } 7051cb0ef41Sopenharmony_ci} 7061cb0ef41Sopenharmony_ci 7071cb0ef41Sopenharmony_ciint MaddDLatency() { 7081cb0ef41Sopenharmony_ci if (IsMipsArchVariant(kMips32r2)) { 7091cb0ef41Sopenharmony_ci return Latency::MADD_D; 7101cb0ef41Sopenharmony_ci } else { 7111cb0ef41Sopenharmony_ci return Latency::MUL_D + Latency::ADD_D; 7121cb0ef41Sopenharmony_ci } 7131cb0ef41Sopenharmony_ci} 7141cb0ef41Sopenharmony_ci 7151cb0ef41Sopenharmony_ciint MsubSLatency() { 7161cb0ef41Sopenharmony_ci if (IsMipsArchVariant(kMips32r2)) { 7171cb0ef41Sopenharmony_ci return Latency::MSUB_S; 7181cb0ef41Sopenharmony_ci } else { 7191cb0ef41Sopenharmony_ci return Latency::MUL_S + Latency::SUB_S; 7201cb0ef41Sopenharmony_ci } 7211cb0ef41Sopenharmony_ci} 7221cb0ef41Sopenharmony_ci 7231cb0ef41Sopenharmony_ciint MsubDLatency() { 7241cb0ef41Sopenharmony_ci if (IsMipsArchVariant(kMips32r2)) { 7251cb0ef41Sopenharmony_ci return Latency::MSUB_D; 7261cb0ef41Sopenharmony_ci } else { 7271cb0ef41Sopenharmony_ci return Latency::MUL_D + Latency::SUB_D; 7281cb0ef41Sopenharmony_ci } 7291cb0ef41Sopenharmony_ci} 7301cb0ef41Sopenharmony_ci 7311cb0ef41Sopenharmony_ciint Mfhc1Latency() { 7321cb0ef41Sopenharmony_ci if (IsFp32Mode()) { 7331cb0ef41Sopenharmony_ci return Latency::MFC1; 7341cb0ef41Sopenharmony_ci } else { 7351cb0ef41Sopenharmony_ci return 1; 7361cb0ef41Sopenharmony_ci } 7371cb0ef41Sopenharmony_ci} 7381cb0ef41Sopenharmony_ci 7391cb0ef41Sopenharmony_ciint Mthc1Latency() { 7401cb0ef41Sopenharmony_ci if (IsFp32Mode()) { 7411cb0ef41Sopenharmony_ci return Latency::MTC1; 7421cb0ef41Sopenharmony_ci } else { 7431cb0ef41Sopenharmony_ci return 1; 7441cb0ef41Sopenharmony_ci } 7451cb0ef41Sopenharmony_ci} 7461cb0ef41Sopenharmony_ci 7471cb0ef41Sopenharmony_ciint MoveLatency(bool is_double_register = true) { 7481cb0ef41Sopenharmony_ci if (!is_double_register) { 7491cb0ef41Sopenharmony_ci return Latency::MTC1 + 1; 7501cb0ef41Sopenharmony_ci } else { 7511cb0ef41Sopenharmony_ci return Mthc1Latency() + 1; // Estimated. 7521cb0ef41Sopenharmony_ci } 7531cb0ef41Sopenharmony_ci} 7541cb0ef41Sopenharmony_ci 7551cb0ef41Sopenharmony_ciint Float64RoundLatency() { 7561cb0ef41Sopenharmony_ci if (IsMipsArchVariant(kMips32r6)) { 7571cb0ef41Sopenharmony_ci return Latency::RINT_D + 4; 7581cb0ef41Sopenharmony_ci } else { 7591cb0ef41Sopenharmony_ci // For ceil_l_d, floor_l_d, round_l_d, trunc_l_d latency is 4. 7601cb0ef41Sopenharmony_ci return Mfhc1Latency() + ExtLatency() + Latency::BRANCH + Latency::MOV_D + 7611cb0ef41Sopenharmony_ci 4 + MoveLatency() + 1 + Latency::BRANCH + Latency::CVT_D_L; 7621cb0ef41Sopenharmony_ci } 7631cb0ef41Sopenharmony_ci} 7641cb0ef41Sopenharmony_ci 7651cb0ef41Sopenharmony_ciint Float32RoundLatency() { 7661cb0ef41Sopenharmony_ci if (IsMipsArchVariant(kMips32r6)) { 7671cb0ef41Sopenharmony_ci return Latency::RINT_S + 4; 7681cb0ef41Sopenharmony_ci } else { 7691cb0ef41Sopenharmony_ci // For ceil_w_s, floor_w_s, round_w_s, trunc_w_s latency is 4. 7701cb0ef41Sopenharmony_ci return Latency::MFC1 + ExtLatency() + Latency::BRANCH + Latency::MOV_S + 4 + 7711cb0ef41Sopenharmony_ci Latency::MFC1 + Latency::BRANCH + Latency::CVT_S_W; 7721cb0ef41Sopenharmony_ci } 7731cb0ef41Sopenharmony_ci} 7741cb0ef41Sopenharmony_ci 7751cb0ef41Sopenharmony_ciint CvtDUwLatency() { 7761cb0ef41Sopenharmony_ci if (IsFp64Mode()) { 7771cb0ef41Sopenharmony_ci return Latency::MTC1 + Mthc1Latency() + Latency::CVT_D_L; 7781cb0ef41Sopenharmony_ci } else { 7791cb0ef41Sopenharmony_ci return Latency::BRANCH + Latency::MTC1 + 1 + Latency::MTC1 + 7801cb0ef41Sopenharmony_ci Mthc1Latency() + Latency::CVT_D_W + Latency::BRANCH + 7811cb0ef41Sopenharmony_ci Latency::ADD_D + Latency::CVT_D_W; 7821cb0ef41Sopenharmony_ci } 7831cb0ef41Sopenharmony_ci} 7841cb0ef41Sopenharmony_ci 7851cb0ef41Sopenharmony_ciint CvtSUwLatency() { return CvtDUwLatency() + Latency::CVT_S_D; } 7861cb0ef41Sopenharmony_ci 7871cb0ef41Sopenharmony_ciint Floor_w_dLatency() { 7881cb0ef41Sopenharmony_ci if (IsMipsArchVariant(kLoongson)) { 7891cb0ef41Sopenharmony_ci return Mfhc1Latency() + Latency::FLOOR_W_D + Mthc1Latency(); 7901cb0ef41Sopenharmony_ci } else { 7911cb0ef41Sopenharmony_ci return Latency::FLOOR_W_D; 7921cb0ef41Sopenharmony_ci } 7931cb0ef41Sopenharmony_ci} 7941cb0ef41Sopenharmony_ci 7951cb0ef41Sopenharmony_ciint FloorWDLatency() { return Floor_w_dLatency() + Latency::MFC1; } 7961cb0ef41Sopenharmony_ci 7971cb0ef41Sopenharmony_ciint Ceil_w_dLatency() { 7981cb0ef41Sopenharmony_ci if (IsMipsArchVariant(kLoongson)) { 7991cb0ef41Sopenharmony_ci return Mfhc1Latency() + Latency::CEIL_W_D + Mthc1Latency(); 8001cb0ef41Sopenharmony_ci } else { 8011cb0ef41Sopenharmony_ci return Latency::CEIL_W_D; 8021cb0ef41Sopenharmony_ci } 8031cb0ef41Sopenharmony_ci} 8041cb0ef41Sopenharmony_ci 8051cb0ef41Sopenharmony_ciint CeilWDLatency() { return Ceil_w_dLatency() + Latency::MFC1; } 8061cb0ef41Sopenharmony_ci 8071cb0ef41Sopenharmony_ciint Round_w_dLatency() { 8081cb0ef41Sopenharmony_ci if (IsMipsArchVariant(kLoongson)) { 8091cb0ef41Sopenharmony_ci return Mfhc1Latency() + Latency::ROUND_W_D + Mthc1Latency(); 8101cb0ef41Sopenharmony_ci } else { 8111cb0ef41Sopenharmony_ci return Latency::ROUND_W_D; 8121cb0ef41Sopenharmony_ci } 8131cb0ef41Sopenharmony_ci} 8141cb0ef41Sopenharmony_ci 8151cb0ef41Sopenharmony_ciint RoundWDLatency() { return Round_w_dLatency() + Latency::MFC1; } 8161cb0ef41Sopenharmony_ci 8171cb0ef41Sopenharmony_ciint Trunc_w_dLatency() { 8181cb0ef41Sopenharmony_ci if (IsMipsArchVariant(kLoongson)) { 8191cb0ef41Sopenharmony_ci return Mfhc1Latency() + Latency::TRUNC_W_D + Mthc1Latency(); 8201cb0ef41Sopenharmony_ci } else { 8211cb0ef41Sopenharmony_ci return Latency::TRUNC_W_D; 8221cb0ef41Sopenharmony_ci } 8231cb0ef41Sopenharmony_ci} 8241cb0ef41Sopenharmony_ci 8251cb0ef41Sopenharmony_ciint MovnLatency() { 8261cb0ef41Sopenharmony_ci if (IsMipsArchVariant(kLoongson) || IsMipsArchVariant(kMips32r6)) { 8271cb0ef41Sopenharmony_ci return Latency::BRANCH + 1; 8281cb0ef41Sopenharmony_ci } else { 8291cb0ef41Sopenharmony_ci return 1; 8301cb0ef41Sopenharmony_ci } 8311cb0ef41Sopenharmony_ci} 8321cb0ef41Sopenharmony_ci 8331cb0ef41Sopenharmony_ciint Trunc_uw_dLatency() { 8341cb0ef41Sopenharmony_ci return 1 + Latency::MTC1 + Mthc1Latency() + Latency::BRANCH + Latency::SUB_D + 8351cb0ef41Sopenharmony_ci Latency::TRUNC_W_D + Latency::MFC1 + OrLatency(false) + 8361cb0ef41Sopenharmony_ci Latency::BRANCH + Latency::TRUNC_W_D + Latency::MFC1; 8371cb0ef41Sopenharmony_ci} 8381cb0ef41Sopenharmony_ci 8391cb0ef41Sopenharmony_ciint Trunc_uw_sLatency() { 8401cb0ef41Sopenharmony_ci return 1 + Latency::MTC1 + Latency::BRANCH + Latency::SUB_S + 8411cb0ef41Sopenharmony_ci Latency::TRUNC_W_S + Latency::MFC1 + OrLatency(false) + 8421cb0ef41Sopenharmony_ci Latency::TRUNC_W_S + Latency::MFC1; 8431cb0ef41Sopenharmony_ci} 8441cb0ef41Sopenharmony_ci 8451cb0ef41Sopenharmony_ciint MovzLatency() { 8461cb0ef41Sopenharmony_ci if (IsMipsArchVariant(kLoongson) || IsMipsArchVariant(kMips32r6)) { 8471cb0ef41Sopenharmony_ci return Latency::BRANCH + 1; 8481cb0ef41Sopenharmony_ci } else { 8491cb0ef41Sopenharmony_ci return 1; 8501cb0ef41Sopenharmony_ci } 8511cb0ef41Sopenharmony_ci} 8521cb0ef41Sopenharmony_ci 8531cb0ef41Sopenharmony_ciint FmoveLowLatency() { 8541cb0ef41Sopenharmony_ci if (IsFp32Mode()) { 8551cb0ef41Sopenharmony_ci return Latency::MTC1; 8561cb0ef41Sopenharmony_ci } else { 8571cb0ef41Sopenharmony_ci return Latency::MFHC1 + Latency::MTC1 + Latency::MTHC1; 8581cb0ef41Sopenharmony_ci } 8591cb0ef41Sopenharmony_ci} 8601cb0ef41Sopenharmony_ci 8611cb0ef41Sopenharmony_ciint SebLatency() { 8621cb0ef41Sopenharmony_ci if (IsMipsArchVariant(kMips32r2) || IsMipsArchVariant(kMips32r6)) { 8631cb0ef41Sopenharmony_ci return 1; 8641cb0ef41Sopenharmony_ci } else { 8651cb0ef41Sopenharmony_ci return 2; 8661cb0ef41Sopenharmony_ci } 8671cb0ef41Sopenharmony_ci} 8681cb0ef41Sopenharmony_ci 8691cb0ef41Sopenharmony_ciint SehLatency() { 8701cb0ef41Sopenharmony_ci if (IsMipsArchVariant(kMips32r2) || IsMipsArchVariant(kMips32r6)) { 8711cb0ef41Sopenharmony_ci return 1; 8721cb0ef41Sopenharmony_ci } else { 8731cb0ef41Sopenharmony_ci return 2; 8741cb0ef41Sopenharmony_ci } 8751cb0ef41Sopenharmony_ci} 8761cb0ef41Sopenharmony_ci 8771cb0ef41Sopenharmony_ciint UlhuLatency() { 8781cb0ef41Sopenharmony_ci if (IsMipsArchVariant(kMips32r6)) { 8791cb0ef41Sopenharmony_ci return 1; 8801cb0ef41Sopenharmony_ci } else { 8811cb0ef41Sopenharmony_ci return 4; 8821cb0ef41Sopenharmony_ci } 8831cb0ef41Sopenharmony_ci} 8841cb0ef41Sopenharmony_ci 8851cb0ef41Sopenharmony_ciint UlhLatency() { 8861cb0ef41Sopenharmony_ci if (IsMipsArchVariant(kMips32r6)) { 8871cb0ef41Sopenharmony_ci return 1; 8881cb0ef41Sopenharmony_ci } else { 8891cb0ef41Sopenharmony_ci return 4; 8901cb0ef41Sopenharmony_ci } 8911cb0ef41Sopenharmony_ci} 8921cb0ef41Sopenharmony_ci 8931cb0ef41Sopenharmony_ciint AdjustBaseAndOffsetLatency() { 8941cb0ef41Sopenharmony_ci return 3; // Estimated max. 8951cb0ef41Sopenharmony_ci} 8961cb0ef41Sopenharmony_ci 8971cb0ef41Sopenharmony_ciint UshLatency() { 8981cb0ef41Sopenharmony_ci if (IsMipsArchVariant(kMips32r6)) { 8991cb0ef41Sopenharmony_ci return 1; 9001cb0ef41Sopenharmony_ci } else { 9011cb0ef41Sopenharmony_ci return AdjustBaseAndOffsetLatency() + 4; // Estimated max. 9021cb0ef41Sopenharmony_ci } 9031cb0ef41Sopenharmony_ci} 9041cb0ef41Sopenharmony_ci 9051cb0ef41Sopenharmony_ciint UlwLatency() { 9061cb0ef41Sopenharmony_ci if (IsMipsArchVariant(kMips32r6)) { 9071cb0ef41Sopenharmony_ci return 1; 9081cb0ef41Sopenharmony_ci } else { 9091cb0ef41Sopenharmony_ci return AdjustBaseAndOffsetLatency() + 3; // Estimated max. 9101cb0ef41Sopenharmony_ci } 9111cb0ef41Sopenharmony_ci} 9121cb0ef41Sopenharmony_ci 9131cb0ef41Sopenharmony_ciint UswLatency() { 9141cb0ef41Sopenharmony_ci if (IsMipsArchVariant(kMips32r6)) { 9151cb0ef41Sopenharmony_ci return 1; 9161cb0ef41Sopenharmony_ci } else { 9171cb0ef41Sopenharmony_ci return AdjustBaseAndOffsetLatency() + 2; 9181cb0ef41Sopenharmony_ci } 9191cb0ef41Sopenharmony_ci} 9201cb0ef41Sopenharmony_ci 9211cb0ef41Sopenharmony_ciint Ulwc1Latency() { 9221cb0ef41Sopenharmony_ci if (IsMipsArchVariant(kMips32r6)) { 9231cb0ef41Sopenharmony_ci return Latency::LWC1; 9241cb0ef41Sopenharmony_ci } else { 9251cb0ef41Sopenharmony_ci return UlwLatency() + Latency::MTC1; 9261cb0ef41Sopenharmony_ci } 9271cb0ef41Sopenharmony_ci} 9281cb0ef41Sopenharmony_ci 9291cb0ef41Sopenharmony_ciint Uswc1Latency() { 9301cb0ef41Sopenharmony_ci if (IsMipsArchVariant(kMips32r6)) { 9311cb0ef41Sopenharmony_ci return Latency::SWC1; 9321cb0ef41Sopenharmony_ci } else { 9331cb0ef41Sopenharmony_ci return Latency::MFC1 + UswLatency(); 9341cb0ef41Sopenharmony_ci } 9351cb0ef41Sopenharmony_ci} 9361cb0ef41Sopenharmony_ci 9371cb0ef41Sopenharmony_ciint Ldc1Latency() { 9381cb0ef41Sopenharmony_ci int latency = AdjustBaseAndOffsetLatency() + Latency::LWC1; 9391cb0ef41Sopenharmony_ci if (IsFp32Mode()) { 9401cb0ef41Sopenharmony_ci return latency + Latency::LWC1; 9411cb0ef41Sopenharmony_ci } else { 9421cb0ef41Sopenharmony_ci return latency + 1 + Mthc1Latency(); 9431cb0ef41Sopenharmony_ci } 9441cb0ef41Sopenharmony_ci} 9451cb0ef41Sopenharmony_ci 9461cb0ef41Sopenharmony_ciint Uldc1Latency() { 9471cb0ef41Sopenharmony_ci if (IsMipsArchVariant(kMips32r6)) { 9481cb0ef41Sopenharmony_ci return Ldc1Latency(); 9491cb0ef41Sopenharmony_ci } else { 9501cb0ef41Sopenharmony_ci return 2 * UlwLatency() + Latency::MTC1 + Mthc1Latency(); 9511cb0ef41Sopenharmony_ci } 9521cb0ef41Sopenharmony_ci} 9531cb0ef41Sopenharmony_ci 9541cb0ef41Sopenharmony_ciint Sdc1Latency() { 9551cb0ef41Sopenharmony_ci int latency = AdjustBaseAndOffsetLatency() + Latency::SWC1; 9561cb0ef41Sopenharmony_ci if (IsFp32Mode()) { 9571cb0ef41Sopenharmony_ci return latency + Latency::SWC1; 9581cb0ef41Sopenharmony_ci } else { 9591cb0ef41Sopenharmony_ci return latency + Mfhc1Latency() + 1; 9601cb0ef41Sopenharmony_ci } 9611cb0ef41Sopenharmony_ci} 9621cb0ef41Sopenharmony_ci 9631cb0ef41Sopenharmony_ciint Usdc1Latency() { 9641cb0ef41Sopenharmony_ci if (IsMipsArchVariant(kMips32r6)) { 9651cb0ef41Sopenharmony_ci return Sdc1Latency(); 9661cb0ef41Sopenharmony_ci } else { 9671cb0ef41Sopenharmony_ci return Latency::MFC1 + 2 * UswLatency() + Mfhc1Latency(); 9681cb0ef41Sopenharmony_ci } 9691cb0ef41Sopenharmony_ci} 9701cb0ef41Sopenharmony_ci 9711cb0ef41Sopenharmony_ciint PushRegisterLatency() { return AdduLatency(false) + 1; } 9721cb0ef41Sopenharmony_ci 9731cb0ef41Sopenharmony_ciint ByteSwapSignedLatency() { 9741cb0ef41Sopenharmony_ci // operand_size == 4 9751cb0ef41Sopenharmony_ci if (IsMipsArchVariant(kMips32r2) || IsMipsArchVariant(kMips32r6)) { 9761cb0ef41Sopenharmony_ci return 2; 9771cb0ef41Sopenharmony_ci } else if (IsMipsArchVariant(kMips32r1) || IsMipsArchVariant(kLoongson)) { 9781cb0ef41Sopenharmony_ci return 10; 9791cb0ef41Sopenharmony_ci } 9801cb0ef41Sopenharmony_ci} 9811cb0ef41Sopenharmony_ci 9821cb0ef41Sopenharmony_ciint LlLatency(int offset) { 9831cb0ef41Sopenharmony_ci bool is_one_instruction = 9841cb0ef41Sopenharmony_ci IsMipsArchVariant(kMips32r6) ? is_int9(offset) : is_int16(offset); 9851cb0ef41Sopenharmony_ci if (is_one_instruction) { 9861cb0ef41Sopenharmony_ci return 1; 9871cb0ef41Sopenharmony_ci } else { 9881cb0ef41Sopenharmony_ci return 3; 9891cb0ef41Sopenharmony_ci } 9901cb0ef41Sopenharmony_ci} 9911cb0ef41Sopenharmony_ci 9921cb0ef41Sopenharmony_ciint ExtractBitsLatency(int size, bool sign_extend) { 9931cb0ef41Sopenharmony_ci int latency = 1 + ExtLatency(); 9941cb0ef41Sopenharmony_ci if (size == 8) { 9951cb0ef41Sopenharmony_ci if (sign_extend) { 9961cb0ef41Sopenharmony_ci return latency + SebLatency(); 9971cb0ef41Sopenharmony_ci } else { 9981cb0ef41Sopenharmony_ci return 0; 9991cb0ef41Sopenharmony_ci } 10001cb0ef41Sopenharmony_ci } else if (size == 16) { 10011cb0ef41Sopenharmony_ci if (sign_extend) { 10021cb0ef41Sopenharmony_ci return latency + SehLatency(); 10031cb0ef41Sopenharmony_ci } else { 10041cb0ef41Sopenharmony_ci return 0; 10051cb0ef41Sopenharmony_ci } 10061cb0ef41Sopenharmony_ci } else { 10071cb0ef41Sopenharmony_ci UNREACHABLE(); 10081cb0ef41Sopenharmony_ci } 10091cb0ef41Sopenharmony_ci} 10101cb0ef41Sopenharmony_ci 10111cb0ef41Sopenharmony_ciint NegLatency() { return 1; } 10121cb0ef41Sopenharmony_ci 10131cb0ef41Sopenharmony_ciint InsertBitsLatency() { 10141cb0ef41Sopenharmony_ci return RorLatency() + InsLatency() + SubuLatency(false) + NegLatency() + 10151cb0ef41Sopenharmony_ci RorLatency(); 10161cb0ef41Sopenharmony_ci} 10171cb0ef41Sopenharmony_ci 10181cb0ef41Sopenharmony_ciint ScLatency(int offset) { 10191cb0ef41Sopenharmony_ci bool is_one_instruction = 10201cb0ef41Sopenharmony_ci IsMipsArchVariant(kMips32r6) ? is_int9(offset) : is_int16(offset); 10211cb0ef41Sopenharmony_ci if (is_one_instruction) { 10221cb0ef41Sopenharmony_ci return 1; 10231cb0ef41Sopenharmony_ci } else { 10241cb0ef41Sopenharmony_ci return 3; 10251cb0ef41Sopenharmony_ci } 10261cb0ef41Sopenharmony_ci} 10271cb0ef41Sopenharmony_ci 10281cb0ef41Sopenharmony_ciint BranchShortHelperR6Latency() { 10291cb0ef41Sopenharmony_ci return 2; // Estimated max. 10301cb0ef41Sopenharmony_ci} 10311cb0ef41Sopenharmony_ci 10321cb0ef41Sopenharmony_ciint BranchShortHelperLatency() { 10331cb0ef41Sopenharmony_ci return SltLatency() + 2; // Estimated max. 10341cb0ef41Sopenharmony_ci} 10351cb0ef41Sopenharmony_ci 10361cb0ef41Sopenharmony_ciint BranchShortLatency(BranchDelaySlot bdslot = PROTECT) { 10371cb0ef41Sopenharmony_ci if (IsMipsArchVariant(kMips32r6) && bdslot == PROTECT) { 10381cb0ef41Sopenharmony_ci return BranchShortHelperR6Latency(); 10391cb0ef41Sopenharmony_ci } else { 10401cb0ef41Sopenharmony_ci return BranchShortHelperLatency(); 10411cb0ef41Sopenharmony_ci } 10421cb0ef41Sopenharmony_ci} 10431cb0ef41Sopenharmony_ci 10441cb0ef41Sopenharmony_ciint Word32AtomicExchangeLatency(bool sign_extend, int size) { 10451cb0ef41Sopenharmony_ci return AdduLatency() + 1 + SubuLatency() + 2 + LlLatency(0) + 10461cb0ef41Sopenharmony_ci ExtractBitsLatency(size, sign_extend) + InsertBitsLatency() + 10471cb0ef41Sopenharmony_ci ScLatency(0) + BranchShortLatency() + 1; 10481cb0ef41Sopenharmony_ci} 10491cb0ef41Sopenharmony_ci 10501cb0ef41Sopenharmony_ciint Word32AtomicCompareExchangeLatency(bool sign_extend, int size) { 10511cb0ef41Sopenharmony_ci return AdduLatency() + 1 + SubuLatency() + 2 + LlLatency(0) + 10521cb0ef41Sopenharmony_ci ExtractBitsLatency(size, sign_extend) + BranchShortLatency() + 1; 10531cb0ef41Sopenharmony_ci} 10541cb0ef41Sopenharmony_ci 10551cb0ef41Sopenharmony_ciint AddOverflowLatency() { 10561cb0ef41Sopenharmony_ci return 6; // Estimated max. 10571cb0ef41Sopenharmony_ci} 10581cb0ef41Sopenharmony_ci 10591cb0ef41Sopenharmony_ciint SubOverflowLatency() { 10601cb0ef41Sopenharmony_ci return 6; // Estimated max. 10611cb0ef41Sopenharmony_ci} 10621cb0ef41Sopenharmony_ci 10631cb0ef41Sopenharmony_ciint MulhLatency(bool is_operand_register = true) { 10641cb0ef41Sopenharmony_ci if (is_operand_register) { 10651cb0ef41Sopenharmony_ci if (!IsMipsArchVariant(kMips32r6)) { 10661cb0ef41Sopenharmony_ci return Latency::MULT + Latency::MFHI; 10671cb0ef41Sopenharmony_ci } else { 10681cb0ef41Sopenharmony_ci return Latency::MUH; 10691cb0ef41Sopenharmony_ci } 10701cb0ef41Sopenharmony_ci } else { 10711cb0ef41Sopenharmony_ci if (!IsMipsArchVariant(kMips32r6)) { 10721cb0ef41Sopenharmony_ci return 1 + Latency::MULT + Latency::MFHI; 10731cb0ef41Sopenharmony_ci } else { 10741cb0ef41Sopenharmony_ci return 1 + Latency::MUH; 10751cb0ef41Sopenharmony_ci } 10761cb0ef41Sopenharmony_ci } 10771cb0ef41Sopenharmony_ci} 10781cb0ef41Sopenharmony_ci 10791cb0ef41Sopenharmony_ciint MulhuLatency(bool is_operand_register = true) { 10801cb0ef41Sopenharmony_ci if (is_operand_register) { 10811cb0ef41Sopenharmony_ci if (!IsMipsArchVariant(kMips32r6)) { 10821cb0ef41Sopenharmony_ci return Latency::MULTU + Latency::MFHI; 10831cb0ef41Sopenharmony_ci } else { 10841cb0ef41Sopenharmony_ci return Latency::MUHU; 10851cb0ef41Sopenharmony_ci } 10861cb0ef41Sopenharmony_ci } else { 10871cb0ef41Sopenharmony_ci if (!IsMipsArchVariant(kMips32r6)) { 10881cb0ef41Sopenharmony_ci return 1 + Latency::MULTU + Latency::MFHI; 10891cb0ef41Sopenharmony_ci } else { 10901cb0ef41Sopenharmony_ci return 1 + Latency::MUHU; 10911cb0ef41Sopenharmony_ci } 10921cb0ef41Sopenharmony_ci } 10931cb0ef41Sopenharmony_ci} 10941cb0ef41Sopenharmony_ci 10951cb0ef41Sopenharmony_ciint MulOverflowLatency() { 10961cb0ef41Sopenharmony_ci return MulLatency() + 4; // Estimated max. 10971cb0ef41Sopenharmony_ci} 10981cb0ef41Sopenharmony_ci 10991cb0ef41Sopenharmony_ciint ModLatency(bool is_operand_register = true) { 11001cb0ef41Sopenharmony_ci if (is_operand_register) { 11011cb0ef41Sopenharmony_ci if (!IsMipsArchVariant(kMips32r6)) { 11021cb0ef41Sopenharmony_ci return Latency::DIV + Latency::MFHI; 11031cb0ef41Sopenharmony_ci } else { 11041cb0ef41Sopenharmony_ci return 1; 11051cb0ef41Sopenharmony_ci } 11061cb0ef41Sopenharmony_ci } else { 11071cb0ef41Sopenharmony_ci if (!IsMipsArchVariant(kMips32r6)) { 11081cb0ef41Sopenharmony_ci return 1 + Latency::DIV + Latency::MFHI; 11091cb0ef41Sopenharmony_ci } else { 11101cb0ef41Sopenharmony_ci return 2; 11111cb0ef41Sopenharmony_ci } 11121cb0ef41Sopenharmony_ci } 11131cb0ef41Sopenharmony_ci} 11141cb0ef41Sopenharmony_ci 11151cb0ef41Sopenharmony_ciint ModuLatency(bool is_operand_register = true) { 11161cb0ef41Sopenharmony_ci return ModLatency(is_operand_register); 11171cb0ef41Sopenharmony_ci} 11181cb0ef41Sopenharmony_ci 11191cb0ef41Sopenharmony_ciint DivLatency(bool is_operand_register = true) { 11201cb0ef41Sopenharmony_ci if (is_operand_register) { 11211cb0ef41Sopenharmony_ci if (!IsMipsArchVariant(kMips32r6)) { 11221cb0ef41Sopenharmony_ci return Latency::DIV + Latency::MFLO; 11231cb0ef41Sopenharmony_ci } else { 11241cb0ef41Sopenharmony_ci return Latency::DIV; 11251cb0ef41Sopenharmony_ci } 11261cb0ef41Sopenharmony_ci } else { 11271cb0ef41Sopenharmony_ci if (!IsMipsArchVariant(kMips32r6)) { 11281cb0ef41Sopenharmony_ci return 1 + Latency::DIV + Latency::MFLO; 11291cb0ef41Sopenharmony_ci } else { 11301cb0ef41Sopenharmony_ci return 1 + Latency::DIV; 11311cb0ef41Sopenharmony_ci } 11321cb0ef41Sopenharmony_ci } 11331cb0ef41Sopenharmony_ci} 11341cb0ef41Sopenharmony_ci 11351cb0ef41Sopenharmony_ciint DivuLatency(bool is_operand_register = true) { 11361cb0ef41Sopenharmony_ci if (is_operand_register) { 11371cb0ef41Sopenharmony_ci if (!IsMipsArchVariant(kMips32r6)) { 11381cb0ef41Sopenharmony_ci return Latency::DIVU + Latency::MFLO; 11391cb0ef41Sopenharmony_ci } else { 11401cb0ef41Sopenharmony_ci return Latency::DIVU; 11411cb0ef41Sopenharmony_ci } 11421cb0ef41Sopenharmony_ci } else { 11431cb0ef41Sopenharmony_ci if (!IsMipsArchVariant(kMips32r6)) { 11441cb0ef41Sopenharmony_ci return 1 + Latency::DIVU + Latency::MFLO; 11451cb0ef41Sopenharmony_ci } else { 11461cb0ef41Sopenharmony_ci return 1 + Latency::DIVU; 11471cb0ef41Sopenharmony_ci } 11481cb0ef41Sopenharmony_ci } 11491cb0ef41Sopenharmony_ci} 11501cb0ef41Sopenharmony_ci 11511cb0ef41Sopenharmony_ciint CtzLatency() { 11521cb0ef41Sopenharmony_ci if (IsMipsArchVariant(kMips32r6)) { 11531cb0ef41Sopenharmony_ci return RorLatency(false) + 2 + ClzLatency(); 11541cb0ef41Sopenharmony_ci } else { 11551cb0ef41Sopenharmony_ci return AdduLatency(false) + XorLatency() + AndLatency() + ClzLatency() + 1 + 11561cb0ef41Sopenharmony_ci SubuLatency(); 11571cb0ef41Sopenharmony_ci } 11581cb0ef41Sopenharmony_ci} 11591cb0ef41Sopenharmony_ci 11601cb0ef41Sopenharmony_ciint PopcntLatency() { 11611cb0ef41Sopenharmony_ci return 4 * AndLatency() + SubuLatency() + 2 * AdduLatency() + MulLatency() + 11621cb0ef41Sopenharmony_ci 8; 11631cb0ef41Sopenharmony_ci} 11641cb0ef41Sopenharmony_ci 11651cb0ef41Sopenharmony_ciint CompareFLatency() { return Latency::C_cond_S; } 11661cb0ef41Sopenharmony_ci 11671cb0ef41Sopenharmony_ciint CompareIsNanFLatency() { return CompareFLatency(); } 11681cb0ef41Sopenharmony_ci 11691cb0ef41Sopenharmony_ciint CompareIsNanF32Latency() { return CompareIsNanFLatency(); } 11701cb0ef41Sopenharmony_ci 11711cb0ef41Sopenharmony_ciint Neg_sLatency() { 11721cb0ef41Sopenharmony_ci if (IsMipsArchVariant(kMips32r6)) { 11731cb0ef41Sopenharmony_ci return Latency::NEG_S; 11741cb0ef41Sopenharmony_ci } else { 11751cb0ef41Sopenharmony_ci // Estimated. 11761cb0ef41Sopenharmony_ci return CompareIsNanF32Latency() + 2 * Latency::BRANCH + Latency::NEG_S + 11771cb0ef41Sopenharmony_ci Latency::MFC1 + 1 + XorLatency() + Latency::MTC1; 11781cb0ef41Sopenharmony_ci } 11791cb0ef41Sopenharmony_ci} 11801cb0ef41Sopenharmony_ci 11811cb0ef41Sopenharmony_ciint CompareIsNanF64Latency() { return CompareIsNanFLatency(); } 11821cb0ef41Sopenharmony_ci 11831cb0ef41Sopenharmony_ciint Neg_dLatency() { 11841cb0ef41Sopenharmony_ci if (IsMipsArchVariant(kMips32r6)) { 11851cb0ef41Sopenharmony_ci return Latency::NEG_D; 11861cb0ef41Sopenharmony_ci } else { 11871cb0ef41Sopenharmony_ci // Estimated. 11881cb0ef41Sopenharmony_ci return CompareIsNanF64Latency() + 2 * Latency::BRANCH + Latency::NEG_D + 11891cb0ef41Sopenharmony_ci Mfhc1Latency() + 1 + XorLatency() + Mthc1Latency(); 11901cb0ef41Sopenharmony_ci } 11911cb0ef41Sopenharmony_ci} 11921cb0ef41Sopenharmony_ci 11931cb0ef41Sopenharmony_ciint CompareF32Latency() { return CompareFLatency(); } 11941cb0ef41Sopenharmony_ci 11951cb0ef41Sopenharmony_ciint Move_sLatency() { 11961cb0ef41Sopenharmony_ci return Latency::MOV_S; // Estimated max. 11971cb0ef41Sopenharmony_ci} 11981cb0ef41Sopenharmony_ci 11991cb0ef41Sopenharmony_ciint Float32MaxLatency() { 12001cb0ef41Sopenharmony_ci // Estimated max. 12011cb0ef41Sopenharmony_ci int latency = CompareIsNanF32Latency() + Latency::BRANCH; 12021cb0ef41Sopenharmony_ci if (IsMipsArchVariant(kMips32r6)) { 12031cb0ef41Sopenharmony_ci return latency + Latency::MAX_S; 12041cb0ef41Sopenharmony_ci } else { 12051cb0ef41Sopenharmony_ci return latency + 5 * Latency::BRANCH + 2 * CompareF32Latency() + 12061cb0ef41Sopenharmony_ci Latency::MFC1 + Move_sLatency(); 12071cb0ef41Sopenharmony_ci } 12081cb0ef41Sopenharmony_ci} 12091cb0ef41Sopenharmony_ci 12101cb0ef41Sopenharmony_ciint CompareF64Latency() { return CompareF32Latency(); } 12111cb0ef41Sopenharmony_ci 12121cb0ef41Sopenharmony_ciint Move_dLatency() { 12131cb0ef41Sopenharmony_ci return Latency::MOV_D; // Estimated max. 12141cb0ef41Sopenharmony_ci} 12151cb0ef41Sopenharmony_ci 12161cb0ef41Sopenharmony_ciint Float64MaxLatency() { 12171cb0ef41Sopenharmony_ci // Estimated max. 12181cb0ef41Sopenharmony_ci int latency = CompareIsNanF64Latency() + Latency::BRANCH; 12191cb0ef41Sopenharmony_ci if (IsMipsArchVariant(kMips32r6)) { 12201cb0ef41Sopenharmony_ci return latency + Latency::MAX_D; 12211cb0ef41Sopenharmony_ci } else { 12221cb0ef41Sopenharmony_ci return latency + 5 * Latency::BRANCH + 2 * CompareF64Latency() + 12231cb0ef41Sopenharmony_ci Latency::MFHC1 + 2 * Move_dLatency(); 12241cb0ef41Sopenharmony_ci } 12251cb0ef41Sopenharmony_ci} 12261cb0ef41Sopenharmony_ci 12271cb0ef41Sopenharmony_ciint PrepareCallCFunctionLatency() { 12281cb0ef41Sopenharmony_ci int frame_alignment = TurboAssembler::ActivationFrameAlignment(); 12291cb0ef41Sopenharmony_ci if (frame_alignment > kSystemPointerSize) { 12301cb0ef41Sopenharmony_ci return 1 + SubuLatency(false) + AndLatency(false) + 1; 12311cb0ef41Sopenharmony_ci } else { 12321cb0ef41Sopenharmony_ci return SubuLatency(false); 12331cb0ef41Sopenharmony_ci } 12341cb0ef41Sopenharmony_ci} 12351cb0ef41Sopenharmony_ci 12361cb0ef41Sopenharmony_ciint MovToFloatParametersLatency() { return 2 * MoveLatency(); } 12371cb0ef41Sopenharmony_ci 12381cb0ef41Sopenharmony_ciint CallLatency() { 12391cb0ef41Sopenharmony_ci // Estimated. 12401cb0ef41Sopenharmony_ci return AdduLatency(false) + Latency::BRANCH + 3; 12411cb0ef41Sopenharmony_ci} 12421cb0ef41Sopenharmony_ci 12431cb0ef41Sopenharmony_ciint CallCFunctionHelperLatency() { 12441cb0ef41Sopenharmony_ci // Estimated. 12451cb0ef41Sopenharmony_ci int latency = AndLatency(false) + Latency::BRANCH + 2 + CallLatency(); 12461cb0ef41Sopenharmony_ci if (base::OS::ActivationFrameAlignment() > kSystemPointerSize) { 12471cb0ef41Sopenharmony_ci latency++; 12481cb0ef41Sopenharmony_ci } else { 12491cb0ef41Sopenharmony_ci latency += AdduLatency(false); 12501cb0ef41Sopenharmony_ci } 12511cb0ef41Sopenharmony_ci return latency; 12521cb0ef41Sopenharmony_ci} 12531cb0ef41Sopenharmony_ci 12541cb0ef41Sopenharmony_ciint CallCFunctionLatency() { return 1 + CallCFunctionHelperLatency(); } 12551cb0ef41Sopenharmony_ci 12561cb0ef41Sopenharmony_ciint MovFromFloatResultLatency() { return MoveLatency(); } 12571cb0ef41Sopenharmony_ci 12581cb0ef41Sopenharmony_ciint Float32MinLatency() { 12591cb0ef41Sopenharmony_ci // Estimated max. 12601cb0ef41Sopenharmony_ci return CompareIsNanF32Latency() + Latency::BRANCH + 12611cb0ef41Sopenharmony_ci 2 * (CompareF32Latency() + Latency::BRANCH) + Latency::MFC1 + 12621cb0ef41Sopenharmony_ci 2 * Latency::BRANCH + Move_sLatency(); 12631cb0ef41Sopenharmony_ci} 12641cb0ef41Sopenharmony_ci 12651cb0ef41Sopenharmony_ciint Float64MinLatency() { 12661cb0ef41Sopenharmony_ci // Estimated max. 12671cb0ef41Sopenharmony_ci return CompareIsNanF64Latency() + Latency::BRANCH + 12681cb0ef41Sopenharmony_ci 2 * (CompareF64Latency() + Latency::BRANCH) + Mfhc1Latency() + 12691cb0ef41Sopenharmony_ci 2 * Latency::BRANCH + Move_dLatency(); 12701cb0ef41Sopenharmony_ci} 12711cb0ef41Sopenharmony_ci 12721cb0ef41Sopenharmony_ciint SmiUntagLatency() { return 1; } 12731cb0ef41Sopenharmony_ci 12741cb0ef41Sopenharmony_ciint PrepareForTailCallLatency() { 12751cb0ef41Sopenharmony_ci // Estimated max. 12761cb0ef41Sopenharmony_ci return 2 * (LsaLatency() + AdduLatency(false)) + 2 + Latency::BRANCH + 12771cb0ef41Sopenharmony_ci Latency::BRANCH + 2 * SubuLatency(false) + 2 + Latency::BRANCH + 1; 12781cb0ef41Sopenharmony_ci} 12791cb0ef41Sopenharmony_ci 12801cb0ef41Sopenharmony_ciint JumpLatency() { 12811cb0ef41Sopenharmony_ci // Estimated max. 12821cb0ef41Sopenharmony_ci return 1 + AdduLatency(false) + Latency::BRANCH + 2; 12831cb0ef41Sopenharmony_ci} 12841cb0ef41Sopenharmony_ci 12851cb0ef41Sopenharmony_ciint AssertLatency() { return 1; } 12861cb0ef41Sopenharmony_ci 12871cb0ef41Sopenharmony_ciint MultiPushLatency() { 12881cb0ef41Sopenharmony_ci int latency = SubuLatency(false); 12891cb0ef41Sopenharmony_ci for (int16_t i = kNumRegisters - 1; i >= 0; i--) { 12901cb0ef41Sopenharmony_ci latency++; 12911cb0ef41Sopenharmony_ci } 12921cb0ef41Sopenharmony_ci return latency; 12931cb0ef41Sopenharmony_ci} 12941cb0ef41Sopenharmony_ci 12951cb0ef41Sopenharmony_ciint MultiPushFPULatency() { 12961cb0ef41Sopenharmony_ci int latency = SubuLatency(false); 12971cb0ef41Sopenharmony_ci for (int16_t i = kNumRegisters - 1; i >= 0; i--) { 12981cb0ef41Sopenharmony_ci latency += Sdc1Latency(); 12991cb0ef41Sopenharmony_ci } 13001cb0ef41Sopenharmony_ci return latency; 13011cb0ef41Sopenharmony_ci} 13021cb0ef41Sopenharmony_ci 13031cb0ef41Sopenharmony_ciint PushCallerSavedLatency(SaveFPRegsMode fp_mode) { 13041cb0ef41Sopenharmony_ci int latency = MultiPushLatency(); 13051cb0ef41Sopenharmony_ci if (fp_mode == SaveFPRegsMode::kSave) { 13061cb0ef41Sopenharmony_ci latency += MultiPushFPULatency(); 13071cb0ef41Sopenharmony_ci } 13081cb0ef41Sopenharmony_ci return latency; 13091cb0ef41Sopenharmony_ci} 13101cb0ef41Sopenharmony_ci 13111cb0ef41Sopenharmony_ciint MultiPopFPULatency() { 13121cb0ef41Sopenharmony_ci int latency = 0; 13131cb0ef41Sopenharmony_ci for (int16_t i = 0; i < kNumRegisters; i++) { 13141cb0ef41Sopenharmony_ci latency += Ldc1Latency(); 13151cb0ef41Sopenharmony_ci } 13161cb0ef41Sopenharmony_ci return latency++; 13171cb0ef41Sopenharmony_ci} 13181cb0ef41Sopenharmony_ci 13191cb0ef41Sopenharmony_ciint MultiPopLatency() { 13201cb0ef41Sopenharmony_ci int latency = 0; 13211cb0ef41Sopenharmony_ci for (int16_t i = 0; i < kNumRegisters; i++) { 13221cb0ef41Sopenharmony_ci latency++; 13231cb0ef41Sopenharmony_ci } 13241cb0ef41Sopenharmony_ci return latency++; 13251cb0ef41Sopenharmony_ci} 13261cb0ef41Sopenharmony_ci 13271cb0ef41Sopenharmony_ciint PopCallerSavedLatency(SaveFPRegsMode fp_mode) { 13281cb0ef41Sopenharmony_ci int latency = 0; 13291cb0ef41Sopenharmony_ci if (fp_mode == SaveFPRegsMode::kSave) { 13301cb0ef41Sopenharmony_ci latency += MultiPopFPULatency(); 13311cb0ef41Sopenharmony_ci } 13321cb0ef41Sopenharmony_ci return latency + MultiPopLatency(); 13331cb0ef41Sopenharmony_ci} 13341cb0ef41Sopenharmony_ci 13351cb0ef41Sopenharmony_ciint AssembleArchJumpLatency() { 13361cb0ef41Sopenharmony_ci // Estimated max. 13371cb0ef41Sopenharmony_ci return Latency::BRANCH; 13381cb0ef41Sopenharmony_ci} 13391cb0ef41Sopenharmony_ci 13401cb0ef41Sopenharmony_ciint AssembleArchBinarySearchSwitchLatency(int cases) { 13411cb0ef41Sopenharmony_ci if (cases < CodeGenerator::kBinarySearchSwitchMinimalCases) { 13421cb0ef41Sopenharmony_ci return cases * (1 + Latency::BRANCH) + AssembleArchJumpLatency(); 13431cb0ef41Sopenharmony_ci } 13441cb0ef41Sopenharmony_ci return 1 + Latency::BRANCH + AssembleArchBinarySearchSwitchLatency(cases / 2); 13451cb0ef41Sopenharmony_ci} 13461cb0ef41Sopenharmony_ci 13471cb0ef41Sopenharmony_ciint GenerateSwitchTableLatency() { 13481cb0ef41Sopenharmony_ci int latency = 0; 13491cb0ef41Sopenharmony_ci if (kArchVariant >= kMips32r6) { 13501cb0ef41Sopenharmony_ci latency = LsaLatency() + 2; 13511cb0ef41Sopenharmony_ci } else { 13521cb0ef41Sopenharmony_ci latency = 6; 13531cb0ef41Sopenharmony_ci } 13541cb0ef41Sopenharmony_ci latency += 2; 13551cb0ef41Sopenharmony_ci return latency; 13561cb0ef41Sopenharmony_ci} 13571cb0ef41Sopenharmony_ci 13581cb0ef41Sopenharmony_ciint AssembleArchTableSwitchLatency() { 13591cb0ef41Sopenharmony_ci return Latency::BRANCH + GenerateSwitchTableLatency(); 13601cb0ef41Sopenharmony_ci} 13611cb0ef41Sopenharmony_ci 13621cb0ef41Sopenharmony_ciint AssembleReturnLatency() { 13631cb0ef41Sopenharmony_ci // Estimated max. 13641cb0ef41Sopenharmony_ci return AdduLatency(false) + MultiPopLatency() + MultiPopFPULatency() + 13651cb0ef41Sopenharmony_ci Latency::BRANCH + 1 + AdduLatency() + 8; 13661cb0ef41Sopenharmony_ci} 13671cb0ef41Sopenharmony_ci 13681cb0ef41Sopenharmony_ciint TryInlineTruncateDoubleToILatency() { 13691cb0ef41Sopenharmony_ci return 2 + Latency::TRUNC_W_D + Latency::MFC1 + 2 + AndLatency(false) + 13701cb0ef41Sopenharmony_ci Latency::BRANCH; 13711cb0ef41Sopenharmony_ci} 13721cb0ef41Sopenharmony_ci 13731cb0ef41Sopenharmony_ciint CallStubDelayedLatency() { return 1 + CallLatency(); } 13741cb0ef41Sopenharmony_ci 13751cb0ef41Sopenharmony_ciint TruncateDoubleToIDelayedLatency() { 13761cb0ef41Sopenharmony_ci // TODO(mips): This no longer reflects how TruncateDoubleToI is called. 13771cb0ef41Sopenharmony_ci return TryInlineTruncateDoubleToILatency() + 1 + SubuLatency(false) + 13781cb0ef41Sopenharmony_ci Sdc1Latency() + CallStubDelayedLatency() + AdduLatency(false) + 1; 13791cb0ef41Sopenharmony_ci} 13801cb0ef41Sopenharmony_ci 13811cb0ef41Sopenharmony_ciint CheckPageFlagLatency() { 13821cb0ef41Sopenharmony_ci return 2 * AndLatency(false) + 1 + Latency::BRANCH; 13831cb0ef41Sopenharmony_ci} 13841cb0ef41Sopenharmony_ci 13851cb0ef41Sopenharmony_ciint InstructionScheduler::GetInstructionLatency(const Instruction* instr) { 13861cb0ef41Sopenharmony_ci // Basic latency modeling for MIPS32 instructions. They have been determined 13871cb0ef41Sopenharmony_ci // in an empirical way. 13881cb0ef41Sopenharmony_ci switch (instr->arch_opcode()) { 13891cb0ef41Sopenharmony_ci case kArchCallCodeObject: 13901cb0ef41Sopenharmony_ci#if V8_ENABLE_WEBASSEMBLY 13911cb0ef41Sopenharmony_ci case kArchCallWasmFunction: 13921cb0ef41Sopenharmony_ci#endif // V8_ENABLE_WEBASSEMBLY 13931cb0ef41Sopenharmony_ci return CallLatency(); 13941cb0ef41Sopenharmony_ci case kArchTailCallCodeObject: 13951cb0ef41Sopenharmony_ci#if V8_ENABLE_WEBASSEMBLY 13961cb0ef41Sopenharmony_ci case kArchTailCallWasm: 13971cb0ef41Sopenharmony_ci#endif // V8_ENABLE_WEBASSEMBLY 13981cb0ef41Sopenharmony_ci case kArchTailCallAddress: 13991cb0ef41Sopenharmony_ci return JumpLatency(); 14001cb0ef41Sopenharmony_ci case kArchCallJSFunction: { 14011cb0ef41Sopenharmony_ci int latency = 0; 14021cb0ef41Sopenharmony_ci if (FLAG_debug_code) { 14031cb0ef41Sopenharmony_ci latency = 1 + AssertLatency(); 14041cb0ef41Sopenharmony_ci } 14051cb0ef41Sopenharmony_ci return latency + 1 + AdduLatency(false) + CallLatency(); 14061cb0ef41Sopenharmony_ci } 14071cb0ef41Sopenharmony_ci case kArchPrepareCallCFunction: 14081cb0ef41Sopenharmony_ci return PrepareCallCFunctionLatency(); 14091cb0ef41Sopenharmony_ci case kArchSaveCallerRegisters: { 14101cb0ef41Sopenharmony_ci auto fp_mode = 14111cb0ef41Sopenharmony_ci static_cast<SaveFPRegsMode>(MiscField::decode(instr->opcode())); 14121cb0ef41Sopenharmony_ci return PushCallerSavedLatency(fp_mode); 14131cb0ef41Sopenharmony_ci } 14141cb0ef41Sopenharmony_ci case kArchRestoreCallerRegisters: { 14151cb0ef41Sopenharmony_ci auto fp_mode = 14161cb0ef41Sopenharmony_ci static_cast<SaveFPRegsMode>(MiscField::decode(instr->opcode())); 14171cb0ef41Sopenharmony_ci return PopCallerSavedLatency(fp_mode); 14181cb0ef41Sopenharmony_ci } 14191cb0ef41Sopenharmony_ci case kArchPrepareTailCall: 14201cb0ef41Sopenharmony_ci return 2; // Estimated max. 14211cb0ef41Sopenharmony_ci case kArchCallCFunction: 14221cb0ef41Sopenharmony_ci return CallCFunctionLatency(); 14231cb0ef41Sopenharmony_ci case kArchJmp: 14241cb0ef41Sopenharmony_ci return AssembleArchJumpLatency(); 14251cb0ef41Sopenharmony_ci case kArchBinarySearchSwitch: 14261cb0ef41Sopenharmony_ci return AssembleArchBinarySearchSwitchLatency((instr->InputCount() - 2) / 14271cb0ef41Sopenharmony_ci 2); 14281cb0ef41Sopenharmony_ci case kArchTableSwitch: 14291cb0ef41Sopenharmony_ci return AssembleArchTableSwitchLatency(); 14301cb0ef41Sopenharmony_ci case kArchAbortCSADcheck: 14311cb0ef41Sopenharmony_ci return CallLatency() + 1; 14321cb0ef41Sopenharmony_ci case kArchComment: 14331cb0ef41Sopenharmony_ci case kArchDeoptimize: 14341cb0ef41Sopenharmony_ci return 0; 14351cb0ef41Sopenharmony_ci case kArchRet: 14361cb0ef41Sopenharmony_ci return AssembleReturnLatency(); 14371cb0ef41Sopenharmony_ci case kArchTruncateDoubleToI: 14381cb0ef41Sopenharmony_ci return TruncateDoubleToIDelayedLatency(); 14391cb0ef41Sopenharmony_ci case kArchStoreWithWriteBarrier: 14401cb0ef41Sopenharmony_ci return AdduLatency() + 1 + CheckPageFlagLatency(); 14411cb0ef41Sopenharmony_ci case kArchStackSlot: { 14421cb0ef41Sopenharmony_ci // Estimated max. 14431cb0ef41Sopenharmony_ci return AdduLatency(false) + AndLatency(false) + AssertLatency() + 14441cb0ef41Sopenharmony_ci AdduLatency(false) + AndLatency(false) + BranchShortLatency() + 1 + 14451cb0ef41Sopenharmony_ci SubuLatency() + AdduLatency(); 14461cb0ef41Sopenharmony_ci } 14471cb0ef41Sopenharmony_ci case kIeee754Float64Acos: 14481cb0ef41Sopenharmony_ci case kIeee754Float64Acosh: 14491cb0ef41Sopenharmony_ci case kIeee754Float64Asin: 14501cb0ef41Sopenharmony_ci case kIeee754Float64Asinh: 14511cb0ef41Sopenharmony_ci case kIeee754Float64Atan: 14521cb0ef41Sopenharmony_ci case kIeee754Float64Atanh: 14531cb0ef41Sopenharmony_ci case kIeee754Float64Atan2: 14541cb0ef41Sopenharmony_ci case kIeee754Float64Cos: 14551cb0ef41Sopenharmony_ci case kIeee754Float64Cosh: 14561cb0ef41Sopenharmony_ci case kIeee754Float64Cbrt: 14571cb0ef41Sopenharmony_ci case kIeee754Float64Exp: 14581cb0ef41Sopenharmony_ci case kIeee754Float64Expm1: 14591cb0ef41Sopenharmony_ci case kIeee754Float64Log: 14601cb0ef41Sopenharmony_ci case kIeee754Float64Log1p: 14611cb0ef41Sopenharmony_ci case kIeee754Float64Log10: 14621cb0ef41Sopenharmony_ci case kIeee754Float64Log2: 14631cb0ef41Sopenharmony_ci case kIeee754Float64Pow: 14641cb0ef41Sopenharmony_ci case kIeee754Float64Sin: 14651cb0ef41Sopenharmony_ci case kIeee754Float64Sinh: 14661cb0ef41Sopenharmony_ci case kIeee754Float64Tan: 14671cb0ef41Sopenharmony_ci case kIeee754Float64Tanh: 14681cb0ef41Sopenharmony_ci return PrepareCallCFunctionLatency() + MovToFloatParametersLatency() + 14691cb0ef41Sopenharmony_ci CallCFunctionLatency() + MovFromFloatResultLatency(); 14701cb0ef41Sopenharmony_ci case kMipsAdd: 14711cb0ef41Sopenharmony_ci return AdduLatency(instr->InputAt(1)->IsRegister()); 14721cb0ef41Sopenharmony_ci case kMipsAnd: 14731cb0ef41Sopenharmony_ci return AndLatency(instr->InputAt(1)->IsRegister()); 14741cb0ef41Sopenharmony_ci case kMipsOr: 14751cb0ef41Sopenharmony_ci return OrLatency(instr->InputAt(1)->IsRegister()); 14761cb0ef41Sopenharmony_ci case kMipsXor: 14771cb0ef41Sopenharmony_ci return XorLatency(instr->InputAt(1)->IsRegister()); 14781cb0ef41Sopenharmony_ci case kMipsSub: 14791cb0ef41Sopenharmony_ci return SubuLatency(instr->InputAt(1)->IsRegister()); 14801cb0ef41Sopenharmony_ci case kMipsNor: 14811cb0ef41Sopenharmony_ci return NorLatency(instr->InputAt(1)->IsRegister()); 14821cb0ef41Sopenharmony_ci case kMipsAddOvf: 14831cb0ef41Sopenharmony_ci return AddOverflowLatency(); 14841cb0ef41Sopenharmony_ci case kMipsSubOvf: 14851cb0ef41Sopenharmony_ci return SubOverflowLatency(); 14861cb0ef41Sopenharmony_ci case kMipsMul: 14871cb0ef41Sopenharmony_ci return MulLatency(false); 14881cb0ef41Sopenharmony_ci case kMipsMulHigh: 14891cb0ef41Sopenharmony_ci return MulhLatency(instr->InputAt(1)->IsRegister()); 14901cb0ef41Sopenharmony_ci case kMipsMulHighU: 14911cb0ef41Sopenharmony_ci return MulhuLatency(instr->InputAt(1)->IsRegister()); 14921cb0ef41Sopenharmony_ci case kMipsMulOvf: 14931cb0ef41Sopenharmony_ci return MulOverflowLatency(); 14941cb0ef41Sopenharmony_ci case kMipsMod: 14951cb0ef41Sopenharmony_ci return ModLatency(instr->InputAt(1)->IsRegister()); 14961cb0ef41Sopenharmony_ci case kMipsModU: 14971cb0ef41Sopenharmony_ci return ModuLatency(instr->InputAt(1)->IsRegister()); 14981cb0ef41Sopenharmony_ci case kMipsDiv: { 14991cb0ef41Sopenharmony_ci int latency = DivLatency(instr->InputAt(1)->IsRegister()); 15001cb0ef41Sopenharmony_ci if (IsMipsArchVariant(kMips32r6)) { 15011cb0ef41Sopenharmony_ci return latency++; 15021cb0ef41Sopenharmony_ci } else { 15031cb0ef41Sopenharmony_ci return latency + MovzLatency(); 15041cb0ef41Sopenharmony_ci } 15051cb0ef41Sopenharmony_ci } 15061cb0ef41Sopenharmony_ci case kMipsDivU: { 15071cb0ef41Sopenharmony_ci int latency = DivuLatency(instr->InputAt(1)->IsRegister()); 15081cb0ef41Sopenharmony_ci if (IsMipsArchVariant(kMips32r6)) { 15091cb0ef41Sopenharmony_ci return latency++; 15101cb0ef41Sopenharmony_ci } else { 15111cb0ef41Sopenharmony_ci return latency + MovzLatency(); 15121cb0ef41Sopenharmony_ci } 15131cb0ef41Sopenharmony_ci } 15141cb0ef41Sopenharmony_ci case kMipsClz: 15151cb0ef41Sopenharmony_ci return ClzLatency(); 15161cb0ef41Sopenharmony_ci case kMipsCtz: 15171cb0ef41Sopenharmony_ci return CtzLatency(); 15181cb0ef41Sopenharmony_ci case kMipsPopcnt: 15191cb0ef41Sopenharmony_ci return PopcntLatency(); 15201cb0ef41Sopenharmony_ci case kMipsShlPair: { 15211cb0ef41Sopenharmony_ci if (instr->InputAt(2)->IsRegister()) { 15221cb0ef41Sopenharmony_ci return ShlPairLatency(); 15231cb0ef41Sopenharmony_ci } else { 15241cb0ef41Sopenharmony_ci return ShlPairLatency(false); 15251cb0ef41Sopenharmony_ci } 15261cb0ef41Sopenharmony_ci } 15271cb0ef41Sopenharmony_ci case kMipsShrPair: { 15281cb0ef41Sopenharmony_ci if (instr->InputAt(2)->IsRegister()) { 15291cb0ef41Sopenharmony_ci return ShrPairLatency(); 15301cb0ef41Sopenharmony_ci } else { 15311cb0ef41Sopenharmony_ci // auto immediate_operand = ImmediateOperand::cast(instr->InputAt(2)); 15321cb0ef41Sopenharmony_ci // return ShrPairLatency(false, immediate_operand->inline_32_value()); 15331cb0ef41Sopenharmony_ci return 1; 15341cb0ef41Sopenharmony_ci } 15351cb0ef41Sopenharmony_ci } 15361cb0ef41Sopenharmony_ci case kMipsSarPair: { 15371cb0ef41Sopenharmony_ci if (instr->InputAt(2)->IsRegister()) { 15381cb0ef41Sopenharmony_ci return SarPairLatency(); 15391cb0ef41Sopenharmony_ci } else { 15401cb0ef41Sopenharmony_ci return SarPairLatency(false); 15411cb0ef41Sopenharmony_ci } 15421cb0ef41Sopenharmony_ci } 15431cb0ef41Sopenharmony_ci case kMipsExt: 15441cb0ef41Sopenharmony_ci return ExtLatency(); 15451cb0ef41Sopenharmony_ci case kMipsIns: 15461cb0ef41Sopenharmony_ci return InsLatency(); 15471cb0ef41Sopenharmony_ci case kMipsRor: 15481cb0ef41Sopenharmony_ci return RorLatency(instr->InputAt(1)->IsRegister()); 15491cb0ef41Sopenharmony_ci case kMipsLsa: 15501cb0ef41Sopenharmony_ci return LsaLatency(); 15511cb0ef41Sopenharmony_ci case kMipsModD: 15521cb0ef41Sopenharmony_ci return PrepareCallCFunctionLatency() + MovToFloatParametersLatency() + 15531cb0ef41Sopenharmony_ci CallCFunctionLatency() + MovFromFloatResultLatency(); 15541cb0ef41Sopenharmony_ci case kMipsAddPair: 15551cb0ef41Sopenharmony_ci return AddPairLatency(); 15561cb0ef41Sopenharmony_ci case kMipsSubPair: 15571cb0ef41Sopenharmony_ci return SubPairLatency(); 15581cb0ef41Sopenharmony_ci case kMipsMulPair: 15591cb0ef41Sopenharmony_ci return MulPairLatency(); 15601cb0ef41Sopenharmony_ci case kMipsMaddS: 15611cb0ef41Sopenharmony_ci return MaddSLatency(); 15621cb0ef41Sopenharmony_ci case kMipsMaddD: 15631cb0ef41Sopenharmony_ci return MaddDLatency(); 15641cb0ef41Sopenharmony_ci case kMipsMsubS: 15651cb0ef41Sopenharmony_ci return MsubSLatency(); 15661cb0ef41Sopenharmony_ci case kMipsMsubD: 15671cb0ef41Sopenharmony_ci return MsubDLatency(); 15681cb0ef41Sopenharmony_ci case kMipsNegS: 15691cb0ef41Sopenharmony_ci return Neg_sLatency(); 15701cb0ef41Sopenharmony_ci case kMipsNegD: 15711cb0ef41Sopenharmony_ci return Neg_dLatency(); 15721cb0ef41Sopenharmony_ci case kMipsFloat64RoundDown: 15731cb0ef41Sopenharmony_ci case kMipsFloat64RoundTruncate: 15741cb0ef41Sopenharmony_ci case kMipsFloat64RoundUp: 15751cb0ef41Sopenharmony_ci case kMipsFloat64RoundTiesEven: 15761cb0ef41Sopenharmony_ci return Float64RoundLatency(); 15771cb0ef41Sopenharmony_ci case kMipsFloat32RoundDown: 15781cb0ef41Sopenharmony_ci case kMipsFloat32RoundTruncate: 15791cb0ef41Sopenharmony_ci case kMipsFloat32RoundUp: 15801cb0ef41Sopenharmony_ci case kMipsFloat32RoundTiesEven: 15811cb0ef41Sopenharmony_ci return Float32RoundLatency(); 15821cb0ef41Sopenharmony_ci case kMipsFloat32Max: 15831cb0ef41Sopenharmony_ci return Float32MaxLatency(); 15841cb0ef41Sopenharmony_ci case kMipsFloat64Max: 15851cb0ef41Sopenharmony_ci return Float64MaxLatency(); 15861cb0ef41Sopenharmony_ci case kMipsFloat32Min: 15871cb0ef41Sopenharmony_ci return Float32MinLatency(); 15881cb0ef41Sopenharmony_ci case kMipsFloat64Min: 15891cb0ef41Sopenharmony_ci return Float64MinLatency(); 15901cb0ef41Sopenharmony_ci case kMipsCvtSUw: 15911cb0ef41Sopenharmony_ci return CvtSUwLatency(); 15921cb0ef41Sopenharmony_ci case kMipsCvtDUw: 15931cb0ef41Sopenharmony_ci return CvtDUwLatency(); 15941cb0ef41Sopenharmony_ci case kMipsFloorWD: 15951cb0ef41Sopenharmony_ci return FloorWDLatency(); 15961cb0ef41Sopenharmony_ci case kMipsCeilWD: 15971cb0ef41Sopenharmony_ci return CeilWDLatency(); 15981cb0ef41Sopenharmony_ci case kMipsRoundWD: 15991cb0ef41Sopenharmony_ci return RoundWDLatency(); 16001cb0ef41Sopenharmony_ci case kMipsTruncWD: 16011cb0ef41Sopenharmony_ci return Trunc_w_dLatency() + Latency::MFC1; 16021cb0ef41Sopenharmony_ci case kMipsTruncWS: 16031cb0ef41Sopenharmony_ci return Latency::TRUNC_W_S + Latency::MFC1 + AdduLatency(false) + 16041cb0ef41Sopenharmony_ci SltLatency() + MovnLatency(); 16051cb0ef41Sopenharmony_ci case kMipsTruncUwD: 16061cb0ef41Sopenharmony_ci return Trunc_uw_dLatency(); 16071cb0ef41Sopenharmony_ci case kMipsTruncUwS: 16081cb0ef41Sopenharmony_ci return Trunc_uw_sLatency() + AdduLatency(false) + MovzLatency(); 16091cb0ef41Sopenharmony_ci case kMipsFloat64ExtractLowWord32: 16101cb0ef41Sopenharmony_ci return Latency::MFC1; 16111cb0ef41Sopenharmony_ci case kMipsFloat64ExtractHighWord32: 16121cb0ef41Sopenharmony_ci return Mfhc1Latency(); 16131cb0ef41Sopenharmony_ci case kMipsFloat64InsertLowWord32: { 16141cb0ef41Sopenharmony_ci if (IsFp32Mode()) { 16151cb0ef41Sopenharmony_ci return Latency::MTC1; 16161cb0ef41Sopenharmony_ci } else { 16171cb0ef41Sopenharmony_ci return Latency::MFHC1 + Latency::MTC1 + Latency::MTHC1; 16181cb0ef41Sopenharmony_ci } 16191cb0ef41Sopenharmony_ci } 16201cb0ef41Sopenharmony_ci case kMipsFloat64InsertHighWord32: 16211cb0ef41Sopenharmony_ci return Mthc1Latency(); 16221cb0ef41Sopenharmony_ci case kMipsFloat64SilenceNaN: 16231cb0ef41Sopenharmony_ci return Latency::SUB_D; 16241cb0ef41Sopenharmony_ci case kMipsSeb: 16251cb0ef41Sopenharmony_ci return SebLatency(); 16261cb0ef41Sopenharmony_ci case kMipsSeh: 16271cb0ef41Sopenharmony_ci return SehLatency(); 16281cb0ef41Sopenharmony_ci case kMipsUlhu: 16291cb0ef41Sopenharmony_ci return UlhuLatency(); 16301cb0ef41Sopenharmony_ci case kMipsUlh: 16311cb0ef41Sopenharmony_ci return UlhLatency(); 16321cb0ef41Sopenharmony_ci case kMipsUsh: 16331cb0ef41Sopenharmony_ci return UshLatency(); 16341cb0ef41Sopenharmony_ci case kMipsUlw: 16351cb0ef41Sopenharmony_ci return UlwLatency(); 16361cb0ef41Sopenharmony_ci case kMipsUsw: 16371cb0ef41Sopenharmony_ci return UswLatency(); 16381cb0ef41Sopenharmony_ci case kMipsUlwc1: 16391cb0ef41Sopenharmony_ci return Ulwc1Latency(); 16401cb0ef41Sopenharmony_ci case kMipsSwc1: 16411cb0ef41Sopenharmony_ci return MoveLatency(false) + Latency::SWC1; // Estimated max. 16421cb0ef41Sopenharmony_ci case kMipsUswc1: 16431cb0ef41Sopenharmony_ci return MoveLatency(false) + Uswc1Latency(); // Estimated max. 16441cb0ef41Sopenharmony_ci case kMipsLdc1: 16451cb0ef41Sopenharmony_ci return Ldc1Latency(); 16461cb0ef41Sopenharmony_ci case kMipsUldc1: 16471cb0ef41Sopenharmony_ci return Uldc1Latency(); 16481cb0ef41Sopenharmony_ci case kMipsSdc1: 16491cb0ef41Sopenharmony_ci return MoveLatency(false) + Sdc1Latency(); // Estimated max. 16501cb0ef41Sopenharmony_ci case kMipsUsdc1: 16511cb0ef41Sopenharmony_ci return MoveLatency(false) + Usdc1Latency(); // Estimated max. 16521cb0ef41Sopenharmony_ci case kMipsPush: { 16531cb0ef41Sopenharmony_ci if (instr->InputAt(0)->IsFPRegister()) { 16541cb0ef41Sopenharmony_ci auto op = LocationOperand::cast(instr->InputAt(0)); 16551cb0ef41Sopenharmony_ci switch (op->representation()) { 16561cb0ef41Sopenharmony_ci case MachineRepresentation::kFloat32: 16571cb0ef41Sopenharmony_ci return Latency::SWC1 + SubuLatency(false); 16581cb0ef41Sopenharmony_ci case MachineRepresentation::kFloat64: 16591cb0ef41Sopenharmony_ci return Sdc1Latency() + SubuLatency(false); 16601cb0ef41Sopenharmony_ci default: { 16611cb0ef41Sopenharmony_ci UNREACHABLE(); 16621cb0ef41Sopenharmony_ci } 16631cb0ef41Sopenharmony_ci } 16641cb0ef41Sopenharmony_ci } else { 16651cb0ef41Sopenharmony_ci return PushRegisterLatency(); 16661cb0ef41Sopenharmony_ci } 16671cb0ef41Sopenharmony_ci } 16681cb0ef41Sopenharmony_ci case kMipsPeek: { 16691cb0ef41Sopenharmony_ci if (instr->OutputAt(0)->IsFPRegister()) { 16701cb0ef41Sopenharmony_ci auto op = LocationOperand::cast(instr->OutputAt(0)); 16711cb0ef41Sopenharmony_ci if (op->representation() == MachineRepresentation::kFloat64) { 16721cb0ef41Sopenharmony_ci return Ldc1Latency(); 16731cb0ef41Sopenharmony_ci } else { 16741cb0ef41Sopenharmony_ci return Latency::LWC1; 16751cb0ef41Sopenharmony_ci } 16761cb0ef41Sopenharmony_ci } else { 16771cb0ef41Sopenharmony_ci return 1; 16781cb0ef41Sopenharmony_ci } 16791cb0ef41Sopenharmony_ci } 16801cb0ef41Sopenharmony_ci case kMipsStackClaim: 16811cb0ef41Sopenharmony_ci return SubuLatency(false); 16821cb0ef41Sopenharmony_ci case kMipsStoreToStackSlot: { 16831cb0ef41Sopenharmony_ci if (instr->InputAt(0)->IsFPRegister()) { 16841cb0ef41Sopenharmony_ci auto op = LocationOperand::cast(instr->InputAt(0)); 16851cb0ef41Sopenharmony_ci if (op->representation() == MachineRepresentation::kFloat64) { 16861cb0ef41Sopenharmony_ci return Sdc1Latency(); 16871cb0ef41Sopenharmony_ci } else if (op->representation() == MachineRepresentation::kFloat32) { 16881cb0ef41Sopenharmony_ci return Latency::SWC1; 16891cb0ef41Sopenharmony_ci } else { 16901cb0ef41Sopenharmony_ci return 1; // Estimated value. 16911cb0ef41Sopenharmony_ci } 16921cb0ef41Sopenharmony_ci } else { 16931cb0ef41Sopenharmony_ci return 1; 16941cb0ef41Sopenharmony_ci } 16951cb0ef41Sopenharmony_ci } 16961cb0ef41Sopenharmony_ci case kMipsByteSwap32: 16971cb0ef41Sopenharmony_ci return ByteSwapSignedLatency(); 16981cb0ef41Sopenharmony_ci case kAtomicLoadInt8: 16991cb0ef41Sopenharmony_ci case kAtomicLoadUint8: 17001cb0ef41Sopenharmony_ci case kAtomicLoadInt16: 17011cb0ef41Sopenharmony_ci case kAtomicLoadUint16: 17021cb0ef41Sopenharmony_ci case kAtomicLoadWord32: 17031cb0ef41Sopenharmony_ci return 2; 17041cb0ef41Sopenharmony_ci case kAtomicStoreWord8: 17051cb0ef41Sopenharmony_ci case kAtomicStoreWord16: 17061cb0ef41Sopenharmony_ci case kAtomicStoreWord32: 17071cb0ef41Sopenharmony_ci return 3; 17081cb0ef41Sopenharmony_ci case kAtomicExchangeInt8: 17091cb0ef41Sopenharmony_ci return Word32AtomicExchangeLatency(true, 8); 17101cb0ef41Sopenharmony_ci case kAtomicExchangeUint8: 17111cb0ef41Sopenharmony_ci return Word32AtomicExchangeLatency(false, 8); 17121cb0ef41Sopenharmony_ci case kAtomicExchangeInt16: 17131cb0ef41Sopenharmony_ci return Word32AtomicExchangeLatency(true, 16); 17141cb0ef41Sopenharmony_ci case kAtomicExchangeUint16: 17151cb0ef41Sopenharmony_ci return Word32AtomicExchangeLatency(false, 16); 17161cb0ef41Sopenharmony_ci case kAtomicExchangeWord32: { 17171cb0ef41Sopenharmony_ci return 1 + AdduLatency() + Ldc1Latency() + 1 + ScLatency(0) + 17181cb0ef41Sopenharmony_ci BranchShortLatency() + 1; 17191cb0ef41Sopenharmony_ci } 17201cb0ef41Sopenharmony_ci case kAtomicCompareExchangeInt8: 17211cb0ef41Sopenharmony_ci return Word32AtomicCompareExchangeLatency(true, 8); 17221cb0ef41Sopenharmony_ci case kAtomicCompareExchangeUint8: 17231cb0ef41Sopenharmony_ci return Word32AtomicCompareExchangeLatency(false, 8); 17241cb0ef41Sopenharmony_ci case kAtomicCompareExchangeInt16: 17251cb0ef41Sopenharmony_ci return Word32AtomicCompareExchangeLatency(true, 16); 17261cb0ef41Sopenharmony_ci case kAtomicCompareExchangeUint16: 17271cb0ef41Sopenharmony_ci return Word32AtomicCompareExchangeLatency(false, 16); 17281cb0ef41Sopenharmony_ci case kAtomicCompareExchangeWord32: 17291cb0ef41Sopenharmony_ci return AdduLatency() + 1 + LlLatency(0) + BranchShortLatency() + 1; 17301cb0ef41Sopenharmony_ci case kMipsTst: 17311cb0ef41Sopenharmony_ci return AndLatency(instr->InputAt(1)->IsRegister()); 17321cb0ef41Sopenharmony_ci case kMipsCmpS: 17331cb0ef41Sopenharmony_ci return MoveLatency() + CompareF32Latency(); 17341cb0ef41Sopenharmony_ci case kMipsCmpD: 17351cb0ef41Sopenharmony_ci return MoveLatency() + CompareF64Latency(); 17361cb0ef41Sopenharmony_ci case kArchNop: 17371cb0ef41Sopenharmony_ci case kArchThrowTerminator: 17381cb0ef41Sopenharmony_ci case kMipsCmp: 17391cb0ef41Sopenharmony_ci return 0; 17401cb0ef41Sopenharmony_ci case kArchDebugBreak: 17411cb0ef41Sopenharmony_ci case kArchFramePointer: 17421cb0ef41Sopenharmony_ci case kArchParentFramePointer: 17431cb0ef41Sopenharmony_ci case kMipsShl: 17441cb0ef41Sopenharmony_ci case kMipsShr: 17451cb0ef41Sopenharmony_ci case kMipsSar: 17461cb0ef41Sopenharmony_ci case kMipsMov: 17471cb0ef41Sopenharmony_ci case kMipsMaxS: 17481cb0ef41Sopenharmony_ci case kMipsMinS: 17491cb0ef41Sopenharmony_ci case kMipsMaxD: 17501cb0ef41Sopenharmony_ci case kMipsMinD: 17511cb0ef41Sopenharmony_ci case kMipsLbu: 17521cb0ef41Sopenharmony_ci case kMipsLb: 17531cb0ef41Sopenharmony_ci case kMipsSb: 17541cb0ef41Sopenharmony_ci case kMipsLhu: 17551cb0ef41Sopenharmony_ci case kMipsLh: 17561cb0ef41Sopenharmony_ci case kMipsSh: 17571cb0ef41Sopenharmony_ci case kMipsLw: 17581cb0ef41Sopenharmony_ci case kMipsSw: 17591cb0ef41Sopenharmony_ci case kMipsLwc1: 17601cb0ef41Sopenharmony_ci return 1; 17611cb0ef41Sopenharmony_ci case kMipsAddS: 17621cb0ef41Sopenharmony_ci return Latency::ADD_S; 17631cb0ef41Sopenharmony_ci case kMipsSubS: 17641cb0ef41Sopenharmony_ci return Latency::SUB_S; 17651cb0ef41Sopenharmony_ci case kMipsMulS: 17661cb0ef41Sopenharmony_ci return Latency::MUL_S; 17671cb0ef41Sopenharmony_ci case kMipsAbsS: 17681cb0ef41Sopenharmony_ci return Latency::ABS_S; 17691cb0ef41Sopenharmony_ci case kMipsAddD: 17701cb0ef41Sopenharmony_ci return Latency::ADD_D; 17711cb0ef41Sopenharmony_ci case kMipsSubD: 17721cb0ef41Sopenharmony_ci return Latency::SUB_D; 17731cb0ef41Sopenharmony_ci case kMipsAbsD: 17741cb0ef41Sopenharmony_ci return Latency::ABS_D; 17751cb0ef41Sopenharmony_ci case kMipsCvtSD: 17761cb0ef41Sopenharmony_ci return Latency::CVT_S_D; 17771cb0ef41Sopenharmony_ci case kMipsCvtDS: 17781cb0ef41Sopenharmony_ci return Latency::CVT_D_S; 17791cb0ef41Sopenharmony_ci case kMipsMulD: 17801cb0ef41Sopenharmony_ci return Latency::MUL_D; 17811cb0ef41Sopenharmony_ci case kMipsFloorWS: 17821cb0ef41Sopenharmony_ci return Latency::FLOOR_W_S; 17831cb0ef41Sopenharmony_ci case kMipsCeilWS: 17841cb0ef41Sopenharmony_ci return Latency::CEIL_W_S; 17851cb0ef41Sopenharmony_ci case kMipsRoundWS: 17861cb0ef41Sopenharmony_ci return Latency::ROUND_W_S; 17871cb0ef41Sopenharmony_ci case kMipsCvtDW: 17881cb0ef41Sopenharmony_ci return Latency::CVT_D_W; 17891cb0ef41Sopenharmony_ci case kMipsCvtSW: 17901cb0ef41Sopenharmony_ci return Latency::CVT_S_W; 17911cb0ef41Sopenharmony_ci case kMipsDivS: 17921cb0ef41Sopenharmony_ci return Latency::DIV_S; 17931cb0ef41Sopenharmony_ci case kMipsSqrtS: 17941cb0ef41Sopenharmony_ci return Latency::SQRT_S; 17951cb0ef41Sopenharmony_ci case kMipsDivD: 17961cb0ef41Sopenharmony_ci return Latency::DIV_D; 17971cb0ef41Sopenharmony_ci case kMipsSqrtD: 17981cb0ef41Sopenharmony_ci return Latency::SQRT_D; 17991cb0ef41Sopenharmony_ci default: 18001cb0ef41Sopenharmony_ci return 1; 18011cb0ef41Sopenharmony_ci } 18021cb0ef41Sopenharmony_ci} 18031cb0ef41Sopenharmony_ci 18041cb0ef41Sopenharmony_ci} // namespace compiler 18051cb0ef41Sopenharmony_ci} // namespace internal 18061cb0ef41Sopenharmony_ci} // namespace v8 1807