diff mbox series

[x86] Tweak i386-expand.cc to restore bootstrap on RHEL.

Message ID 011b01dad5f3$9f28c770$dd7a5650$@nextmovesoftware.com
State New
Headers show
Series [x86] Tweak i386-expand.cc to restore bootstrap on RHEL. | expand

Commit Message

Roger Sayle July 14, 2024, 1:42 p.m. UTC
This is a minor change to restore bootstrap on systems using gcc 4.8
as a host compiler.  The fatal error is:

In file included from gcc/gcc/coretypes.h:471:0,
                 from gcc/gcc/config/i386/i386-expand.cc:23:
gcc/gcc/config/i386/i386-expand.cc: In function 'void
ix86_expand_fp_absneg_operator(rtx_code, machine_mode, rtx_def**)':
./insn-modes.h:315:75: error: temporary of non-literal type
'scalar_float_mode' in a constant expression
 #define HFmode (scalar_float_mode ((scalar_float_mode::from_int) E_HFmode))
                                                                           ^
gcc/gcc/config/i386/i386-expand.cc:2179:8: note: in expansion of macro
'HFmode'
   case HFmode:
        ^


The solution is to use the E_?Fmode enumeration constants as case values
in switch statements.

This patch has been tested on x86_64-pc-linux-gnu with make bootstrap
and make -k check, both with and without --target_board=unix{-m32}
with no new failures (from this change).  Ok for mainline?


2024-07-14  Roger Sayle  <roger@nextmovesoftware.com>

        * config/i386/i386-expand.cc (ix86_expand_fp_absneg_operator):
        Use E_?Fmode enumeration constants in switch statement.
        (ix86_expand_copysign): Likewise.
        (ix86_expand_xorsign): Likewise.


Thanks in advance,
Roger
--

Comments

Uros Bizjak July 14, 2024, 4:11 p.m. UTC | #1
On Sun, Jul 14, 2024 at 3:42 PM Roger Sayle <roger@nextmovesoftware.com> wrote:
>
>
> This is a minor change to restore bootstrap on systems using gcc 4.8
> as a host compiler.  The fatal error is:
>
> In file included from gcc/gcc/coretypes.h:471:0,
>                  from gcc/gcc/config/i386/i386-expand.cc:23:
> gcc/gcc/config/i386/i386-expand.cc: In function 'void
> ix86_expand_fp_absneg_operator(rtx_code, machine_mode, rtx_def**)':
> ./insn-modes.h:315:75: error: temporary of non-literal type
> 'scalar_float_mode' in a constant expression
>  #define HFmode (scalar_float_mode ((scalar_float_mode::from_int) E_HFmode))
>                                                                            ^
> gcc/gcc/config/i386/i386-expand.cc:2179:8: note: in expansion of macro
> 'HFmode'
>    case HFmode:
>         ^
>
>
> The solution is to use the E_?Fmode enumeration constants as case values
> in switch statements.
>
> This patch has been tested on x86_64-pc-linux-gnu with make bootstrap
> and make -k check, both with and without --target_board=unix{-m32}
> with no new failures (from this change).  Ok for mainline?
>
>
> 2024-07-14  Roger Sayle  <roger@nextmovesoftware.com>
>
>         * config/i386/i386-expand.cc (ix86_expand_fp_absneg_operator):
>         Use E_?Fmode enumeration constants in switch statement.
>         (ix86_expand_copysign): Likewise.
>         (ix86_expand_xorsign): Likewise.

OK, also for backports.

Thanks,
Uros.

>
>
> Thanks in advance,
> Roger
> --
>
diff mbox series

Patch

diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc
index cfcfdd9..9a31e6d 100644
--- a/gcc/config/i386/i386-expand.cc
+++ b/gcc/config/i386/i386-expand.cc
@@ -2176,19 +2176,19 @@  ix86_expand_fp_absneg_operator (enum rtx_code code, machine_mode mode,
 
   switch (mode)
   {
-  case HFmode:
+  case E_HFmode:
     use_sse = true;
     vmode = V8HFmode;
     break;
-  case BFmode:
+  case E_BFmode:
     use_sse = true;
     vmode = V8BFmode;
     break;
-  case SFmode:
+  case E_SFmode:
     use_sse = TARGET_SSE_MATH && TARGET_SSE;
     vmode = V4SFmode;
     break;
-  case DFmode:
+  case E_DFmode:
     use_sse = TARGET_SSE_MATH && TARGET_SSE2;
     vmode = V2DFmode;
     break;
@@ -2330,19 +2330,19 @@  ix86_expand_copysign (rtx operands[])
 
   switch (mode)
   {
-  case HFmode:
+  case E_HFmode:
     vmode = V8HFmode;
     break;
-  case BFmode:
+  case E_BFmode:
     vmode = V8BFmode;
     break;
-  case SFmode:
+  case E_SFmode:
     vmode = V4SFmode;
     break;
-  case DFmode:
+  case E_DFmode:
     vmode = V2DFmode;
     break;
-  case TFmode:
+  case E_TFmode:
     vmode = mode;
     break;
   default:
@@ -2410,16 +2410,16 @@  ix86_expand_xorsign (rtx operands[])
 
   switch (mode)
   {
-  case HFmode:
+  case E_HFmode:
     vmode = V8HFmode;
     break;
-  case BFmode:
+  case E_BFmode:
     vmode = V8BFmode;
     break;
-  case SFmode:
+  case E_SFmode:
     vmode = V4SFmode;
     break;
-  case DFmode:
+  case E_DFmode:
     vmode = V2DFmode;
     break;
   default: