You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
JIT: Incorrect optimization of x & -x on x86 #66709
The following program gives an invalid result when optimizing on x86.
Reproduction Steps
// Generated by Fuzzlyn v1.5 on 2022-03-16 11:07:55// Run on X86 Windows// Seed: 13083630089409025722// Reduced from 309.3 KiB to 0.2 KiB in 00:06:28// Debug: Outputs 1// Release: Outputs 4294967297publicclassProgram{publicstaticlongs_61=-1;publicstaticvoidMain(){s_61&=-s_61;System.Console.WriteLine(s_61);}}
Expected behavior
Same result with and without optimizations.
Actual behavior
Different result.
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
Probably some interaction between long decomposition and the new optimization added in #66193? cc @Wraith2 @dotnet/jit-contrib
Activity
ghost added
area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Note that your compile options are invalid. Godbolt only supports below compiler options/switches for dotnet languages:
--targetos: operating system, available options are windows, linux and osx. Default value is based on current platform, on complier explorer it's linux.
--targetarch: architecture, available options are arm, armel, arm64, x86 and x64. Default value is x64.
--instruction-set: instruction set for compilation. Default value is sse2.
The allowable values for the --instruction-set option are described in the table below. Each architecture has a different set of valid instruction sets, and multiple instruction sets may be specified by separating the instructions sets by a ,. For example avx2,bmi,lzcnt
Activity
deeprobin commentedon Mar 16, 2022
https://godbolt.org/z/bfEx84ovj
Godbolt does not show me any blsi optimization at all.
jakobbotsch commentedon Mar 16, 2022
It's a new optimization added in #66193. It's not part of .NET 6.
deeprobin commentedon Mar 16, 2022
As far as I know Godbolt always uses the daily builds, even if it says .NET 6.
Referring to C# Community Discord discussion with @EgorBo

EgorBo commentedon Mar 16, 2022
@deeprobin I think it actually doesn't use daily builds, it uses some fixed version of .NET 7.0 daily build, probably a few month old
hez2010 commentedon Mar 16, 2022
No. Godbolt is currently using tag v6.0.1 as runtime, so it's .NET 6.
You can confirm the version here: https://github.com/compiler-explorer/infra/blob/main/bin/yaml/dotnet.yaml#L11
hez2010 commentedon Mar 16, 2022
Note that your compile options are invalid. Godbolt only supports below compiler options/switches for dotnet languages:
--targetos: operating system, available options arewindows,linuxandosx. Default value is based on current platform, on complier explorer it'slinux.--targetarch: architecture, available options arearm,armel,arm64,x86andx64. Default value isx64.--instruction-set: instruction set for compilation. Default value issse2.,. For exampleavx2,bmi,lzcnt--singlemethodtypename: Type name for single method compilation--singlemethodname: Name for single method compilation--singlemethodindex: Index for single method compilation--singlemethodgenericarg: Generic arguments for single method compilation--codegenopt,--codegen-options: Code generation options passed to JIT-O,--optimize: Enable optimizations (default)--Od,--optimize-disabled: Disable optimizations--Os,--optimize-size: Optimize code for size--Ot,--optimize-time: Optimize code for speedWraith2 commentedon Mar 16, 2022
I'll take a look.
Wraith2 commentedon Mar 16, 2022
By x86 do you mean then 32 bit build specifically? Because I can't get that to build locally. Or are we just talking x86 as in not arm.
jakobbotsch commentedon Mar 16, 2022
I mean the 32-bit build specifically.
jakobbotsch commentedon Mar 16, 2022
What errors are you getting? The standard build commands (passing
-arch x86) work fine for me (includingbuild.cmd -vs coreclr.sln -arch x86).