mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-30 16:34:03 +00:00
e9d4eba451
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172117 91177308-0d34-0410-b5e6-96231b3b80d8
35 lines
742 B
LLVM
35 lines
742 B
LLVM
; Test some floating point casting cases
|
|
; RUN: opt < %s -instcombine -S | FileCheck %s
|
|
|
|
define i8 @test1() {
|
|
%x = fptoui float 2.550000e+02 to i8 ; <i8> [#uses=1]
|
|
ret i8 %x
|
|
; CHECK: ret i8 -1
|
|
}
|
|
|
|
define i8 @test2() {
|
|
%x = fptosi float -1.000000e+00 to i8 ; <i8> [#uses=1]
|
|
ret i8 %x
|
|
; CHECK: ret i8 -1
|
|
}
|
|
|
|
; CHECK: test3
|
|
define half @test3(float %a) {
|
|
; CHECK: fptrunc
|
|
; CHECK: llvm.fabs.f16
|
|
%b = call float @llvm.fabs.f32(float %a)
|
|
%c = fptrunc float %b to half
|
|
ret half %c
|
|
}
|
|
|
|
; CHECK: test4
|
|
define half @test4(float %a) {
|
|
; CHECK: fptrunc
|
|
; CHECK: fsub
|
|
%b = fsub float -0.0, %a
|
|
%c = fptrunc float %b to half
|
|
ret half %c
|
|
}
|
|
|
|
declare float @llvm.fabs.f32(float) nounwind readonly
|