912 b_op = 18,
913 bc_op = 16,
914 bcr_op = 19
915 };
916
917 enum Condition {
918 negative = 0,
919 less = 0,
920 positive = 1,
921 greater = 1,
922 zero = 2,
923 equal = 2,
924 summary_overflow = 3,
925 };
926
927 public:
928 // Helper functions for groups of instructions
929
930 enum Predict { pt = 1, pn = 0 }; // pt = predict taken
931
932 // Instruction must start at passed address.
933 static int instr_len(unsigned char *instr) { return BytesPerInstWord; }
934
935 // longest instructions
936 static int instr_maxlen() { return BytesPerInstWord; }
937
938 // Test if x is within signed immediate range for nbits.
939 static bool is_simm(int x, unsigned int nbits) {
940 assert(0 < nbits && nbits < 32, "out of bounds");
941 const int min = -(((int)1) << nbits-1);
942 const int maxplus1 = (((int)1) << nbits-1);
943 return min <= x && x < maxplus1;
944 }
945
946 static bool is_simm(jlong x, unsigned int nbits) {
947 assert(0 < nbits && nbits < 64, "out of bounds");
948 const jlong min = -(((jlong)1) << nbits-1);
949 const jlong maxplus1 = (((jlong)1) << nbits-1);
950 return min <= x && x < maxplus1;
951 }
952
953 // Test if x is within unsigned immediate range for nbits.
954 static bool is_uimm(int x, unsigned int nbits) {
955 assert(0 < nbits && nbits < 32, "out of bounds");
956 const unsigned int maxplus1 = (((unsigned int)1) << nbits);
|
912 b_op = 18,
913 bc_op = 16,
914 bcr_op = 19
915 };
916
917 enum Condition {
918 negative = 0,
919 less = 0,
920 positive = 1,
921 greater = 1,
922 zero = 2,
923 equal = 2,
924 summary_overflow = 3,
925 };
926
927 public:
928 // Helper functions for groups of instructions
929
930 enum Predict { pt = 1, pn = 0 }; // pt = predict taken
931
932 //---< calculate length of instruction >---
933 // With PPC64 being a RISC architecture, this always is BytesPerInstWord
934 // instruction must start at passed address
935 static unsigned int instr_len(unsigned char *instr) { return BytesPerInstWord; }
936
937 //---< longest instructions >---
938 static unsigned int instr_maxlen() { return BytesPerInstWord; }
939
940 // Test if x is within signed immediate range for nbits.
941 static bool is_simm(int x, unsigned int nbits) {
942 assert(0 < nbits && nbits < 32, "out of bounds");
943 const int min = -(((int)1) << nbits-1);
944 const int maxplus1 = (((int)1) << nbits-1);
945 return min <= x && x < maxplus1;
946 }
947
948 static bool is_simm(jlong x, unsigned int nbits) {
949 assert(0 < nbits && nbits < 64, "out of bounds");
950 const jlong min = -(((jlong)1) << nbits-1);
951 const jlong maxplus1 = (((jlong)1) << nbits-1);
952 return min <= x && x < maxplus1;
953 }
954
955 // Test if x is within unsigned immediate range for nbits.
956 static bool is_uimm(int x, unsigned int nbits) {
957 assert(0 < nbits && nbits < 32, "out of bounds");
958 const unsigned int maxplus1 = (((unsigned int)1) << nbits);
|