mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-29 10:25:12 +00:00
Pull fptrunc's upwards through selects when one of the select's selectands was a constant. This has a number of benefits, including producing small immediates (easier to materialize, smaller constant pools) as well as being more likely to allow the fptrunc to fuse with a preceding instruction (truncating selects are unusual).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191929 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -31,4 +31,16 @@ define half @test4(float %a) {
|
||||
ret half %c
|
||||
}
|
||||
|
||||
; CHECK: test5
|
||||
define half @test5(float %a, float %b, float %c) {
|
||||
; CHECK: fcmp ogt
|
||||
; CHECK: fptrunc
|
||||
; CHECK: select
|
||||
; CHECK: half 0xH3C00
|
||||
%d = fcmp ogt float %a, %b
|
||||
%e = select i1 %d, float %c, float 1.0
|
||||
%f = fptrunc float %e to half
|
||||
ret half %f
|
||||
}
|
||||
|
||||
declare float @llvm.fabs.f32(float) nounwind readonly
|
||||
|
Reference in New Issue
Block a user