+/* Subroutine of simplify_binary_operation, called via do_float_handler.
+ Handles simplification of binary ops on floating point values. */
+struct simplify_binary_real_args
+{
+ rtx trueop0, trueop1;
+ rtx result;
+ enum rtx_code code;
+ enum machine_mode mode;
+};
+
+static void
+simplify_binary_real (p)
+ PTR p;
+{
+ REAL_VALUE_TYPE f0, f1, value;
+ struct simplify_binary_real_args *args =
+ (struct simplify_binary_real_args *) p;
+
+ REAL_VALUE_FROM_CONST_DOUBLE (f0, args->trueop0);
+ REAL_VALUE_FROM_CONST_DOUBLE (f1, args->trueop1);
+ f0 = real_value_truncate (args->mode, f0);
+ f1 = real_value_truncate (args->mode, f1);
+
+#ifndef REAL_INFINITY
+ if (args->code == DIV && REAL_VALUES_EQUAL (f1, dconst0))
+ {
+ args->result = 0;
+ return;
+ }
+#endif
+ REAL_ARITHMETIC (value, rtx_to_tree_code (args->code), f0, f1);
+
+ value = real_value_truncate (args->mode, value);
+ args->result = CONST_DOUBLE_FROM_REAL_VALUE (value, args->mode);
+}
+
+/* Another subroutine called via do_float_handler. This one tests
+ the floating point value given against 2. and -1. */
+struct simplify_binary_is2orm1_args
+{
+ rtx value;
+ bool is_2;
+ bool is_m1;
+};
+
+static void
+simplify_binary_is2orm1 (p)
+ PTR p;
+{
+ REAL_VALUE_TYPE d;
+ struct simplify_binary_is2orm1_args *args =
+ (struct simplify_binary_is2orm1_args *) p;
+
+ REAL_VALUE_FROM_CONST_DOUBLE (d, args->value);
+ args->is_2 = REAL_VALUES_EQUAL (d, dconst2);
+ args->is_m1 = REAL_VALUES_EQUAL (d, dconstm1);
+}
+