Bug 90497 - [10 Regression] Broken bootstrap on i686-linux
Summary: [10 Regression] Broken bootstrap on i686-linux
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: bootstrap (show other bugs)
Version: 10.0
: P1 normal
Target Milestone: 10.0
Assignee: H.J. Lu
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-05-15 20:44 UTC by Jakub Jelinek
Modified: 2020-04-03 11:18 UTC (History)
1 user (show)

See Also:
Host:
Target: i?86-*-*
Build:
Known to work:
Known to fail:
Last reconfirmed: 2019-05-15 00:00:00


Attachments
A patch (884 bytes, patch)
2019-05-15 21:36 UTC, H.J. Lu
Details | Diff
A new patch (1.26 KB, patch)
2019-05-16 16:18 UTC, H.J. Lu
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jakub Jelinek 2019-05-15 20:44:46 UTC
Assuming since the recent MMX in SSE changes, i686-linux doesn't bootstrap anymore.

../../libcpp/lex.c: In function ‘const uchar* search_line_mmx(const uchar*, const uchar*)’:
../../libcpp/lex.c:336:33: error: ‘__builtin_ia32_pcmpeqb’ needs isa option -msse2 -mmmx
  336 |       t = __builtin_ia32_pcmpeqb(data, repl_nl);
      |           ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
../../libcpp/lex.c:337:33: error: ‘__builtin_ia32_pcmpeqb’ needs isa option -msse2 -mmmx
  337 |       c = __builtin_ia32_pcmpeqb(data, repl_cr);
      |           ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
../../libcpp/lex.c:338:37: error: ‘__builtin_ia32_por’ needs isa option -msse2 -mmmx
  338 |       t = (v8qi) __builtin_ia32_por ((__m64)t, (__m64)c);
      |                  ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
../../libcpp/lex.c:339:33: error: ‘__builtin_ia32_pcmpeqb’ needs isa option -msse2 -mmmx
  339 |       c = __builtin_ia32_pcmpeqb(data, repl_bs);
      |           ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
../../libcpp/lex.c:340:37: error: ‘__builtin_ia32_por’ needs isa option -msse2 -mmmx
  340 |       t = (v8qi) __builtin_ia32_por ((__m64)t, (__m64)c);
      |                  ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
../../libcpp/lex.c:341:33: error: ‘__builtin_ia32_pcmpeqb’ needs isa option -msse2 -mmmx
  341 |       c = __builtin_ia32_pcmpeqb(data, repl_qm);
      |           ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
../../libcpp/lex.c:342:37: error: ‘__builtin_ia32_por’ needs isa option -msse2 -mmmx
  342 |       t = (v8qi) __builtin_ia32_por ((__m64)t, (__m64)c);
      |                  ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
../../libcpp/lex.c:336:33: error: ‘__builtin_ia32_pcmpeqb’ needs isa option -msse2 -mmmx
  336 |       t = __builtin_ia32_pcmpeqb(data, repl_nl);
      |           ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
../../libcpp/lex.c:337:33: error: ‘__builtin_ia32_pcmpeqb’ needs isa option -msse2 -mmmx
  337 |       c = __builtin_ia32_pcmpeqb(data, repl_cr);
      |           ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
../../libcpp/lex.c:338:37: error: ‘__builtin_ia32_por’ needs isa option -msse2 -mmmx
  338 |       t = (v8qi) __builtin_ia32_por ((__m64)t, (__m64)c);
      |                  ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
...

This is i386 ../configure --enable-languages=default,obj-c++,lto,go,brig,d --enable-checking=yes,rtl,extra bootstrap, so no sse/sse2 is enabled by default.
Comment 1 Jakub Jelinek 2019-05-15 20:47:36 UTC
BTW, I'd fear that with system GCC 10, one won't be able to build any earlier GCCs unless patching libcpp/lex.c :(.
Comment 2 H.J. Lu 2019-05-15 21:36:56 UTC
Created attachment 46362 [details]
A patch

Please try this.
Comment 3 Jakub Jelinek 2019-05-15 22:47:45 UTC
With that patch what previously failed bootstrap passes it now.
Compared to a build from 24 hours ago and ignoring FAILs introduces during that time also on x86_64-linux, I see:
+FAIL: gcc.target/i386/3dnow-1.c (internal compiler error)
+FAIL: gcc.target/i386/3dnow-1.c (test for excess errors)
+FAIL: gcc.target/i386/3dnow-2.c (internal compiler error)
+FAIL: gcc.target/i386/3dnow-2.c (test for excess errors)
that is most likely related either to this patch or more likely to the MMX in SSE changes.
Comment 4 Jakub Jelinek 2019-05-15 22:49:21 UTC
spawn -ignore SIGHUP /home/jakub/src/gcc/obj45/gcc/xgcc -B/home/jakub/src/gcc/obj45/gcc/ -fno-diagnostics-show-caret -fno-diagnostics-show-line-numbers -fdiagnostics-color=never -O2 -Werror-implicit-function-declaration -m3dnow -c -o 3dnow-1.o /home/jakub/src/gcc/gcc/testsuite/gcc.target/i386/3dnow-1.c
In file included from /home/jakub/src/gcc/gcc/testsuite/gcc.target/i386/3dnow-1.c:14:
/home/jakub/src/gcc/obj45/gcc/include/mm3dnow.h: In function '_m_pavgusb':
/home/jakub/src/gcc/obj45/gcc/include/mm3dnow.h:53:1: error: unrecognizable insn:
(insn 7 4 8 2 (set (reg:V8QI 88)
        (truncate:V8QI (lshiftrt:V8HI (plus:V8HI (plus:V8HI (zero_extend:V8HI (subreg:V8QI (reg/v:V2SI 86 [ __A ]) 0))
                        (zero_extend:V8HI (subreg:V8QI (reg/v:V2SI 87 [ __B ]) 0)))
                    (const_vector:V8HI [
                            (const_int 1 [0x1]) repeated x8
                        ]))
                (const_int 1 [0x1])))) "/home/jakub/src/gcc/obj45/gcc/include/mm3dnow.h":52:17 -1
     (nil))
during RTL pass: vregs
/home/jakub/src/gcc/obj45/gcc/include/mm3dnow.h:53:1: internal compiler error: in extract_insn, at recog.c:2310
0x82dac28 _fatal_insn(char const*, rtx_def const*, char const*, int, char const*)
        ../../gcc/rtl-error.c:108
0x82daca5 _fatal_insn_not_found(rtx_def const*, char const*, int, char const*)
        ../../gcc/rtl-error.c:116
0x82cb6d5 extract_insn(rtx_insn*)
        ../../gcc/recog.c:2310
0x8848ebd instantiate_virtual_regs_in_insn
        ../../gcc/function.c:1605
0x8848ebd instantiate_virtual_regs
        ../../gcc/function.c:1975
0x8848ebd execute
        ../../gcc/function.c:2024
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
compiler exited with status 1
FAIL: gcc.target/i386/3dnow-1.c (internal compiler error)
FAIL: gcc.target/i386/3dnow-1.c (test for excess errors)
Comment 5 H.J. Lu 2019-05-16 16:18:49 UTC
Created attachment 46366 [details]
A new patch

Please try this.
Comment 6 Jakub Jelinek 2019-05-16 21:42:02 UTC
Looks good on i686-linux, results in
FAIL: gcc.target/i386/pr90497-2.c (test for excess errors)
Excess errors:
/home/jakub/src/gcc/gcc/testsuite/gcc.target/i386/pr90497-2.c:11:10: warning: implicit declaration of function '__builtin_ia32_pavgusb'; did you mean '__builtin_ia32_paddusb'? [-Wimplicit-function-declaration]
/home/jakub/src/gcc/gcc/testsuite/gcc.target/i386/pr90497-2.c:11:10: error: incompatible types when returning type 'int' but '__v8qi' {aka '__vector(8) char'} was expected
on x86_64-linux, so that test needs some work.
Comment 7 hjl@gcc.gnu.org 2019-05-17 14:49:08 UTC
Author: hjl
Date: Fri May 17 14:48:37 2019
New Revision: 271328

URL: https://gcc.gnu.org/viewcvs?rev=271328&root=gcc&view=rev
Log:
i386: Enable MMX intrinsics without SSE/SSE2/SSSE3

Since MMX intrinsics are marked with SSE/SSE2/SSSE3 for SSE emulation,
enable them without SSE/SSE2/SSSE3 if MMX is enabled.

Restore TARGET_3DNOW check, which was changed to TARGET_3DNOW_A by
revision 271235.

gcc/

	PR target/90497
	* config/i386/i386-expand.c (ix86_expand_builtin): Enable MMX
	intrinsics without SSE/SSE2/SSSE3.
	* config/i386/mmx.md (mmx_uavgv8qi3): Restore TARGET_3DNOW
	check.
	(*mmx_uavgv8qi3): Likewise.

gcc/testsuite/

	PR target/90497
	* gcc.target/i386/pr90497-1.c: New test.
	* gcc.target/i386/pr90497-2.c: Likewise.

Added:
    trunk/gcc/testsuite/gcc.target/i386/pr90497-1.c
    trunk/gcc/testsuite/gcc.target/i386/pr90497-2.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/i386/i386-expand.c
    trunk/gcc/config/i386/mmx.md
    trunk/gcc/testsuite/ChangeLog
Comment 8 Jakub Jelinek 2019-05-17 15:07:58 UTC
Fixed.
Comment 9 H.J. Lu 2020-04-03 11:01:16 UTC
Why do we have

define_expand "sse2_umulv1siv1di3"
  [(set (match_operand:V1DI 0 "register_operand")
        (mult:V1DI
          (zero_extend:V1DI
            (vec_select:V1SI
              (match_operand:V2SI 1 "nonimmediate_operand")
              (parallel [(const_int 0)])))
          (zero_extend:V1DI
            (vec_select:V1SI
              (match_operand:V2SI 2 "nonimmediate_operand")
              (parallel [(const_int 0)])))))]
  "TARGET_SSE2"
  "ix86_fixup_binary_operands_no_copy (MULT, V2SImode, operands);")

i386-builtin.def:BDESC (OPTION_MASK_ISA_SSE2 | OPTION_MASK_ISA_MMX, 0, CODE_FOR_sse2_umulv1siv1di3, "__builtin_ia32_pmuludq", IX86_BUILTIN_PMULUDQ, UNKNOWN, (int) V1DI_FTYPE_V2SI_V2SI)

sse2_umulv1siv1di3 isn't available with MMX.
Comment 10 Jakub Jelinek 2020-04-03 11:14:54 UTC
That changed in PR79565 / PR82483, but I'm afraid I don't remember that change much.  Guess it has something to do with the patterns using V2SImode which wasn't enabled when MMX was disabled.