public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/39787]  New: ICE with #pragma GCC target
@ 2009-04-16 19:26 jakub at gcc dot gnu dot org
  2009-04-21 17:22 ` [Bug target/39787] " pinskia at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-04-16 19:26 UTC (permalink / raw)
  To: gcc-bugs

#include <immintrin.h>

#pragma GCC target ("no-avx")

__m256d a, b, c;
__m128d d, e, f;

void __attribute__ ((__target__ ("avx"), __noinline__))
avx_routine (void)
{
  a = _mm256_andnot_pd (b, c);
}

void __attribute__ ((__target__ ("sse3"), __noinline__))
sse3_routine (void)
{
  d = _mm_andnot_pd (d, e);
}

ICEs when compiled with -O2 -mavx:
include/avxintrin.h: In function 'avx_routine':
include/avxintrin.h:155: error: '__builtin_ia32_andnpd256' needs unknown isa
option
include/avxintrin.h:155: internal compiler error: in emit_move_insn, at
expr.c:3405
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

One issue is the unknown ISA option which can be cured by:
--- i386.c.jj22009-04-14 16:33:49.000000000 +0200
+++ i386.c2009-04-16 20:47:05.000000000 +0200
@@ -2350,6 +2350,7 @@ ix86_target_string (int isa, int flags, 
   static struct ix86_target_opts isa_opts[] =
   {
     { "-m64",OPTION_MASK_ISA_64BIT },
+    { "-mavx",OPTION_MASK_ISA_AVX },
     { "-msse5",OPTION_MASK_ISA_SSE5 },
     { "-msse4a",OPTION_MASK_ISA_SSE4A },
     { "-msse4.2",OPTION_MASK_ISA_SSE4_2 },
@@ -2365,6 +2366,7 @@ ix86_target_string (int isa, int flags, 
     { "-mpopcnt",OPTION_MASK_ISA_POPCNT },
     { "-maes",OPTION_MASK_ISA_AES },
     { "-mpclmul",OPTION_MASK_ISA_PCLMUL },
+    { "-mfma",OPTION_MASK_ISA_FMA }
   };

   /* Flag options.  */


But the worse problem is that ix86_valid_target_attribute_tree when the new
ix86_isa_flags is the same as def->ix86_isa_flags will just return NULL, which
means ix86_isa_flags won't be restored to the state with -mavx enabled when
switching to the avx_routine function.
I get a different ICE with:
-void __attribute__ ((__target__ ("avx"), __noinline__))
+void __attribute__ ((__target__ ("tune=core2", "avx"), __noinline__))
change on the testcase, this time without any reported error.


-- 
           Summary: ICE with #pragma GCC target
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jakub at gcc dot gnu dot org
GCC target triplet: x86_64-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39787


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-03-26  8:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-39787-4@http.gcc.gnu.org/bugzilla/>
2021-08-09  6:08 ` [Bug target/39787] ICE with #pragma GCC target pinskia at gcc dot gnu.org
2021-11-29  6:47 ` pinskia at gcc dot gnu.org
2024-03-26  8:06 ` pinskia at gcc dot gnu.org
2009-04-16 19:26 [Bug target/39787] New: " jakub at gcc dot gnu dot org
2009-04-21 17:22 ` [Bug target/39787] " pinskia at gcc dot gnu dot org
2009-04-21 17:43 ` pinskia at gcc dot gnu dot org
2009-08-31 20:02 ` dbaron at dbaron dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).