[PATCH, i386]: Fix PR 89397, ICE in build_call_expr_loc_array at gcc/tree.c
Uros Bizjak
ubizjak@gmail.com
Wed Feb 20 22:22:00 GMT 2019
TARGET_SSE_MATH does not imply TARGET_SSE. Attached patch fixes a
couple of places where this rule is violated.
BTW: There is no testcase, since the test in the PR triggers bogus
warning about register return with disabled register set on x86_64.
This is an orthogonal issue.
--cut here--
float z, a, b;
void test (void) { z = a + b; }
--cut here--
./cc1 -O2 -mno-sse -mno-80387 -quiet plus.c
plus.c: In function ‘test’:
plus.c:3:22: error: SSE register return with SSE disabled
3 | void test (void) { z = a + b; }
| ~~^~~~~~~
There is no SSE register return.
2019-02-20 Uroš Bizjak <ubizjak@gmail.com>
PR target/89397
* config/i386/i386.c (ix86_atomic_assign_expand_fenv): Check
TARGET_SSE in addition to TARGET_SSE_MATH.
(ix86_excess_precision): Ditto.
(ix86_float_exceptions_rounding_supported_p): Ditto.
(use_rsqrt_p): Ditto.
* config/i386/sse.md (rsqrt<mode>2): Ditto.
Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.
Committed to mainline, patch will be backported to release branches.
Uros.
-------------- next part --------------
Index: i386/i386.c
===================================================================
--- i386/i386.c (revision 269040)
+++ i386/i386.c (working copy)
@@ -39215,7 +39215,7 @@ ix86_vectorize_builtin_scatter (const_tree vectype
static bool
use_rsqrt_p ()
{
- return (TARGET_SSE_MATH
+ return (TARGET_SSE && TARGET_SSE_MATH
&& flag_finite_math_only
&& !flag_trapping_math
&& flag_unsafe_math_optimizations);
@@ -50681,7 +50681,7 @@ ix86_float_exceptions_rounding_supported_p (void)
there is no adddf3 pattern (since x87 floating point only has
XFmode operations) so the default hook implementation gets this
wrong. */
- return TARGET_80387 || TARGET_SSE_MATH;
+ return TARGET_80387 || (TARGET_SSE && TARGET_SSE_MATH);
}
/* Implement TARGET_ATOMIC_ASSIGN_EXPAND_FENV. */
@@ -50689,7 +50689,7 @@ ix86_float_exceptions_rounding_supported_p (void)
static void
ix86_atomic_assign_expand_fenv (tree *hold, tree *clear, tree *update)
{
- if (!TARGET_80387 && !TARGET_SSE_MATH)
+ if (!TARGET_80387 && !(TARGET_SSE && TARGET_SSE_MATH))
return;
tree exceptions_var = create_tmp_var_raw (integer_type_node);
if (TARGET_80387)
@@ -50724,7 +50724,7 @@ ix86_atomic_assign_expand_fenv (tree *hold, tree *
tree update_fldenv = build_call_expr (fldenv, 1, fenv_addr);
*update = build2 (COMPOUND_EXPR, void_type_node, *update, update_fldenv);
}
- if (TARGET_SSE_MATH)
+ if (TARGET_SSE && TARGET_SSE_MATH)
{
tree mxcsr_orig_var = create_tmp_var_raw (unsigned_type_node);
tree mxcsr_mod_var = create_tmp_var_raw (unsigned_type_node);
@@ -51014,7 +51014,7 @@ ix86_excess_precision (enum excess_precision_type
return FLT_EVAL_METHOD_PROMOTE_TO_FLOAT;
else if (!TARGET_MIX_SSE_I387)
{
- if (!TARGET_SSE_MATH)
+ if (!(TARGET_SSE && TARGET_SSE_MATH))
return FLT_EVAL_METHOD_PROMOTE_TO_LONG_DOUBLE;
else if (TARGET_SSE2)
return FLT_EVAL_METHOD_PROMOTE_TO_FLOAT;
Index: i386/sse.md
===================================================================
--- i386/sse.md (revision 269039)
+++ i386/sse.md (working copy)
@@ -1972,7 +1972,7 @@
[(set (match_operand:VF1_128_256 0 "register_operand")
(unspec:VF1_128_256
[(match_operand:VF1_128_256 1 "vector_operand")] UNSPEC_RSQRT))]
- "TARGET_SSE_MATH"
+ "TARGET_SSE && TARGET_SSE_MATH"
{
ix86_emit_swsqrtsf (operands[0], operands[1], <MODE>mode, true);
DONE;
More information about the Gcc-patches
mailing list