mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-10 02:25:47 +00:00
Originally the cost model would give up for large constants and just return the maximum cost. This is not what we want for constant hoisting, because some of these constants are large in bitwidth, but are still cheap to materialize. This commit fixes the cost model to either return TCC_Free if the cost cannot be determined, or accurately calculate the cost even for large constants (bitwidth > 128). This fixes <rdar://problem/16591573>. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206100 91177308-0d34-0410-b5e6-96231b3b80d8
19 lines
533 B
LLVM
19 lines
533 B
LLVM
; 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
|
|
}
|
|
|
|
; Check that we don't hoist large, but cheap constants
|
|
define i512 @test2(i512 %a) nounwind {
|
|
; CHECK-LABEL: test2
|
|
; CHECK-NOT: %const = bitcast i512 7 to i512
|
|
%1 = and i512 %a, 7
|
|
%2 = or i512 %1, 7
|
|
ret i512 %2
|
|
}
|