diff options
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r-- | gcc/c-common.c | 149 |
1 files changed, 0 insertions, 149 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c index ab5b2ae3b49..dddd6ecace2 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -3500,155 +3500,6 @@ strip_pointer_operator (tree t) return t; } -static tree expand_unordered_cmp (tree, tree, enum tree_code, enum tree_code); - -/* Expand a call to an unordered comparison function such as - __builtin_isgreater(). FUNCTION is the function's declaration and - PARAMS a list of the values passed. For __builtin_isunordered(), - UNORDERED_CODE is UNORDERED_EXPR and ORDERED_CODE is NOP_EXPR. In - other cases, UNORDERED_CODE and ORDERED_CODE are comparison codes - that give the opposite of the desired result. UNORDERED_CODE is - used for modes that can hold NaNs and ORDERED_CODE is used for the - rest. */ - -static tree -expand_unordered_cmp (tree function, tree params, - enum tree_code unordered_code, - enum tree_code ordered_code) -{ - tree arg0, arg1, type; - enum tree_code code0, code1; - - /* Check that we have exactly two arguments. */ - if (params == 0 || TREE_CHAIN (params) == 0) - { - error ("too few arguments to function `%s'", - IDENTIFIER_POINTER (DECL_NAME (function))); - return error_mark_node; - } - else if (TREE_CHAIN (TREE_CHAIN (params)) != 0) - { - error ("too many arguments to function `%s'", - IDENTIFIER_POINTER (DECL_NAME (function))); - return error_mark_node; - } - - arg0 = TREE_VALUE (params); - arg1 = TREE_VALUE (TREE_CHAIN (params)); - - code0 = TREE_CODE (TREE_TYPE (arg0)); - code1 = TREE_CODE (TREE_TYPE (arg1)); - - /* Make sure that the arguments have a common type of REAL. */ - type = 0; - if ((code0 == INTEGER_TYPE || code0 == REAL_TYPE) - && (code1 == INTEGER_TYPE || code1 == REAL_TYPE)) - type = common_type (TREE_TYPE (arg0), TREE_TYPE (arg1)); - - if (type == 0 || TREE_CODE (type) != REAL_TYPE) - { - error ("non-floating-point argument to function `%s'", - IDENTIFIER_POINTER (DECL_NAME (function))); - return error_mark_node; - } - - if (unordered_code == UNORDERED_EXPR) - { - if (MODE_HAS_NANS (TYPE_MODE (type))) - return build_binary_op (unordered_code, - convert (type, arg0), - convert (type, arg1), - 0); - else - return integer_zero_node; - } - - return build_unary_op (TRUTH_NOT_EXPR, - build_binary_op (MODE_HAS_NANS (TYPE_MODE (type)) - ? unordered_code - : ordered_code, - convert (type, arg0), - convert (type, arg1), - 0), - 0); -} - - -/* Recognize certain built-in functions so we can make tree-codes - other than CALL_EXPR. We do this when it enables fold-const.c - to do something useful. */ -/* ??? By rights this should go in builtins.c, but only C and C++ - implement build_{binary,unary}_op. Not exactly sure what bits - of functionality are actually needed from those functions, or - where the similar functionality exists in the other front ends. */ - -tree -expand_tree_builtin (tree function, tree params, tree coerced_params) -{ - if (DECL_BUILT_IN_CLASS (function) != BUILT_IN_NORMAL) - return NULL_TREE; - - switch (DECL_FUNCTION_CODE (function)) - { - case BUILT_IN_ABS: - case BUILT_IN_LABS: - case BUILT_IN_LLABS: - case BUILT_IN_IMAXABS: - case BUILT_IN_FABS: - case BUILT_IN_FABSL: - case BUILT_IN_FABSF: - if (coerced_params == 0) - return integer_zero_node; - return build_unary_op (ABS_EXPR, TREE_VALUE (coerced_params), 0); - - case BUILT_IN_CONJ: - case BUILT_IN_CONJF: - case BUILT_IN_CONJL: - if (coerced_params == 0) - return integer_zero_node; - return build_unary_op (CONJ_EXPR, TREE_VALUE (coerced_params), 0); - - case BUILT_IN_CREAL: - case BUILT_IN_CREALF: - case BUILT_IN_CREALL: - if (coerced_params == 0) - return integer_zero_node; - return non_lvalue (build_unary_op (REALPART_EXPR, - TREE_VALUE (coerced_params), 0)); - - case BUILT_IN_CIMAG: - case BUILT_IN_CIMAGF: - case BUILT_IN_CIMAGL: - if (coerced_params == 0) - return integer_zero_node; - return non_lvalue (build_unary_op (IMAGPART_EXPR, - TREE_VALUE (coerced_params), 0)); - - case BUILT_IN_ISGREATER: - return expand_unordered_cmp (function, params, UNLE_EXPR, LE_EXPR); - - case BUILT_IN_ISGREATEREQUAL: - return expand_unordered_cmp (function, params, UNLT_EXPR, LT_EXPR); - - case BUILT_IN_ISLESS: - return expand_unordered_cmp (function, params, UNGE_EXPR, GE_EXPR); - - case BUILT_IN_ISLESSEQUAL: - return expand_unordered_cmp (function, params, UNGT_EXPR, GT_EXPR); - - case BUILT_IN_ISLESSGREATER: - return expand_unordered_cmp (function, params, UNEQ_EXPR, EQ_EXPR); - - case BUILT_IN_ISUNORDERED: - return expand_unordered_cmp (function, params, UNORDERED_EXPR, NOP_EXPR); - - default: - break; - } - - return NULL_TREE; -} - /* Walk the statement tree, rooted at *tp. Apply FUNC to all the sub-trees of *TP in a pre-order traversal. FUNC is called with the DATA and the address of each sub-tree. If FUNC returns a non-NULL |