llvm-project/llvm/test/CodeGen/Mips/2008-07-07-Float2Int.ll

34 lines
963 B
LLVM
Raw Normal View History

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s -mtriple=mips-- | FileCheck %s
define i32 @fptoint(float %a) nounwind {
; CHECK-LABEL: fptoint:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: trunc.w.s $f0, $f12
; CHECK-NEXT: jr $ra
; CHECK-NEXT: mfc1 $2, $f0
entry:
fptosi float %a to i32 ; <i32>:0 [#uses=1]
ret i32 %0
}
define i32 @fptouint(float %a) nounwind {
; CHECK-LABEL: fptouint:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: lui $1, %hi($CPI1_0)
; CHECK-NEXT: lwc1 $f0, %lo($CPI1_0)($1)
; CHECK-NEXT: sub.s $f1, $f12, $f0
; CHECK-NEXT: trunc.w.s $f1, $f1
; CHECK-NEXT: mfc1 $1, $f1
; CHECK-NEXT: lui $2, 32768
; CHECK-NEXT: xor $2, $1, $2
; CHECK-NEXT: trunc.w.s $f1, $f12
; CHECK-NEXT: mfc1 $1, $f1
; CHECK-NEXT: c.olt.s $f12, $f0
; CHECK-NEXT: jr $ra
; CHECK-NEXT: movt $2, $1, $fcc0
entry:
fptoui float %a to i32 ; <i32>:0 [#uses=1]
ret i32 %0
}