mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-18 10:24:45 +00:00
Thanks to sabre for pointing out that we were incorrectly codegen'ing
int test(int x) { return 32768 - x; } Fixed by teaching the function that checks a constant's validity to be used as an immediate argument about subtract-from instructions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17476 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -537,7 +537,10 @@ bool PPC32ISel::canUseAsImmediateForOpcode(ConstantInt *CI, unsigned Opcode,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ADDI, Compare, and non-indexed Load take SIMM
|
// Treat subfic like addi for the purposes of constant validation
|
||||||
|
if (Opcode == 5) Opcode = 0;
|
||||||
|
|
||||||
|
// addi, subfic, compare, and non-indexed load take SIMM
|
||||||
bool cond1 = (Opcode < 2)
|
bool cond1 = (Opcode < 2)
|
||||||
&& ((int32_t)CI->getRawValue() <= 32767)
|
&& ((int32_t)CI->getRawValue() <= 32767)
|
||||||
&& ((int32_t)CI->getRawValue() >= -32768);
|
&& ((int32_t)CI->getRawValue() >= -32768);
|
||||||
|
Reference in New Issue
Block a user