diff options
| author | Nate Begeman <natebegeman@mac.com> | 2004-11-04 19:43:18 +0000 |
|---|---|---|
| committer | Nate Begeman <natebegeman@mac.com> | 2004-11-04 19:43:18 +0000 |
| commit | bff3d4abf052fe011cfad72618db6726db133fc6 (patch) | |
| tree | c78f614e7054767ef3976ffd288de9d0dac0859a | |
| parent | adb5342ae85dfaac92384df720945394b6298c0c (diff) | |
| download | bcm5719-llvm-bff3d4abf052fe011cfad72618db6726db133fc6.tar.gz bcm5719-llvm-bff3d4abf052fe011cfad72618db6726db133fc6.zip | |
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.
llvm-svn: 17476
| -rw-r--r-- | llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp b/llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp index d0406c7e402..5314dada04a 100644 --- a/llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp +++ b/llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp @@ -536,8 +536,11 @@ bool PPC32ISel::canUseAsImmediateForOpcode(ConstantInt *CI, unsigned Opcode, else return false; } + + // Treat subfic like addi for the purposes of constant validation + if (Opcode == 5) Opcode = 0; - // ADDI, Compare, and non-indexed Load take SIMM + // addi, subfic, compare, and non-indexed load take SIMM bool cond1 = (Opcode < 2) && ((int32_t)CI->getRawValue() <= 32767) && ((int32_t)CI->getRawValue() >= -32768); |

