diff --git a/src/coreclr/jit/emitxarch.cpp b/src/coreclr/jit/emitxarch.cpp
index 20aa8f4ba4eaa..19a763522e58a 100644
--- a/src/coreclr/jit/emitxarch.cpp
+++ b/src/coreclr/jit/emitxarch.cpp
@@ -11691,8 +11691,6 @@ BYTE* emitter::emitOutputAM(BYTE* dst, instrDesc* id, code_t code, CnsVal* addc)
{
if (id->idIsDspReloc())
{
- INT32 addlDelta = 0;
-
// The address is of the form "[disp]"
// On x86 - disp is relative to zero
// On Amd64 - disp is relative to RIP
@@ -11705,20 +11703,17 @@ BYTE* emitter::emitOutputAM(BYTE* dst, instrDesc* id, code_t code, CnsVal* addc)
dst += emitOutputWord(dst, code | 0x0500);
}
+ INT32 addlDelta = 0;
+#ifdef TARGET_AMD64
if (addc)
{
- // It is of the form "ins [disp], imm" or "ins reg, [disp], imm"
- // For emitting relocation, we also need to take into account of the
- // additional bytes of code emitted for immed val.
-
+ // It is of the form "ins [disp], imm" or "ins reg, [disp], imm". Emitting relocation for a
+ // RIP-relative address means we also need to take into account the additional bytes of code
+ // generated for the immediate value, since RIP will point at the next instruction.
ssize_t cval = addc->cnsVal;
-#ifdef TARGET_AMD64
// all these opcodes only take a sign-extended 4-byte immediate
noway_assert(opsz < 8 || ((int)cval == cval && !addc->cnsReloc));
-#else // TARGET_X86
- noway_assert(opsz <= 4);
-#endif // TARGET_X86
switch (opsz)
{
@@ -11739,6 +11734,7 @@ BYTE* emitter::emitOutputAM(BYTE* dst, instrDesc* id, code_t code, CnsVal* addc)
unreached();
}
}
+#endif // TARGET_AMD64
#ifdef TARGET_AMD64
// We emit zero on Amd64, to avoid the assert in emitOutputLong()
@@ -12990,20 +12986,16 @@ BYTE* emitter::emitOutputCV(BYTE* dst, instrDesc* id, code_t code, CnsVal* addc)
{
INT32 addlDelta = 0;
+#ifdef TARGET_AMD64
if (addc)
{
- // It is of the form "ins [disp], imm" or "ins reg, [disp], imm"
- // For emitting relocation, we also need to take into account of the
- // additional bytes of code emitted for immed val.
-
+ // It is of the form "ins [disp], imm" or "ins reg, [disp], imm". Emitting relocation for a
+ // RIP-relative address means we also need to take into account the additional bytes of code
+ // generated for the immediate value, since RIP will point at the next instruction.
ssize_t cval = addc->cnsVal;
-#ifdef TARGET_AMD64
// all these opcodes only take a sign-extended 4-byte immediate
noway_assert(opsz < 8 || ((int)cval == cval && !addc->cnsReloc));
-#else // TARGET_X86
- noway_assert(opsz <= 4);
-#endif // TARGET_X86
switch (opsz)
{
@@ -13024,6 +13016,7 @@ BYTE* emitter::emitOutputCV(BYTE* dst, instrDesc* id, code_t code, CnsVal* addc)
unreached();
}
}
+#endif // TARGET_AMD64
#ifdef TARGET_AMD64
// All static field and data section constant accesses should be marked as relocatable
diff --git a/src/tests/issues.targets b/src/tests/issues.targets
index 6424d170a89d6..7c88bc19a1dfb 100644
--- a/src/tests/issues.targets
+++ b/src/tests/issues.targets
@@ -277,9 +277,6 @@
https://github.com/dotnet/runtime/issues/57458
-
- https://github.com/dotnet/runtime/issues/79170
-