mirror of
https://github.com/RPCS3/llvm.git
synced 2025-05-15 18:06:08 +00:00

This requires a little extra work due tothe fact i32 is not a legal type. When call lowering happens post-legalisation (e.g. when an intrinsic was inserted during legalisation). A bitcast from f32 to i32 can't be introduced. This is similar to the challenges with RV32D. To handle this, we introduce target-specific DAG nodes that perform bitcast+anyext for f32->i64 and trunc+bitcast for i64->f32. Differential Revision: https://reviews.llvm.org/D53235 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352807 91177308-0d34-0410-b5e6-96231b3b80d8
49 lines
1.5 KiB
LLVM
49 lines
1.5 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
|
; RUN: llc -mtriple=riscv32 -mattr=+f -verify-machineinstrs < %s \
|
|
; RUN: | FileCheck -check-prefix=RV32IF %s
|
|
; RUN: llc -mtriple=riscv64 -mattr=+f -verify-machineinstrs < %s \
|
|
; RUN: | FileCheck -check-prefix=RV64IF %s
|
|
|
|
; TODO: constant pool shouldn't be necessary for RV64IF.
|
|
define float @float_imm() nounwind {
|
|
; RV32IF-LABEL: float_imm:
|
|
; RV32IF: # %bb.0:
|
|
; RV32IF-NEXT: lui a0, 263313
|
|
; RV32IF-NEXT: addi a0, a0, -37
|
|
; RV32IF-NEXT: ret
|
|
;
|
|
; RV64IF-LABEL: float_imm:
|
|
; RV64IF: # %bb.0:
|
|
; RV64IF-NEXT: lui a0, %hi(.LCPI0_0)
|
|
; RV64IF-NEXT: addi a0, a0, %lo(.LCPI0_0)
|
|
; RV64IF-NEXT: flw ft0, 0(a0)
|
|
; RV64IF-NEXT: fmv.x.w a0, ft0
|
|
; RV64IF-NEXT: ret
|
|
ret float 3.14159274101257324218750
|
|
}
|
|
|
|
define float @float_imm_op(float %a) nounwind {
|
|
; TODO: addi should be folded in to the flw
|
|
; RV32IF-LABEL: float_imm_op:
|
|
; RV32IF: # %bb.0:
|
|
; RV32IF-NEXT: fmv.w.x ft0, a0
|
|
; RV32IF-NEXT: lui a0, %hi(.LCPI1_0)
|
|
; RV32IF-NEXT: addi a0, a0, %lo(.LCPI1_0)
|
|
; RV32IF-NEXT: flw ft1, 0(a0)
|
|
; RV32IF-NEXT: fadd.s ft0, ft0, ft1
|
|
; RV32IF-NEXT: fmv.x.w a0, ft0
|
|
; RV32IF-NEXT: ret
|
|
;
|
|
; RV64IF-LABEL: float_imm_op:
|
|
; RV64IF: # %bb.0:
|
|
; RV64IF-NEXT: fmv.w.x ft0, a0
|
|
; RV64IF-NEXT: lui a0, %hi(.LCPI1_0)
|
|
; RV64IF-NEXT: addi a0, a0, %lo(.LCPI1_0)
|
|
; RV64IF-NEXT: flw ft1, 0(a0)
|
|
; RV64IF-NEXT: fadd.s ft0, ft0, ft1
|
|
; RV64IF-NEXT: fmv.x.w a0, ft0
|
|
; RV64IF-NEXT: ret
|
|
%1 = fadd float %a, 1.0
|
|
ret float %1
|
|
}
|