Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

kunalspathak
Copy link
Contributor

@kunalspathak kunalspathak commented Feb 7, 2025

This probably got exposed with #111451 because that makes more usages of SP than FP. While loading or storing from stack with an offset, we already encode SP -> ZR, but if we have to produce the offset using reserved register, we perform add or sub to populate it. The caller already encodes REG_SP as REG_ZR, but in add/sub, we were expecting the reg2 to be SP or GPR, but later we will encode it to ZR anyway. So, I have just moved the assert to take into account of that.

Fixes: #112278

@ghost ghost added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Feb 7, 2025
@kunalspathak
Copy link
Contributor Author

@dotnet/jit-contrib @amanasifkhalid

Copy link
Contributor

@amanasifkhalid amanasifkhalid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

return;
}

// reg2 can be alread encoded to zero
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// reg2 can be alread encoded to zero
// reg2 can be already encoded to zero

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok to fix in next batch? don't want to run CI again.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure

@jakobbotsch
Copy link
Member

but if we have to produce the offset using reserved register, we perform add or sub to populate it

Shouldn't the code that produces the add/sub be doing encodingZRtoSP instead when encoding it? I think it would be better to keep the requirement that reg2 is never ZR, since it's not a supported possible instruction.

@kunalspathak
Copy link
Contributor Author

but if we have to produce the offset using reserved register, we perform add or sub to populate it

Shouldn't the code that produces the add/sub be doing encodingZRtoSP instead when encoding it? I think it would be better to keep the requirement that reg2 is never ZR, since it's not a supported possible instruction.

Yeah, the emitIns_R_R_I() is a very common method and was not sure if that's the right thing to do. But this is happening in scenario where we populate base address for predicate register, so let me point fix those 2 places only.

Copy link
Contributor

@amanasifkhalid amanasifkhalid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed that fixing the caller seems better

@kunalspathak kunalspathak merged commit 497236a into dotnet:main Feb 8, 2025
112 checks passed
@kunalspathak kunalspathak deleted the sve-bugs branch February 8, 2025 16:56
grendello added a commit to grendello/runtime that referenced this pull request Feb 10, 2025
* main: (41 commits)
  Automated bump of chrome version (dotnet#112309)
  Add `GetDeclaringType` to `PropertyDefinition` and `EventDefinition`. (dotnet#111646)
  Update the System.ComponentModel.Annotations solution to build in VS (dotnet#112313)
  JIT: initial support for stack allocating arrays of GC type (dotnet#112250)
  [main] Update dependencies from dotnet/roslyn (dotnet#112260)
  Update Xcode casing (dotnet#112307)
  update the location of assert for REG_ZR check (dotnet#112294)
  Enable `SA1206`: Keyword ordering (dotnet#112303)
  Address feedback on dense FrozenDictionary optimization (dotnet#112298)
  Start regular pri-1 tests runs with native AOT (dotnet#111391)
  Observe exceptions from _connectionCloseTcs (dotnet#112190)
  Test failure - SendAsync_RequestVersion20_ResponseVersion20 (dotnet#112232)
  Fix init race in mono_class_try_get_[shortname]_class. (dotnet#112282)
  Remove repeated call to DllMain (dotnet#112285)
  Replace bitvector.h/cpp with ptrArgTP type in gc_unwind_x86.h/inl (dotnet#112268)
  JIT: Limit 3-opt to 1000 swaps per run (dotnet#112259)
  [main] Update dependencies from dotnet/icu, dotnet/runtime-assets (dotnet#112120)
  Update dependencies from https://github.com/dotnet/emsdk build 20250205.3 (dotnet#112223)
  Fix EventPipe on Android CoreClr. (dotnet#112270)
  Fix exception handling in the prestub worker (dotnet#111937)
  ...
@github-actions github-actions bot locked and limited conversation to collaborators Mar 11, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JIT: Assertion failed 'isGeneralRegisterOrSP(reg2)' in SVE tests
3 participants