mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
[ARM64] Fix immediate cost calculation for types larger than i64.
The immediate cost calculation code was hitting an assertion in the included test case, because APInt was still internally 128-bits. Truncating it to 64-bits fixed the issue. Fixes <rdar://problem/16572521>. llvm-svn: 205947
This commit is contained in:
parent
52c8f727f3
commit
c19a8638e5
@ -166,7 +166,7 @@ unsigned ARM64TTI::getIntImmCost(const APInt &Imm, Type *Ty) const {
|
||||
// chunk.
|
||||
unsigned Cost = 0;
|
||||
for (unsigned ShiftVal = 0; ShiftVal < BitSize; ShiftVal += 64) {
|
||||
APInt Tmp = ImmVal.ashr(ShiftVal).getLoBits(64);
|
||||
APInt Tmp = ImmVal.ashr(ShiftVal).sextOrTrunc(64);
|
||||
int64_t Val = Tmp.getSExtValue();
|
||||
Cost += getIntImmCost(Val);
|
||||
}
|
||||
|
10
test/Transforms/ConstantHoisting/ARM64/large-immediate.ll
Normal file
10
test/Transforms/ConstantHoisting/ARM64/large-immediate.ll
Normal file
@ -0,0 +1,10 @@
|
||||
; RUN: opt -mtriple=arm64-darwin-unknown -S -consthoist < %s | FileCheck %s
|
||||
|
||||
define i128 @test1(i128 %a) nounwind {
|
||||
; CHECK-LABEL: test1
|
||||
; CHECK: %const = bitcast i128 12297829382473034410122878 to i128
|
||||
%1 = add i128 %a, 12297829382473034410122878
|
||||
%2 = add i128 %1, 12297829382473034410122878
|
||||
ret i128 %2
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user