Files
clang-p2996/llvm/test/CodeGen/RISCV/fp-imm.ll
Craig Topper 7b0c41841e [RISCV] Move compressible registers to the beginning of the FP allocation order.
We don't have very many compressible FP instructions, just load and store.
These instruction require the FP register to be f8-f15.

This patch changes the FP allocation order to prioritize f10-f15 first.
These are also the FP argument registers. So I allocated them in reverse
order starting at f15 to avoid taking the first argument registers.
This appears to match gcc allocation order.

Reviewed By: asb

Differential Revision: https://reviews.llvm.org/D146488
2023-03-27 17:29:28 -07:00

111 lines
2.8 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=riscv32 -target-abi ilp32f -mattr=+f < %s \
; RUN: | FileCheck --check-prefix=RV32F %s
; RUN: llc -mtriple=riscv32 -target-abi ilp32d -mattr=+f,+d < %s \
; RUN: | FileCheck --check-prefix=RV32D %s
; RUN: llc -mtriple=riscv64 -target-abi lp64f -mattr=+f < %s \
; RUN: | FileCheck --check-prefix=RV64F %s
; RUN: llc -mtriple=riscv64 -target-abi lp64d -mattr=+f,+d < %s \
; RUN: | FileCheck --check-prefix=RV64D %s
define float @f32_positive_zero(ptr %pf) nounwind {
; RV32F-LABEL: f32_positive_zero:
; RV32F: # %bb.0:
; RV32F-NEXT: fmv.w.x fa0, zero
; RV32F-NEXT: ret
;
; RV32D-LABEL: f32_positive_zero:
; RV32D: # %bb.0:
; RV32D-NEXT: fmv.w.x fa0, zero
; RV32D-NEXT: ret
;
; RV64F-LABEL: f32_positive_zero:
; RV64F: # %bb.0:
; RV64F-NEXT: fmv.w.x fa0, zero
; RV64F-NEXT: ret
;
; RV64D-LABEL: f32_positive_zero:
; RV64D: # %bb.0:
; RV64D-NEXT: fmv.w.x fa0, zero
; RV64D-NEXT: ret
ret float 0.0
}
define float @f32_negative_zero(ptr %pf) nounwind {
; RV32F-LABEL: f32_negative_zero:
; RV32F: # %bb.0:
; RV32F-NEXT: lui a0, 524288
; RV32F-NEXT: fmv.w.x fa0, a0
; RV32F-NEXT: ret
;
; RV32D-LABEL: f32_negative_zero:
; RV32D: # %bb.0:
; RV32D-NEXT: lui a0, 524288
; RV32D-NEXT: fmv.w.x fa0, a0
; RV32D-NEXT: ret
;
; RV64F-LABEL: f32_negative_zero:
; RV64F: # %bb.0:
; RV64F-NEXT: lui a0, 524288
; RV64F-NEXT: fmv.w.x fa0, a0
; RV64F-NEXT: ret
;
; RV64D-LABEL: f32_negative_zero:
; RV64D: # %bb.0:
; RV64D-NEXT: lui a0, 524288
; RV64D-NEXT: fmv.w.x fa0, a0
; RV64D-NEXT: ret
ret float -0.0
}
define double @f64_positive_zero(ptr %pd) nounwind {
; RV32F-LABEL: f64_positive_zero:
; RV32F: # %bb.0:
; RV32F-NEXT: li a0, 0
; RV32F-NEXT: li a1, 0
; RV32F-NEXT: ret
;
; RV32D-LABEL: f64_positive_zero:
; RV32D: # %bb.0:
; RV32D-NEXT: fcvt.d.w fa0, zero
; RV32D-NEXT: ret
;
; RV64F-LABEL: f64_positive_zero:
; RV64F: # %bb.0:
; RV64F-NEXT: li a0, 0
; RV64F-NEXT: ret
;
; RV64D-LABEL: f64_positive_zero:
; RV64D: # %bb.0:
; RV64D-NEXT: fmv.d.x fa0, zero
; RV64D-NEXT: ret
ret double 0.0
}
define double @f64_negative_zero(ptr %pd) nounwind {
; RV32F-LABEL: f64_negative_zero:
; RV32F: # %bb.0:
; RV32F-NEXT: lui a1, 524288
; RV32F-NEXT: li a0, 0
; RV32F-NEXT: ret
;
; RV32D-LABEL: f64_negative_zero:
; RV32D: # %bb.0:
; RV32D-NEXT: fcvt.d.w fa5, zero
; RV32D-NEXT: fneg.d fa0, fa5
; RV32D-NEXT: ret
;
; RV64F-LABEL: f64_negative_zero:
; RV64F: # %bb.0:
; RV64F-NEXT: li a0, -1
; RV64F-NEXT: slli a0, a0, 63
; RV64F-NEXT: ret
;
; RV64D-LABEL: f64_negative_zero:
; RV64D: # %bb.0:
; RV64D-NEXT: fmv.d.x fa5, zero
; RV64D-NEXT: fneg.d fa0, fa5
; RV64D-NEXT: ret
ret double -0.0
}