Bug 84902 - [8 Regression] 549.fotonik3d_r from SPEC2017 fails verification with -Ofast -march=native on Zen since r258518
Summary: [8 Regression] 549.fotonik3d_r from SPEC2017 fails verification with -Ofast -...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: unknown
: P1 normal
Target Milestone: 8.0
Assignee: Jakub Jelinek
URL:
Keywords:
Depends on:
Blocks: spec
  Show dependency treegraph
 
Reported: 2018-03-16 13:51 UTC by Martin Liška
Modified: 2018-03-18 19:56 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work: 7.3.0
Known to fail: 8.0
Last reconfirmed: 2018-03-16 00:00:00


Attachments
gcc8-pr84902.patch (1.16 KB, patch)
2018-03-16 17:40 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Liška 2018-03-16 13:51:28 UTC
I see following miscomparison:

running commands in inputgen.cmd 1 times
runs started at		1521207795, 636877000, Fri Mar 16 14:43:15 2018
run 1 started at	1521207795, 636898000, Fri Mar 16 14:43:15 2018
child started: 0,	1521207795, 636903000, pid=30449, '/home/marxin/Programming/spec2017/bin/specxz -dc OBJ.dat.xz > OBJ.dat 2>> OBJ.dat.gen.err'
child finished: 0,	1521207795, 734527000, sec=0, nsec=97624000, pid=30449, rc=0
run 1 finished at:	1521207795, 734539000, Fri Mar 16 14:43:15 2018
run 1 elapsed time:	         0, 097641000, 0.097641000
runs finished at	1521207795, 734561000, Fri Mar 16 14:43:15 2018
runs elapsed time:	         0, 097684000, 0.097684000
specinvoke exit: rc=0

****************************************
****************************************
Contents of pscyee.out
****************************************
 POWER = 
  2.13245044634327E-42  2.18335817864374E-42  2.23536714661881E-42
 2.28848954325784E-42  2.34273492068948E-42  2.39811037362244E-42
 2.45462082938153E-42  2.51226943651830E-42  2.57105803986167E-42
 2.63098772608779E-42  2.69205942058956E-42  2.75427451375589E-42
 2.81763549285857E-42  2.88214655468550E-42  2.94781417392922E-42
 3.01464760317226E-42  3.08265928211053E-42  3.15186513638627E-42
 3.22228474999077E-42  3.29394139953691E-42  3.36686194365177E-42
 3.44107656613199E-42  3.51661837714837E-42  3.59352288247325E-42
 3.67182733621929E-42  3.75156999770401E-42  3.83278931758194E-42
 3.91552308212080E-42  3.99980754727110E-42  4.08567659584874E-42
 4.17316095161727E-42  4.26228748325843E-42  4.35307862914409E-42
 4.44555197050035E-42  4.53971997607133E-42  4.63558993586830E-42
 4.73316409520551E-42  4.83243999318331E-42  4.93341100232309E-42
 5.03606705845099E-42  5.14039556244574E-42  5.24638242839164E-42
 5.35401324628705E-42  5.46327452200919E-42  5.57415495295979E-42
 5.68664669491003E-42  5.80074657417463E-42  5.91645719947773E-42
 6.03378792976593E-42  6.15275565776239E-42  6.27338537416162E-42
 6.39571048389881E-42  6.51977285369908E-42  6.64562257887563E-42
 6.77331746681349E-42  6.90292224442983E-42  7.03450750679656E-42
...
Comment 1 Julia Koval 2018-03-16 14:15:34 UTC
I suspect the problem is in >gcc/config/i386/driver-i386.c:
>if (has_wbnoinvd)
>cpu = "icelake-server";

I would change to has_wbnoinvd && has_gfni to try. Sorry, I don't have a Ryzen right now to try, I will check and send fix ASAP.
Comment 2 Martin Liška 2018-03-16 14:32:25 UTC
Assembly diff in between the revisions is:

--- /tmp/good.txt	2018-03-16 15:31:17.391278644 +0100
+++ /tmp/bad.txt	2018-03-16 15:23:44.678197462 +0100
@@ -279,20 +279,10 @@
   4015ae:	66 90                	xchg   %ax,%ax
 
 00000000004015b0 <set_fast_math>:
-    return;
-
-  if (edx & bit_SSE)
-    set_fast_math_sse (edx);
-#else
-  unsigned int mxcsr = __builtin_ia32_stmxcsr ();
   4015b0:	0f ae 5c 24 fc       	stmxcsr -0x4(%rsp)
-  mxcsr |= MXCSR_DAZ | MXCSR_FTZ;
-  __builtin_ia32_ldmxcsr (mxcsr);
   4015b5:	81 4c 24 fc 40 80 00 	orl    $0x8040,-0x4(%rsp)
   4015bc:	00 
   4015bd:	0f ae 54 24 fc       	ldmxcsr -0x4(%rsp)
-#endif
-}
   4015c2:	c3                   	retq   
   4015c3:	66 2e 0f 1f 84 00 00 	nopw   %cs:0x0(%rax,%rax,1)
   4015ca:	00 00 00
Comment 3 Jakub Jelinek 2018-03-16 17:40:30 UTC
Created attachment 43684 [details]
gcc8-pr84902.patch

Just a wild guess, does this fix it?
Comment 4 Jakub Jelinek 2018-03-17 11:12:32 UTC
Author: jakub
Date: Sat Mar 17 11:12:00 2018
New Revision: 258618

URL: https://gcc.gnu.org/viewcvs?rev=258618&root=gcc&view=rev
Log:
	PR target/84902
	* config/i386/i386.c (initial_ix86_tune_features,
	initial_ix86_arch_features): Use unsigned HOST_WIDE_INT rather than
	unsigned long long.
	(set_ix86_tune_features): Change ix86_tune_mask from unsigned int
	to unsigned HOST_WIDE_INT, initialize to HOST_WIDE_INT_1U << ix86_tune
	rather than 1u << ix86_tune.  Formatting fix.
	(ix86_option_override_internal): Change ix86_arch_mask from
	unsigned int to unsigned HOST_WIDE_INT, initialize to
	HOST_WIDE_INT_1U << ix86_arch rather than 1u << ix86_arch.
	(ix86_function_specific_restore): Likewise.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/i386/i386.c
Comment 5 Martin Liška 2018-03-18 19:56:04 UTC
Thank you both, works for me. Thus closing.