src/hotspot/cpu/sparc/assembler_sparc.hpp
changeset 47561 f59f0e51ef8a
parent 47216 71c04702a3d5
child 47563 bbd116ac5ef3
equal deleted inserted replaced
47560:e4a5b535c0d2 47561:f59f0e51ef8a
   120     saved_op3    = 0x31,
   120     saved_op3    = 0x31,
   121 
   121 
   122     fpop1_op3    = 0x34,
   122     fpop1_op3    = 0x34,
   123     fpop2_op3    = 0x35,
   123     fpop2_op3    = 0x35,
   124     impdep1_op3  = 0x36,
   124     impdep1_op3  = 0x36,
       
   125     addx_op3     = 0x36,
   125     aes3_op3     = 0x36,
   126     aes3_op3     = 0x36,
   126     sha_op3      = 0x36,
   127     sha_op3      = 0x36,
   127     bmask_op3    = 0x36,
   128     bmask_op3    = 0x36,
   128     bshuffle_op3   = 0x36,
   129     bshuffle_op3   = 0x36,
   129     alignaddr_op3  = 0x36,
   130     alignaddr_op3  = 0x36,
   131     flog3_op3    = 0x36,
   132     flog3_op3    = 0x36,
   132     edge_op3     = 0x36,
   133     edge_op3     = 0x36,
   133     fzero_op3    = 0x36,
   134     fzero_op3    = 0x36,
   134     fsrc_op3     = 0x36,
   135     fsrc_op3     = 0x36,
   135     fnot_op3     = 0x36,
   136     fnot_op3     = 0x36,
       
   137     mpmul_op3    = 0x36,
       
   138     umulx_op3    = 0x36,
   136     xmulx_op3    = 0x36,
   139     xmulx_op3    = 0x36,
   137     crc32c_op3   = 0x36,
   140     crc32c_op3   = 0x36,
   138     impdep2_op3  = 0x37,
   141     impdep2_op3  = 0x37,
   139     stpartialf_op3 = 0x37,
   142     stpartialf_op3 = 0x37,
   140     jmpl_op3     = 0x38,
   143     jmpl_op3     = 0x38,
   193     fmovd_opf          = 0x02,
   196     fmovd_opf          = 0x02,
   194 
   197 
   195     fnegs_opf          = 0x05,
   198     fnegs_opf          = 0x05,
   196     fnegd_opf          = 0x06,
   199     fnegd_opf          = 0x06,
   197 
   200 
       
   201     addxc_opf          = 0x11,
       
   202     addxccc_opf        = 0x13,
       
   203     umulxhi_opf        = 0x16,
   198     alignaddr_opf      = 0x18,
   204     alignaddr_opf      = 0x18,
   199     bmask_opf          = 0x19,
   205     bmask_opf          = 0x19,
   200 
   206 
   201     fadds_opf          = 0x41,
   207     fadds_opf          = 0x41,
   202     faddd_opf          = 0x42,
   208     faddd_opf          = 0x42,
   238 
   244 
   239     sha1_opf           = 0x141,
   245     sha1_opf           = 0x141,
   240     sha256_opf         = 0x142,
   246     sha256_opf         = 0x142,
   241     sha512_opf         = 0x143,
   247     sha512_opf         = 0x143,
   242 
   248 
   243     crc32c_opf         = 0x147
   249     crc32c_opf         = 0x147,
       
   250     mpmul_opf          = 0x148
   244   };
   251   };
   245 
   252 
   246   enum op5s {
   253   enum op5s {
   247     aes_eround01_op5   = 0x00,
   254     aes_eround01_op5   = 0x00,
   248     aes_eround23_op5   = 0x01,
   255     aes_eround23_op5   = 0x01,
   378   static void assert_signed_word_disp_range(intptr_t x, int nbits) {
   385   static void assert_signed_word_disp_range(intptr_t x, int nbits) {
   379     assert((x & 3) == 0, "not word aligned");
   386     assert((x & 3) == 0, "not word aligned");
   380     assert_signed_range(x, nbits + 2);
   387     assert_signed_range(x, nbits + 2);
   381   }
   388   }
   382 
   389 
   383   static void assert_unsigned_const(int x, int nbits) {
   390   static void assert_unsigned_range(int x, int nbits) {
   384     assert(juint(x) < juint(1 << nbits), "unsigned constant out of range");
   391     assert(juint(x) < juint(1 << nbits), "unsigned constant out of range");
   385   }
   392   }
   386 
   393 
   387   // fields: note bits numbered from LSB = 0, fields known by inclusive bit range
   394   // fields: note bits numbered from LSB = 0, fields known by inclusive bit range
   388 
   395 
   532   static int simm(int x, int nbits) {
   539   static int simm(int x, int nbits) {
   533     assert_signed_range(x, nbits);
   540     assert_signed_range(x, nbits);
   534     return x & ((1 << nbits) - 1);
   541     return x & ((1 << nbits) - 1);
   535   }
   542   }
   536 
   543 
       
   544   // unsigned immediate, in low bits, at most nbits long.
       
   545   static int uimm(int x, int nbits) {
       
   546     assert_unsigned_range(x, nbits);
       
   547     return x & ((1 << nbits) - 1);
       
   548   }
       
   549 
   537   // compute inverse of wdisp16
   550   // compute inverse of wdisp16
   538   static intptr_t inv_wdisp16(int x, intptr_t pos) {
   551   static intptr_t inv_wdisp16(int x, intptr_t pos) {
   539     int lo = x & ((1 << 14) - 1);
   552     int lo = x & ((1 << 14) - 1);
   540     int hi = (x >> 20) & 3;
   553     int hi = (x >> 20) & 3;
   541     if (hi >= 2) hi |= ~1;
   554     if (hi >= 2) hi |= ~1;
   628   // CRC32C instruction supported only on certain processors
   641   // CRC32C instruction supported only on certain processors
   629   static void crc32c_only() { assert(VM_Version::has_crc32c(), "This instruction only works on SPARC with CRC32C"); }
   642   static void crc32c_only() { assert(VM_Version::has_crc32c(), "This instruction only works on SPARC with CRC32C"); }
   630 
   643 
   631   // FMAf instructions supported only on certain processors
   644   // FMAf instructions supported only on certain processors
   632   static void fmaf_only() { assert(VM_Version::has_fmaf(), "This instruction only works on SPARC with FMAf"); }
   645   static void fmaf_only() { assert(VM_Version::has_fmaf(), "This instruction only works on SPARC with FMAf"); }
       
   646 
       
   647   // MPMUL instruction supported only on certain processors
       
   648   static void mpmul_only() { assert( VM_Version::has_mpmul(), "This instruction only works on SPARC with MPMUL"); }
   633 
   649 
   634   // instruction only in VIS1
   650   // instruction only in VIS1
   635   static void vis1_only() { assert(VM_Version::has_vis1(), "This instruction only works on SPARC with VIS1"); }
   651   static void vis1_only() { assert(VM_Version::has_vis1(), "This instruction only works on SPARC with VIS1"); }
   636 
   652 
   637   // instruction only in VIS2
   653   // instruction only in VIS2
   770     validate_no_pipeline_hazards();
   786     validate_no_pipeline_hazards();
   771 #endif
   787 #endif
   772     AbstractAssembler::flush();
   788     AbstractAssembler::flush();
   773   }
   789   }
   774 
   790 
   775   inline void emit_int32(int);  // shadows AbstractAssembler::emit_int32
   791   inline void emit_int32(int32_t);  // shadows AbstractAssembler::emit_int32
   776   inline void emit_data(int);
   792   inline void emit_data(int32_t);
   777   inline void emit_data(int, RelocationHolder const &rspec);
   793   inline void emit_data(int32_t, RelocationHolder const&);
   778   inline void emit_data(int, relocInfo::relocType rtype);
   794   inline void emit_data(int32_t, relocInfo::relocType rtype);
   779   // helper for above functions
   795 
       
   796   // Helper for the above functions.
   780   inline void check_delay();
   797   inline void check_delay();
   781 
   798 
   782 
   799 
   783  public:
   800  public:
   784   // instructions, refer to page numbers in the SPARC Architecture Manual, V9
   801   // instructions, refer to page numbers in the SPARC Architecture Manual, V9
   958 
   975 
   959   inline void ldf(FloatRegisterImpl::Width w, Register s1, Register s2, FloatRegister d);
   976   inline void ldf(FloatRegisterImpl::Width w, Register s1, Register s2, FloatRegister d);
   960   inline void ldf(FloatRegisterImpl::Width w, Register s1, int simm13a, FloatRegister d,
   977   inline void ldf(FloatRegisterImpl::Width w, Register s1, int simm13a, FloatRegister d,
   961                   RelocationHolder const &rspec = RelocationHolder());
   978                   RelocationHolder const &rspec = RelocationHolder());
   962 
   979 
       
   980   inline void ldd(Register s1, Register s2, FloatRegister d);
       
   981   inline void ldd(Register s1, int simm13a, FloatRegister d);
   963 
   982 
   964   inline void ldfsr(Register s1, Register s2);
   983   inline void ldfsr(Register s1, Register s2);
   965   inline void ldfsr(Register s1, int simm13a);
   984   inline void ldfsr(Register s1, int simm13a);
   966   inline void ldxfsr(Register s1, Register s2);
   985   inline void ldxfsr(Register s1, Register s2);
   967   inline void ldxfsr(Register s1, int simm13a);
   986   inline void ldxfsr(Register s1, int simm13a);
   985   inline void lduh(Register s1, int simm13a, Register d);
  1004   inline void lduh(Register s1, int simm13a, Register d);
   986   inline void lduw(Register s1, Register s2, Register d);
  1005   inline void lduw(Register s1, Register s2, Register d);
   987   inline void lduw(Register s1, int simm13a, Register d);
  1006   inline void lduw(Register s1, int simm13a, Register d);
   988   inline void ldx(Register s1, Register s2, Register d);
  1007   inline void ldx(Register s1, Register s2, Register d);
   989   inline void ldx(Register s1, int simm13a, Register d);
  1008   inline void ldx(Register s1, int simm13a, Register d);
   990   inline void ldd(Register s1, Register s2, Register d);
       
   991   inline void ldd(Register s1, int simm13a, Register d);
       
   992 
  1009 
   993   // pp 177
  1010   // pp 177
   994 
  1011 
   995   inline void ldsba(Register s1, Register s2, int ia, Register d);
  1012   inline void ldsba(Register s1, Register s2, int ia, Register d);
   996   inline void ldsba(Register s1, int simm13a,         Register d);
  1013   inline void ldsba(Register s1, int simm13a,         Register d);
  1155   // pp 222
  1172   // pp 222
  1156 
  1173 
  1157   inline void stf(FloatRegisterImpl::Width w, FloatRegister d, Register s1, Register s2);
  1174   inline void stf(FloatRegisterImpl::Width w, FloatRegister d, Register s1, Register s2);
  1158   inline void stf(FloatRegisterImpl::Width w, FloatRegister d, Register s1, int simm13a);
  1175   inline void stf(FloatRegisterImpl::Width w, FloatRegister d, Register s1, int simm13a);
  1159 
  1176 
       
  1177   inline void std(FloatRegister d, Register s1, Register s2);
       
  1178   inline void std(FloatRegister d, Register s1, int simm13a);
       
  1179 
  1160   inline void stfsr(Register s1, Register s2);
  1180   inline void stfsr(Register s1, Register s2);
  1161   inline void stfsr(Register s1, int simm13a);
  1181   inline void stfsr(Register s1, int simm13a);
  1162   inline void stxfsr(Register s1, Register s2);
  1182   inline void stxfsr(Register s1, Register s2);
  1163   inline void stxfsr(Register s1, int simm13a);
  1183   inline void stxfsr(Register s1, int simm13a);
  1164 
  1184 
  1175   inline void sth(Register d, Register s1, int simm13a);
  1195   inline void sth(Register d, Register s1, int simm13a);
  1176   inline void stw(Register d, Register s1, Register s2);
  1196   inline void stw(Register d, Register s1, Register s2);
  1177   inline void stw(Register d, Register s1, int simm13a);
  1197   inline void stw(Register d, Register s1, int simm13a);
  1178   inline void stx(Register d, Register s1, Register s2);
  1198   inline void stx(Register d, Register s1, Register s2);
  1179   inline void stx(Register d, Register s1, int simm13a);
  1199   inline void stx(Register d, Register s1, int simm13a);
  1180   inline void std(Register d, Register s1, Register s2);
       
  1181   inline void std(Register d, Register s1, int simm13a);
       
  1182 
  1200 
  1183   // pp 177
  1201   // pp 177
  1184 
  1202 
  1185   inline void stba(Register d, Register s1, Register s2, int ia);
  1203   inline void stba(Register d, Register s1, Register s2, int ia);
  1186   inline void stba(Register d, Register s1, int simm13a);
  1204   inline void stba(Register d, Register s1, int simm13a);
  1265   inline void bmask(Register s1, Register s2, Register d);
  1283   inline void bmask(Register s1, Register s2, Register d);
  1266   inline void bshuffle(FloatRegister s1, FloatRegister s2, FloatRegister d);
  1284   inline void bshuffle(FloatRegister s1, FloatRegister s2, FloatRegister d);
  1267 
  1285 
  1268   // VIS3 instructions
  1286   // VIS3 instructions
  1269 
  1287 
       
  1288   inline void addxc(Register s1, Register s2, Register d);
       
  1289   inline void addxccc(Register s1, Register s2, Register d);
       
  1290 
  1270   inline void movstosw(FloatRegister s, Register d);
  1291   inline void movstosw(FloatRegister s, Register d);
  1271   inline void movstouw(FloatRegister s, Register d);
  1292   inline void movstouw(FloatRegister s, Register d);
  1272   inline void movdtox(FloatRegister s, Register d);
  1293   inline void movdtox(FloatRegister s, Register d);
  1273 
  1294 
  1274   inline void movwtos(Register s, FloatRegister d);
  1295   inline void movwtos(Register s, FloatRegister d);
  1275   inline void movxtod(Register s, FloatRegister d);
  1296   inline void movxtod(Register s, FloatRegister d);
  1276 
  1297 
  1277   inline void xmulx(Register s1, Register s2, Register d);
  1298   inline void xmulx(Register s1, Register s2, Register d);
  1278   inline void xmulxhi(Register s1, Register s2, Register d);
  1299   inline void xmulxhi(Register s1, Register s2, Register d);
       
  1300   inline void umulxhi(Register s1, Register s2, Register d);
  1279 
  1301 
  1280   // Crypto SHA instructions
  1302   // Crypto SHA instructions
  1281 
  1303 
  1282   inline void sha1();
  1304   inline void sha1();
  1283   inline void sha256();
  1305   inline void sha256();
  1284   inline void sha512();
  1306   inline void sha512();
  1285 
  1307 
  1286   // CRC32C instruction
  1308   // CRC32C instruction
  1287 
  1309 
  1288   inline void crc32c(FloatRegister s1, FloatRegister s2, FloatRegister d);
  1310   inline void crc32c(FloatRegister s1, FloatRegister s2, FloatRegister d);
       
  1311 
       
  1312   // MPMUL instruction
       
  1313 
       
  1314   inline void mpmul(int uimm5);
  1289 
  1315 
  1290   // Creation
  1316   // Creation
  1291   Assembler(CodeBuffer* code) : AbstractAssembler(code) {
  1317   Assembler(CodeBuffer* code) : AbstractAssembler(code) {
  1292 #ifdef VALIDATE_PIPELINE
  1318 #ifdef VALIDATE_PIPELINE
  1293     _delay_state  = NoDelay;
  1319     _delay_state  = NoDelay;