@@ -1246,22 +1246,6 @@ emit_branch_insn (hsa_insn_br *br)
brig_insn_count++;
}
-/* Return true iff TYPE is a floating point number type. */
-
-static bool
-float_type_p (BrigType16_t t)
-{
- switch (t & BRIG_TYPE_BASE_MASK)
- {
- case BRIG_TYPE_F16:
- case BRIG_TYPE_F32:
- case BRIG_TYPE_F64:
- return true;
- default:
- return false;
- }
-}
-
/* Emit a HSA convert instruction and all necessary directives, schedule
necessary operands for writing. */
@@ -1300,8 +1284,8 @@ emit_cvt_insn (hsa_insn_basic *insn)
repr.modifier.allBits = 0;
/* float to smaller float requires a rounding setting (we default
to 'near'. */
- if (float_type_p (insn->type)
- && (!float_type_p (srctype)
+ if (hsa_type_float_p (insn->type)
+ && (!hsa_type_float_p (srctype)
|| ((insn->type & BRIG_TYPE_BASE_MASK)
< (srctype & BRIG_TYPE_BASE_MASK))))
repr.round = BRIG_ROUND_FLOAT_NEAR_EVEN;
@@ -1469,7 +1453,7 @@ emit_basic_insn (hsa_insn_basic *insn)
if ((type & BRIG_TYPE_PACK_MASK) != BRIG_TYPE_PACK_NONE)
{
- if (float_type_p (type))
+ if (hsa_type_float_p (type))
repr.round = BRIG_ROUND_FLOAT_NEAR_EVEN;
else
repr.round = 0;
@@ -443,22 +443,6 @@ hsa_type_for_tree_type (const_tree type, unsigned HOST_WIDE_INT *dim_p)
return hsa_type_for_scalar_tree_type (type, false);
}
-/* Return true iff TYPE is a floating point number type. */
-
-static bool
-hsa_type_float_p (BrigType16_t type)
-{
- switch (type & BRIG_TYPE_BASE_MASK)
- {
- case BRIG_TYPE_F16:
- case BRIG_TYPE_F32:
- case BRIG_TYPE_F64:
- return true;
- default:
- return false;
- }
-}
-
/* Returns true if converting from STYPE into DTYPE needs the _CVT
opcode. If false a normal _MOV is enough. */
@@ -247,6 +247,22 @@ hsa_bittype_for_type (BrigType16_t t)
}
}
+/* Return true iff TYPE is a floating point number type. */
+
+bool
+hsa_type_float_p (BrigType16_t type)
+{
+ switch (type & BRIG_TYPE_BASE_MASK)
+ {
+ case BRIG_TYPE_F16:
+ case BRIG_TYPE_F32:
+ case BRIG_TYPE_F64:
+ return true;
+ default:
+ return false;
+ }
+}
+
/* Create a mapping between the original function DECL and kernel name NAME. */
void
@@ -615,6 +615,7 @@ bool hsa_full_profile_p (void);
bool hsa_opcode_op_output_p (BrigOpcode16_t, int);
unsigned hsa_type_bit_size (BrigType16_t t);
BrigType16_t hsa_bittype_for_type (BrigType16_t t);
+bool hsa_type_float_p (BrigType16_t type);
void hsa_add_kern_decl_mapping (tree decl, char *name);
unsigned hsa_get_number_decl_kernel_mappings (void);
tree hsa_get_decl_kernel_mapping_decl (unsigned i);