diff --git a/src/coreclr/jit/morph.cpp b/src/coreclr/jit/morph.cpp index 34205fdd203ed..4c18c7f918822 100644 --- a/src/coreclr/jit/morph.cpp +++ b/src/coreclr/jit/morph.cpp @@ -10939,7 +10939,8 @@ GenTree* Compiler::fgMorphCastedBitwiseOp(GenTreeOp* tree) var_types toType = op1->AsCast()->CastToType(); bool isUnsigned = op1->IsUnsigned(); - if ((op2->CastFromType() != fromType) || (op2->CastToType() != toType) || (op2->IsUnsigned() != isUnsigned)) + if (varTypeIsFloating(fromType) || (op2->CastFromType() != fromType) || (op2->CastToType() != toType) || + (op2->IsUnsigned() != isUnsigned)) { return nullptr; } diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_61629/Runtime_61629.cs b/src/tests/JIT/Regression/JitBlue/Runtime_61629/Runtime_61629.cs new file mode 100644 index 0000000000000..a14b10b0657cd --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_61629/Runtime_61629.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Runtime.CompilerServices; + +public class Runtime_61629 +{ + public static int Main() => + Test(100, 200.0) + Test(Math.PI, Math.PI) - 72; + + [MethodImpl(MethodImplOptions.NoInlining)] + static int Test(double a, double b) + { + return (int)a ^ (int)b >> 32; + } +} diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_61629/Runtime_61629.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_61629/Runtime_61629.csproj new file mode 100644 index 0000000000000..f492aeac9d056 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_61629/Runtime_61629.csproj @@ -0,0 +1,9 @@ + + + Exe + True + + + + + \ No newline at end of file