Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/mips/assembler-mips.cc

Issue 2740123004: MIPS[64]: Support for MSA instructions (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. 1 // Copyright (c) 1994-2006 Sun Microsystems Inc.
2 // All Rights Reserved. 2 // All Rights Reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // - Redistributions of source code must retain the above copyright notice, 8 // - Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer. 9 // this list of conditions and the following disclaimer.
10 // 10 //
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 supported_ |= 1u << FP64FPU; 83 supported_ |= 1u << FP64FPU;
84 #endif 84 #endif
85 #else 85 #else
86 // Probe for additional features at runtime. 86 // Probe for additional features at runtime.
87 base::CPU cpu; 87 base::CPU cpu;
88 if (cpu.has_fpu()) supported_ |= 1u << FPU; 88 if (cpu.has_fpu()) supported_ |= 1u << FPU;
89 #if defined(FPU_MODE_FPXX) 89 #if defined(FPU_MODE_FPXX)
90 if (cpu.is_fp64_mode()) supported_ |= 1u << FP64FPU; 90 if (cpu.is_fp64_mode()) supported_ |= 1u << FP64FPU;
91 #elif defined(FPU_MODE_FP64) 91 #elif defined(FPU_MODE_FP64)
92 supported_ |= 1u << FP64FPU; 92 supported_ |= 1u << FP64FPU;
93 if (cpu.has_msa()) supported_ |= 1u << MIPS_SIMD;
93 #endif 94 #endif
94 #if defined(_MIPS_ARCH_MIPS32RX) 95 #if defined(_MIPS_ARCH_MIPS32RX)
95 if (cpu.architecture() == 6) { 96 if (cpu.architecture() == 6) {
96 supported_ |= 1u << MIPSr6; 97 supported_ |= 1u << MIPSr6;
97 } else if (cpu.architecture() == 2) { 98 } else if (cpu.architecture() == 2) {
98 supported_ |= 1u << MIPSr1; 99 supported_ |= 1u << MIPSr1;
99 supported_ |= 1u << MIPSr2; 100 supported_ |= 1u << MIPSr2;
100 } else { 101 } else {
101 supported_ |= 1u << MIPSr1; 102 supported_ |= 1u << MIPSr1;
102 } 103 }
(...skipping 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after
1160 1161
1161 void Assembler::GenInstrJump(Opcode opcode, 1162 void Assembler::GenInstrJump(Opcode opcode,
1162 uint32_t address) { 1163 uint32_t address) {
1163 BlockTrampolinePoolScope block_trampoline_pool(this); 1164 BlockTrampolinePoolScope block_trampoline_pool(this);
1164 DCHECK(is_uint26(address)); 1165 DCHECK(is_uint26(address));
1165 Instr instr = opcode | address; 1166 Instr instr = opcode | address;
1166 emit(instr); 1167 emit(instr);
1167 BlockTrampolinePoolFor(1); // For associated delay slot. 1168 BlockTrampolinePoolFor(1); // For associated delay slot.
1168 } 1169 }
1169 1170
1171 // MSA instructions
1172 void Assembler::GenInstrMsaI8(SecondaryField operation, uint32_t imm8,
1173 MSARegister ws, MSARegister wd) {
1174 DCHECK(IsMipsArchVariant(kMips32r6) && IsEnabled(MIPS_SIMD));
1175 DCHECK(ws.is_valid() && wd.is_valid() && is_uint8(imm8));
1176 Instr instr = MSA | operation | ((imm8 & kImm8Mask) << kWtShift) |
1177 (ws.code() << kWsShift) | (wd.code() << kWdShift);
1178 emit(instr);
1179 }
1180
1181 void Assembler::GenInstrMsaI5(SecondaryField operation, SecondaryField df,
1182 int32_t imm5, MSARegister ws, MSARegister wd) {
1183 DCHECK(IsMipsArchVariant(kMips32r6) && IsEnabled(MIPS_SIMD));
1184 DCHECK(ws.is_valid() && wd.is_valid());
1185 DCHECK((operation == MAXI_S) || (operation == MINI_S) ||
1186 (operation == CEQI) || (operation == CLTI_S) ||
1187 (operation == CLEI_S)
1188 ? is_int5(imm5)
1189 : is_uint5(imm5));
1190 Instr instr = MSA | operation | df | ((imm5 & kImm5Mask) << kWtShift) |
1191 (ws.code() << kWsShift) | (wd.code() << kWdShift);
1192 emit(instr);
1193 }
1194
1195 void Assembler::GenInstrMsaBit(SecondaryField operation, SecondaryField df,
1196 uint32_t m, MSARegister ws, MSARegister wd) {
1197 DCHECK(IsMipsArchVariant(kMips32r6) && IsEnabled(MIPS_SIMD));
1198 DCHECK(ws.is_valid() && wd.is_valid() && is_valid_msa_df_m(df, m));
1199 Instr instr = MSA | operation | df | (m << kWtShift) |
1200 (ws.code() << kWsShift) | (wd.code() << kWdShift);
1201 emit(instr);
1202 }
1203
1204 void Assembler::GenInstrMsaI10(SecondaryField operation, SecondaryField df,
1205 int32_t imm10, MSARegister wd) {
1206 DCHECK(IsMipsArchVariant(kMips32r6) && IsEnabled(MIPS_SIMD));
1207 DCHECK(wd.is_valid() && is_int10(imm10));
1208 Instr instr = MSA | operation | df | ((imm10 & kImm10Mask) << kWsShift) |
1209 (wd.code() << kWdShift);
1210 emit(instr);
1211 }
1212
1213 template <typename RegType>
1214 void Assembler::GenInstrMsa3R(SecondaryField operation, SecondaryField df,
1215 RegType t, MSARegister ws, MSARegister wd) {
1216 DCHECK(IsMipsArchVariant(kMips32r6) && IsEnabled(MIPS_SIMD));
1217 DCHECK(t.is_valid() && ws.is_valid() && wd.is_valid());
1218 Instr instr = MSA | operation | df | (t.code() << kWtShift) |
1219 (ws.code() << kWsShift) | (wd.code() << kWdShift);
1220 emit(instr);
1221 }
1222
1223 template <typename DstType, typename SrcType>
1224 void Assembler::GenInstrMsaElm(SecondaryField operation, SecondaryField df,
1225 uint32_t n, SrcType src, DstType dst) {
1226 DCHECK(IsMipsArchVariant(kMips32r6) && IsEnabled(MIPS_SIMD));
1227 DCHECK(src.is_valid() && dst.is_valid() && is_valid_msa_df_n(df, n));
1228 Instr instr = MSA | operation | df | (n << kWtShift) |
1229 (src.code() << kWsShift) | (dst.code() << kWdShift) |
1230 MSA_ELM_MINOR;
1231 emit(instr);
1232 }
1233
1234 void Assembler::GenInstrMsa3RF(SecondaryField operation, uint32_t df,
1235 MSARegister wt, MSARegister ws, MSARegister wd) {
1236 DCHECK(IsMipsArchVariant(kMips32r6) && IsEnabled(MIPS_SIMD));
1237 DCHECK(wt.is_valid() && ws.is_valid() && wd.is_valid());
1238 DCHECK(df < 2);
1239 Instr instr = MSA | operation | (df << 21) | (wt.code() << kWtShift) |
1240 (ws.code() << kWsShift) | (wd.code() << kWdShift);
1241 emit(instr);
1242 }
1243
1244 void Assembler::GenInstrMsaVec(SecondaryField operation, MSARegister wt,
1245 MSARegister ws, MSARegister wd) {
1246 DCHECK(IsMipsArchVariant(kMips32r6) && IsEnabled(MIPS_SIMD));
1247 DCHECK(wt.is_valid() && ws.is_valid() && wd.is_valid());
1248 Instr instr = MSA | operation | (wt.code() << kWtShift) |
1249 (ws.code() << kWsShift) | (wd.code() << kWdShift) |
1250 MSA_VEC_2R_2RF_MINOR;
1251 emit(instr);
1252 }
1253
1254 void Assembler::GenInstrMsaMI10(SecondaryField operation, int32_t s10,
1255 Register rs, MSARegister wd) {
1256 DCHECK(IsMipsArchVariant(kMips32r6) && IsEnabled(MIPS_SIMD));
1257 DCHECK(rs.is_valid() && wd.is_valid() && is_int10(s10));
1258 Instr instr = MSA | operation | ((s10 & kImm10Mask) << kWtShift) |
1259 (rs.code() << kWsShift) | (wd.code() << kWdShift);
1260 emit(instr);
1261 }
1262
1263 void Assembler::GenInstrMsa2R(SecondaryField operation, SecondaryField df,
1264 MSARegister ws, MSARegister wd) {
1265 DCHECK(IsMipsArchVariant(kMips32r6) && IsEnabled(MIPS_SIMD));
1266 DCHECK(ws.is_valid() && wd.is_valid());
1267 Instr instr = MSA | MSA_2R_FORMAT | operation | df | (ws.code() << kWsShift) |
1268 (wd.code() << kWdShift) | MSA_VEC_2R_2RF_MINOR;
1269 emit(instr);
1270 }
1271
1272 void Assembler::GenInstrMsa2RF(SecondaryField operation, SecondaryField df,
1273 MSARegister ws, MSARegister wd) {
1274 DCHECK(IsMipsArchVariant(kMips32r6) && IsEnabled(MIPS_SIMD));
1275 DCHECK(ws.is_valid() && wd.is_valid());
1276 Instr instr = MSA | MSA_2RF_FORMAT | operation | df |
1277 (ws.code() << kWsShift) | (wd.code() << kWdShift) |
1278 MSA_VEC_2R_2RF_MINOR;
1279 emit(instr);
1280 }
1281
1282 void Assembler::GenInstrMsaBranch(SecondaryField operation, MSARegister wt,
1283 int32_t offset16) {
1284 DCHECK(IsMipsArchVariant(kMips32r6) && IsEnabled(MIPS_SIMD));
1285 DCHECK(wt.is_valid() && is_int16(offset16));
1286 BlockTrampolinePoolScope block_trampoline_pool(this);
1287 Instr instr =
1288 COP1 | operation | (wt.code() << kWtShift) | (offset16 & kImm16Mask);
1289 emit(instr);
1290 BlockTrampolinePoolFor(1); // For associated delay slot.
1291 }
1170 1292
1171 // Returns the next free trampoline entry. 1293 // Returns the next free trampoline entry.
1172 int32_t Assembler::get_trampoline_entry(int32_t pos) { 1294 int32_t Assembler::get_trampoline_entry(int32_t pos) {
1173 int32_t trampoline_entry = kInvalidSlotPos; 1295 int32_t trampoline_entry = kInvalidSlotPos;
1174 1296
1175 if (!internal_trampoline_exception_) { 1297 if (!internal_trampoline_exception_) {
1176 if (trampoline_.start() > pos) { 1298 if (trampoline_.start() > pos) {
1177 trampoline_entry = trampoline_.take_slot(); 1299 trampoline_entry = trampoline_.take_slot();
1178 } 1300 }
1179 1301
(...skipping 1761 matching lines...) Expand 10 before | Expand all | Expand 10 after
2941 emit(instr); 3063 emit(instr);
2942 } 3064 }
2943 3065
2944 3066
2945 void Assembler::bc1t(int16_t offset, uint16_t cc) { 3067 void Assembler::bc1t(int16_t offset, uint16_t cc) {
2946 DCHECK(is_uint3(cc)); 3068 DCHECK(is_uint3(cc));
2947 Instr instr = COP1 | BC1 | cc << 18 | 1 << 16 | (offset & kImm16Mask); 3069 Instr instr = COP1 | BC1 | cc << 18 | 1 << 16 | (offset & kImm16Mask);
2948 emit(instr); 3070 emit(instr);
2949 } 3071 }
2950 3072
3073 // ---------- MSA instructions ------------
3074 #define MSA_BRANCH_LIST(V) \
3075 V(bz_v, BZ_V) \
3076 V(bz_b, BZ_B) \
3077 V(bz_h, BZ_H) \
3078 V(bz_w, BZ_W) \
3079 V(bz_d, BZ_D) \
3080 V(bnz_v, BNZ_V) \
3081 V(bnz_b, BNZ_B) \
3082 V(bnz_h, BNZ_H) \
3083 V(bnz_w, BNZ_W) \
3084 V(bnz_d, BNZ_D)
3085
3086 #define MSA_BRANCH(name, opcode) \
3087 void Assembler::name(MSARegister wt, int16_t offset) { \
3088 GenInstrMsaBranch(opcode, wt, offset); \
3089 }
3090
3091 MSA_BRANCH_LIST(MSA_BRANCH)
3092 #undef MSA_BRANCH
3093 #undef MSA_BRANCH_LIST
3094
3095 #define MSA_LD_ST_LIST(V) \
3096 V(ld_b, LD_B) \
3097 V(ld_h, LD_H) \
3098 V(ld_w, LD_W) \
3099 V(ld_d, LD_D) \
3100 V(st_b, ST_B) \
3101 V(st_h, ST_H) \
3102 V(st_w, ST_W) \
3103 V(st_d, ST_D)
3104
3105 #define MSA_LD_ST(name, opcode) \
3106 void Assembler::name(MSARegister wd, const MemOperand& rs) { \
3107 if (is_int10(rs.offset())) { \
3108 GenInstrMsaMI10(opcode, rs.offset(), rs.rm(), wd); \
3109 } else { \
3110 LoadRegPlusOffsetToAt(rs); \
3111 GenInstrMsaMI10(opcode, 0, at, wd); \
3112 } \
3113 }
3114
3115 MSA_LD_ST_LIST(MSA_LD_ST)
3116 #undef MSA_LD_ST
3117 #undef MSA_BRANCH_LIST
3118
3119 #define MSA_I10_LIST(V) \
3120 V(ldi_b, I5_DF_b) \
3121 V(ldi_h, I5_DF_h) \
3122 V(ldi_w, I5_DF_w) \
3123 V(ldi_d, I5_DF_d)
3124
3125 #define MSA_I10(name, format) \
3126 void Assembler::name(MSARegister wd, int32_t imm10) { \
3127 GenInstrMsaI10(LDI, format, imm10, wd); \
3128 }
3129 MSA_I10_LIST(MSA_I10)
3130 #undef MSA_I10
3131 #undef MSA_I10_LIST
3132
3133 #define MSA_I5_LIST(V) \
3134 V(addvi, ADDVI) \
3135 V(subvi, SUBVI) \
3136 V(maxi_s, MAXI_S) \
3137 V(maxi_u, MAXI_U) \
3138 V(mini_s, MINI_S) \
3139 V(mini_u, MINI_U) \
3140 V(ceqi, CEQI) \
3141 V(clti_s, CLTI_S) \
3142 V(clti_u, CLTI_U) \
3143 V(clei_s, CLEI_S) \
3144 V(clei_u, CLEI_U)
3145
3146 #define MSA_I5_FORMAT(name, opcode, format) \
3147 void Assembler::name##_##format(MSARegister wd, MSARegister ws, \
3148 uint32_t imm5) { \
3149 GenInstrMsaI5(opcode, I5_DF_##format, imm5, ws, wd); \
3150 }
3151
3152 #define MSA_I5(name, opcode) \
3153 MSA_I5_FORMAT(name, opcode, b) \
3154 MSA_I5_FORMAT(name, opcode, h) \
3155 MSA_I5_FORMAT(name, opcode, w) \
3156 MSA_I5_FORMAT(name, opcode, d)
3157
3158 MSA_I5_LIST(MSA_I5)
3159 #undef MSA_I5
3160 #undef MSA_I5_FORMAT
3161 #undef MSA_I5_LIST
3162
3163 #define MSA_I8_LIST(V) \
3164 V(andi_b, ANDI_B) \
3165 V(ori_b, ORI_B) \
3166 V(nori_b, NORI_B) \
3167 V(xori_b, XORI_B) \
3168 V(bmnzi_b, BMNZI_B) \
3169 V(bmzi_b, BMZI_B) \
3170 V(bseli_b, BSELI_B) \
3171 V(shf_b, SHF_B) \
3172 V(shf_h, SHF_H) \
3173 V(shf_w, SHF_W)
3174
3175 #define MSA_I8(name, opcode) \
3176 void Assembler::name(MSARegister wd, MSARegister ws, uint32_t imm8) { \
3177 GenInstrMsaI8(opcode, imm8, ws, wd); \
3178 }
3179
3180 MSA_I8_LIST(MSA_I8)
3181 #undef MSA_I8
3182 #undef MSA_I8_LIST
3183
3184 #define MSA_VEC_LIST(V) \
3185 V(and_v, AND_V) \
3186 V(or_v, OR_V) \
3187 V(nor_v, NOR_V) \
3188 V(xor_v, XOR_V) \
3189 V(bmnz_v, BMNZ_V) \
3190 V(bmz_v, BMZ_V) \
3191 V(bsel_v, BSEL_V)
3192
3193 #define MSA_VEC(name, opcode) \
3194 void Assembler::name(MSARegister wd, MSARegister ws, MSARegister wt) { \
3195 GenInstrMsaVec(opcode, wt, ws, wd); \
3196 }
3197
3198 MSA_VEC_LIST(MSA_VEC)
3199 #undef MSA_VEC
3200 #undef MSA_VEC_LIST
3201
3202 #define MSA_2R_LIST(V) \
3203 V(pcnt, PCNT) \
3204 V(nloc, NLOC) \
3205 V(nlzc, NLZC)
3206
3207 #define MSA_2R_FORMAT(name, opcode, format) \
3208 void Assembler::name##_##format(MSARegister wd, MSARegister ws) { \
3209 GenInstrMsa2R(opcode, MSA_2R_DF_##format, ws, wd); \
3210 }
3211
3212 #define MSA_2R(name, opcode) \
3213 MSA_2R_FORMAT(name, opcode, b) \
3214 MSA_2R_FORMAT(name, opcode, h) \
3215 MSA_2R_FORMAT(name, opcode, w) \
3216 MSA_2R_FORMAT(name, opcode, d)
3217
3218 MSA_2R_LIST(MSA_2R)
3219 #undef MSA_2R
3220 #undef MSA_2R_FORMAT
3221 #undef MSA_2R_LIST
3222
3223 #define MSA_FILL(format) \
3224 void Assembler::fill_##format(MSARegister wd, Register rs) { \
3225 DCHECK(IsMipsArchVariant(kMips32r6) && IsEnabled(MIPS_SIMD)); \
3226 DCHECK(rs.is_valid() && wd.is_valid()); \
3227 Instr instr = MSA | MSA_2R_FORMAT | FILL | MSA_2R_DF_##format | \
3228 (rs.code() << kWsShift) | (wd.code() << kWdShift) | \
3229 MSA_VEC_2R_2RF_MINOR; \
3230 emit(instr); \
3231 }
3232
3233 MSA_FILL(b)
3234 MSA_FILL(h)
3235 MSA_FILL(w)
3236 #undef MSA_FILL
3237
3238 #define MSA_2RF_LIST(V) \
3239 V(fclass, FCLASS) \
3240 V(ftrunc_s, FTRUNC_S) \
3241 V(ftrunc_u, FTRUNC_U) \
3242 V(fsqrt, FSQRT) \
3243 V(frsqrt, FRSQRT) \
3244 V(frcp, FRCP) \
3245 V(frint, FRINT) \
3246 V(flog2, FLOG2) \
3247 V(fexupl, FEXUPL) \
3248 V(fexupr, FEXUPR) \
3249 V(ffql, FFQL) \
3250 V(ffqr, FFQR) \
3251 V(ftint_s, FTINT_S) \
3252 V(ftint_u, FTINT_U) \
3253 V(ffint_s, FFINT_S) \
3254 V(ffint_u, FFINT_U)
3255
3256 #define MSA_2RF_FORMAT(name, opcode, format) \
3257 void Assembler::name##_##format(MSARegister wd, MSARegister ws) { \
3258 GenInstrMsa2RF(opcode, MSA_2RF_DF_##format, ws, wd); \
3259 }
3260
3261 #define MSA_2RF(name, opcode) \
3262 MSA_2RF_FORMAT(name, opcode, w) \
3263 MSA_2RF_FORMAT(name, opcode, d)
3264
3265 MSA_2RF_LIST(MSA_2RF)
3266 #undef MSA_2RF
3267 #undef MSA_2RF_FORMAT
3268 #undef MSA_2RF_LIST
3269
3270 #define MSA_3R_LIST(V) \
3271 V(sll, SLL_MSA) \
3272 V(sra, SRA_MSA) \
3273 V(srl, SRL_MSA) \
3274 V(bclr, BCLR) \
3275 V(bset, BSET) \
3276 V(bneg, BNEG) \
3277 V(binsl, BINSL) \
3278 V(binsr, BINSR) \
3279 V(addv, ADDV) \
3280 V(subv, SUBV) \
3281 V(max_s, MAX_S) \
3282 V(max_u, MAX_U) \
3283 V(min_s, MIN_S) \
3284 V(min_u, MIN_U) \
3285 V(max_a, MAX_A) \
3286 V(min_a, MIN_A) \
3287 V(ceq, CEQ) \
3288 V(clt_s, CLT_S) \
3289 V(clt_u, CLT_U) \
3290 V(cle_s, CLE_S) \
3291 V(cle_u, CLE_U) \
3292 V(add_a, ADD_A) \
3293 V(adds_a, ADDS_A) \
3294 V(adds_s, ADDS_S) \
3295 V(adds_u, ADDS_U) \
3296 V(ave_s, AVE_S) \
3297 V(ave_u, AVE_U) \
3298 V(aver_s, AVER_S) \
3299 V(aver_u, AVER_U) \
3300 V(subs_s, SUBS_S) \
3301 V(subs_u, SUBS_U) \
3302 V(subsus_u, SUBSUS_U) \
3303 V(subsuu_s, SUBSUU_S) \
3304 V(asub_s, ASUB_S) \
3305 V(asub_u, ASUB_U) \
3306 V(mulv, MULV) \
3307 V(maddv, MADDV) \
3308 V(msubv, MSUBV) \
3309 V(div_s, DIV_S_MSA) \
3310 V(div_u, DIV_U) \
3311 V(mod_s, MOD_S) \
3312 V(mod_u, MOD_U) \
3313 V(dotp_s, DOTP_S) \
3314 V(dotp_u, DOTP_U) \
3315 V(dpadd_s, DPADD_S) \
3316 V(dpadd_u, DPADD_U) \
3317 V(dpsub_s, DPSUB_S) \
3318 V(dpsub_u, DPSUB_U) \
3319 V(pckev, PCKEV) \
3320 V(pckod, PCKOD) \
3321 V(ilvl, ILVL) \
3322 V(ilvr, ILVR) \
3323 V(ilvev, ILVEV) \
3324 V(ilvod, ILVOD) \
3325 V(vshf, VSHF) \
3326 V(srar, SRAR) \
3327 V(srlr, SRLR) \
3328 V(hadd_s, HADD_S) \
3329 V(hadd_u, HADD_U) \
3330 V(hsub_s, HSUB_S) \
3331 V(hsub_u, HSUB_U)
3332
3333 #define MSA_3R_FORMAT(name, opcode, format) \
3334 void Assembler::name##_##format(MSARegister wd, MSARegister ws, \
3335 MSARegister wt) { \
3336 GenInstrMsa3R<MSARegister>(opcode, MSA_3R_DF_##format, wt, ws, wd); \
3337 }
3338
3339 #define MSA_3R_FORMAT_SLD_SPLAT(name, opcode, format) \
3340 void Assembler::name##_##format(MSARegister wd, MSARegister ws, \
3341 Register rt) { \
3342 GenInstrMsa3R<Register>(opcode, MSA_3R_DF_##format, rt, ws, wd); \
3343 }
3344
3345 #define MSA_3R(name, opcode) \
3346 MSA_3R_FORMAT(name, opcode, b) \
3347 MSA_3R_FORMAT(name, opcode, h) \
3348 MSA_3R_FORMAT(name, opcode, w) \
3349 MSA_3R_FORMAT(name, opcode, d)
3350
3351 #define MSA_3R_SLD_SPLAT(name, opcode) \
3352 MSA_3R_FORMAT_SLD_SPLAT(name, opcode, b) \
3353 MSA_3R_FORMAT_SLD_SPLAT(name, opcode, h) \
3354 MSA_3R_FORMAT_SLD_SPLAT(name, opcode, w) \
3355 MSA_3R_FORMAT_SLD_SPLAT(name, opcode, d)
3356
3357 MSA_3R_LIST(MSA_3R)
3358 MSA_3R_SLD_SPLAT(sld, SLD)
3359 MSA_3R_SLD_SPLAT(splat, SPLAT)
3360
3361 #undef MSA_3R
3362 #undef MSA_3R_FORMAT
3363 #undef MSA_3R_FORMAT_SLD_SPLAT
3364 #undef MSA_3R_SLD_SPLAT
3365 #undef MSA_3R_LIST
3366
3367 #define MSA_3RF_LIST1(V) \
3368 V(fcaf, FCAF) \
3369 V(fcun, FCUN) \
3370 V(fceq, FCEQ) \
3371 V(fcueq, FCUEQ) \
3372 V(fclt, FCLT) \
3373 V(fcult, FCULT) \
3374 V(fcle, FCLE) \
3375 V(fcule, FCULE) \
3376 V(fsaf, FSAF) \
3377 V(fsun, FSUN) \
3378 V(fseq, FSEQ) \
3379 V(fsueq, FSUEQ) \
3380 V(fslt, FSLT) \
3381 V(fsult, FSULT) \
3382 V(fsle, FSLE) \
3383 V(fsule, FSULE) \
3384 V(fadd, FADD) \
3385 V(fsub, FSUB) \
3386 V(fmul, FMUL) \
3387 V(fdiv, FDIV) \
3388 V(fmadd, FMADD) \
3389 V(fmsub, FMSUB) \
3390 V(fexp2, FEXP2) \
3391 V(fmin, FMIN) \
3392 V(fmin_a, FMIN_A) \
3393 V(fmax, FMAX) \
3394 V(fmax_a, FMAX_A) \
3395 V(fcor, FCOR) \
3396 V(fcune, FCUNE) \
3397 V(fcne, FCNE) \
3398 V(fsor, FSOR) \
3399 V(fsune, FSUNE) \
3400 V(fsne, FSNE)
3401
3402 #define MSA_3RF_LIST2(V) \
3403 V(fexdo, FEXDO) \
3404 V(ftq, FTQ) \
3405 V(mul_q, MUL_Q) \
3406 V(madd_q, MADD_Q) \
3407 V(msub_q, MSUB_Q) \
3408 V(mulr_q, MULR_Q) \
3409 V(maddr_q, MADDR_Q) \
3410 V(msubr_q, MSUBR_Q)
3411
3412 #define MSA_3RF_FORMAT(name, opcode, df, df_c) \
3413 void Assembler::name##_##df(MSARegister wd, MSARegister ws, \
3414 MSARegister wt) { \
3415 GenInstrMsa3RF(opcode, df_c, wt, ws, wd); \
3416 }
3417
3418 #define MSA_3RF_1(name, opcode) \
3419 MSA_3RF_FORMAT(name, opcode, w, 0) \
3420 MSA_3RF_FORMAT(name, opcode, d, 1)
3421
3422 #define MSA_3RF_2(name, opcode) \
3423 MSA_3RF_FORMAT(name, opcode, h, 0) \
3424 MSA_3RF_FORMAT(name, opcode, w, 1)
3425
3426 MSA_3RF_LIST1(MSA_3RF_1)
3427 MSA_3RF_LIST2(MSA_3RF_2)
3428 #undef MSA_3RF_1
3429 #undef MSA_3RF_2
3430 #undef MSA_3RF_FORMAT
3431 #undef MSA_3RF_LIST1
3432 #undef MSA_3RF_LIST2
3433
3434 void Assembler::sldi_b(MSARegister wd, MSARegister ws, uint32_t n) {
3435 GenInstrMsaElm<MSARegister, MSARegister>(SLDI, ELM_DF_B, n, ws, wd);
3436 }
3437
3438 void Assembler::sldi_h(MSARegister wd, MSARegister ws, uint32_t n) {
3439 GenInstrMsaElm<MSARegister, MSARegister>(SLDI, ELM_DF_H, n, ws, wd);
3440 }
3441
3442 void Assembler::sldi_w(MSARegister wd, MSARegister ws, uint32_t n) {
3443 GenInstrMsaElm<MSARegister, MSARegister>(SLDI, ELM_DF_W, n, ws, wd);
3444 }
3445
3446 void Assembler::sldi_d(MSARegister wd, MSARegister ws, uint32_t n) {
3447 GenInstrMsaElm<MSARegister, MSARegister>(SLDI, ELM_DF_D, n, ws, wd);
3448 }
3449
3450 void Assembler::splati_b(MSARegister wd, MSARegister ws, uint32_t n) {
3451 GenInstrMsaElm<MSARegister, MSARegister>(SPLATI, ELM_DF_B, n, ws, wd);
3452 }
3453
3454 void Assembler::splati_h(MSARegister wd, MSARegister ws, uint32_t n) {
3455 GenInstrMsaElm<MSARegister, MSARegister>(SPLATI, ELM_DF_H, n, ws, wd);
3456 }
3457
3458 void Assembler::splati_w(MSARegister wd, MSARegister ws, uint32_t n) {
3459 GenInstrMsaElm<MSARegister, MSARegister>(SPLATI, ELM_DF_W, n, ws, wd);
3460 }
3461
3462 void Assembler::splati_d(MSARegister wd, MSARegister ws, uint32_t n) {
3463 GenInstrMsaElm<MSARegister, MSARegister>(SPLATI, ELM_DF_D, n, ws, wd);
3464 }
3465
3466 void Assembler::copy_s_b(Register rd, MSARegister ws, uint32_t n) {
3467 GenInstrMsaElm<Register, MSARegister>(COPY_S, ELM_DF_B, n, ws, rd);
3468 }
3469
3470 void Assembler::copy_s_h(Register rd, MSARegister ws, uint32_t n) {
3471 GenInstrMsaElm<Register, MSARegister>(COPY_S, ELM_DF_H, n, ws, rd);
3472 }
3473
3474 void Assembler::copy_s_w(Register rd, MSARegister ws, uint32_t n) {
3475 GenInstrMsaElm<Register, MSARegister>(COPY_S, ELM_DF_W, n, ws, rd);
3476 }
3477
3478 void Assembler::copy_u_b(Register rd, MSARegister ws, uint32_t n) {
3479 GenInstrMsaElm<Register, MSARegister>(COPY_U, ELM_DF_B, n, ws, rd);
3480 }
3481
3482 void Assembler::copy_u_h(Register rd, MSARegister ws, uint32_t n) {
3483 GenInstrMsaElm<Register, MSARegister>(COPY_U, ELM_DF_H, n, ws, rd);
3484 }
3485
3486 void Assembler::copy_u_w(Register rd, MSARegister ws, uint32_t n) {
3487 GenInstrMsaElm<Register, MSARegister>(COPY_U, ELM_DF_W, n, ws, rd);
3488 }
3489
3490 void Assembler::insert_b(MSARegister wd, uint32_t n, Register rs) {
3491 GenInstrMsaElm<MSARegister, Register>(INSERT, ELM_DF_B, n, rs, wd);
3492 }
3493
3494 void Assembler::insert_h(MSARegister wd, uint32_t n, Register rs) {
3495 GenInstrMsaElm<MSARegister, Register>(INSERT, ELM_DF_H, n, rs, wd);
3496 }
3497
3498 void Assembler::insert_w(MSARegister wd, uint32_t n, Register rs) {
3499 GenInstrMsaElm<MSARegister, Register>(INSERT, ELM_DF_W, n, rs, wd);
3500 }
3501
3502 void Assembler::insve_b(MSARegister wd, uint32_t n, MSARegister ws) {
3503 GenInstrMsaElm<MSARegister, MSARegister>(INSVE, ELM_DF_B, n, ws, wd);
3504 }
3505
3506 void Assembler::insve_h(MSARegister wd, uint32_t n, MSARegister ws) {
3507 GenInstrMsaElm<MSARegister, MSARegister>(INSVE, ELM_DF_H, n, ws, wd);
3508 }
3509
3510 void Assembler::insve_w(MSARegister wd, uint32_t n, MSARegister ws) {
3511 GenInstrMsaElm<MSARegister, MSARegister>(INSVE, ELM_DF_W, n, ws, wd);
3512 }
3513
3514 void Assembler::insve_d(MSARegister wd, uint32_t n, MSARegister ws) {
3515 GenInstrMsaElm<MSARegister, MSARegister>(INSVE, ELM_DF_D, n, ws, wd);
3516 }
3517
3518 void Assembler::move_v(MSARegister wd, MSARegister ws) {
3519 DCHECK(IsMipsArchVariant(kMips32r6) && IsEnabled(MIPS_SIMD));
3520 DCHECK(ws.is_valid() && wd.is_valid());
3521 Instr instr = MSA | MOVE_V | (ws.code() << kWsShift) |
3522 (wd.code() << kWdShift) | MSA_ELM_MINOR;
3523 emit(instr);
3524 }
3525
3526 void Assembler::ctcmsa(MSAControlRegister cd, Register rs) {
3527 DCHECK(IsMipsArchVariant(kMips32r6) && IsEnabled(MIPS_SIMD));
3528 DCHECK(cd.is_valid() && rs.is_valid());
3529 Instr instr = MSA | CTCMSA | (rs.code() << kWsShift) |
3530 (cd.code() << kWdShift) | MSA_ELM_MINOR;
3531 emit(instr);
3532 }
3533
3534 void Assembler::cfcmsa(Register rd, MSAControlRegister cs) {
3535 DCHECK(IsMipsArchVariant(kMips32r6) && IsEnabled(MIPS_SIMD));
3536 DCHECK(rd.is_valid() && cs.is_valid());
3537 Instr instr = MSA | CFCMSA | (cs.code() << kWsShift) |
3538 (rd.code() << kWdShift) | MSA_ELM_MINOR;
3539 emit(instr);
3540 }
3541
3542 #define MSA_BIT_LIST(V) \
3543 V(slli, SLLI) \
3544 V(srai, SRAI) \
3545 V(srli, SRLI) \
3546 V(bclri, BCLRI) \
3547 V(bseti, BSETI) \
3548 V(bnegi, BNEGI) \
3549 V(binsli, BINSLI) \
3550 V(binsri, BINSRI) \
3551 V(sat_s, SAT_S) \
3552 V(sat_u, SAT_U) \
3553 V(srari, SRARI) \
3554 V(srlri, SRLRI)
3555
3556 #define MSA_BIT_FORMAT(name, opcode, format) \
3557 void Assembler::name##_##format(MSARegister wd, MSARegister ws, \
3558 uint32_t m) { \
3559 GenInstrMsaBit(opcode, BIT_DF_##format, m, ws, wd); \
3560 }
3561
3562 #define MSA_BIT(name, opcode) \
3563 MSA_BIT_FORMAT(name, opcode, b) \
3564 MSA_BIT_FORMAT(name, opcode, h) \
3565 MSA_BIT_FORMAT(name, opcode, w) \
3566 MSA_BIT_FORMAT(name, opcode, d)
3567
3568 MSA_BIT_LIST(MSA_BIT)
3569 #undef MSA_BIT
3570 #undef MSA_BIT_FORMAT
3571 #undef MSA_BIT_LIST
2951 3572
2952 int Assembler::RelocateInternalReference(RelocInfo::Mode rmode, byte* pc, 3573 int Assembler::RelocateInternalReference(RelocInfo::Mode rmode, byte* pc,
2953 intptr_t pc_delta) { 3574 intptr_t pc_delta) {
2954 Instr instr = instr_at(pc); 3575 Instr instr = instr_at(pc);
2955 3576
2956 if (RelocInfo::IsInternalReference(rmode)) { 3577 if (RelocInfo::IsInternalReference(rmode)) {
2957 int32_t* p = reinterpret_cast<int32_t*>(pc); 3578 int32_t* p = reinterpret_cast<int32_t*>(pc);
2958 if (*p == 0) { 3579 if (*p == 0) {
2959 return 0; // Number of instructions patched. 3580 return 0; // Number of instructions patched.
2960 } 3581 }
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
3270 3891
3271 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { 3892 if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
3272 Assembler::FlushICache(isolate, pc, 2 * sizeof(int32_t)); 3893 Assembler::FlushICache(isolate, pc, 2 * sizeof(int32_t));
3273 } 3894 }
3274 } 3895 }
3275 3896
3276 } // namespace internal 3897 } // namespace internal
3277 } // namespace v8 3898 } // namespace v8
3278 3899
3279 #endif // V8_TARGET_ARCH_MIPS 3900 #endif // V8_TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698